307 lines
11 KiB
PHP
307 lines
11 KiB
PHP
<?php
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* ATTENTION!
|
|
* If you see this message in your browser (Internet Explorer, Mozilla Firefox, Google Chrome, etc.)
|
|
* this means that PHP is not properly installed on your web server. Please refer to the PHP manual
|
|
* for more details: http://php.net/manual/install.php
|
|
*
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
*/
|
|
|
|
|
|
include_once dirname(__FILE__) . '/' . 'components/utils/check_utils.php';
|
|
CheckPHPVersion();
|
|
CheckTemplatesCacheFolderIsExistsAndWritable();
|
|
|
|
|
|
include_once dirname(__FILE__) . '/' . 'phpgen_settings.php';
|
|
include_once dirname(__FILE__) . '/' . 'database_engine/mysql_engine.php';
|
|
include_once dirname(__FILE__) . '/' . 'components/page.php';
|
|
|
|
|
|
function GetConnectionOptions()
|
|
{
|
|
$result = GetGlobalConnectionOptions();
|
|
$result['client_encoding'] = 'utf8';
|
|
GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);
|
|
return $result;
|
|
}
|
|
|
|
|
|
|
|
// OnBeforePageExecute event handler
|
|
|
|
|
|
|
|
class ParticipantsPage extends Page
|
|
{
|
|
protected function DoBeforeCreate()
|
|
{
|
|
$selectQuery = 'SELECT inventaires_transit.inv_numero,inventaires_transit.inv_description,t4.tot1,t4.tot2,t4.tot3,t4.tot4,t4.tot5,t4.tot6,t4.tot7,t4.tot8,t4.tot9,t4.tot10,
|
|
t4.tot11,t4.tot12,t4.tot13,t4.tot14,t4.tot15
|
|
|
|
|
|
FROM inventaires_transit join
|
|
|
|
(
|
|
SELECT invph2_f01,
|
|
SUM(if(invph2_cli_numero = 1,invph2_f30,0)) AS "tot1",
|
|
SUM(if(invph2_cli_numero = 2,invph2_f30,0))AS "tot2",
|
|
SUM(if(invph2_cli_numero = 3,invph2_f30,0)) AS "tot3",
|
|
SUM(if(invph2_cli_numero = 4,invph2_f30,0)) AS "tot4",
|
|
SUM(if(invph2_cli_numero = 5,invph2_f30,0)) AS "tot5",
|
|
SUM(if(invph2_cli_numero = 6,invph2_f30,0)) AS "tot6",
|
|
SUM(if(invph2_cli_numero = 7,invph2_f30,0))AS "tot7",
|
|
SUM(if(invph2_cli_numero = 8,invph2_f30,0)) AS "tot8",
|
|
SUM(if(invph2_cli_numero = 9,invph2_f30,0)) AS "tot9",
|
|
SUM(if(invph2_cli_numero = 10,invph2_f30,0)) AS "tot10",
|
|
SUM(if(invph2_cli_numero = 11,invph2_f30,0)) AS "tot11",
|
|
SUM(if(invph2_cli_numero = 12,invph2_f30,0))AS "tot12",
|
|
SUM(if(invph2_cli_numero = 13,invph2_f30,0)) AS "tot13",
|
|
SUM(if(invph2_cli_numero = 14,invph2_f30,0)) AS "tot14",
|
|
SUM(if(invph2_cli_numero = 15,invph2_f30,0)) AS "tot15"
|
|
|
|
FROM inventaires_phase2
|
|
|
|
|
|
GROUP BY invph2_f01
|
|
) as t4 on t4.invph2_f01= inv_numero
|
|
';
|
|
$insertQuery = array();
|
|
$updateQuery = array();
|
|
$deleteQuery = array();
|
|
$this->dataset = new QueryDataset(
|
|
new MyConnectionFactory(),
|
|
GetConnectionOptions(),
|
|
$selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'Participants');
|
|
$field = new StringField('inv_numero');
|
|
$this->dataset->AddField($field, true);
|
|
$field = new StringField('inv_description');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot1');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot2');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot3');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot4');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot5');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot6');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot7');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot8');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot9');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot10');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot11');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot12');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot13');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot14');
|
|
$this->dataset->AddField($field, false);
|
|
$field = new IntegerField('tot15');
|
|
$this->dataset->AddField($field, false);
|
|
$this->dataset->AddCustomCondition(EnvVariablesUtils::EvaluateVariableTemplate($this->GetColumnVariableContainer(), '(eve_id=15) and sta_id=3'));
|
|
}
|
|
|
|
protected function CreatePageNavigator()
|
|
{
|
|
$result = new CompositePageNavigator($this);
|
|
|
|
$partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
|
|
$partitionNavigator->SetRowsPerPage(20);
|
|
$result->AddPageNavigator($partitionNavigator);
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function GetPageList()
|
|
{
|
|
$currentPageCaption = $this->GetShortCaption();
|
|
$result = new PageList($this);
|
|
if (GetCurrentUserGrantForDataSource('Participants')->HasViewGrant())
|
|
$result->AddPage(new PageLink($this->RenderText('Inventaires'), 'premierevideo.php', $this->RenderText('Inventaires'), $currentPageCaption == $this->RenderText('Inventaires')));
|
|
|
|
if ( HasAdminPage() && GetApplication()->HasAdminGrantForCurrentUser() )
|
|
$result->AddPage(new PageLink($this->GetLocalizerCaptions()->GetMessageString('AdminPage'), 'phpgen_admin.php', $this->GetLocalizerCaptions()->GetMessageString('AdminPage'), false, true));
|
|
return $result;
|
|
}
|
|
|
|
protected function CreateRssGenerator()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
protected function CreateGridSearchControl(Grid $grid)
|
|
{
|
|
$grid->UseFilter = false;
|
|
|
|
}
|
|
|
|
protected function CreateGridAdvancedSearchControl(Grid $grid)
|
|
{
|
|
|
|
}
|
|
|
|
protected function AddOperationsColumns(Grid $grid)
|
|
{
|
|
$actionsBandName = 'actions';
|
|
$grid->AddBandToBegin($actionsBandName, $this->GetLocalizerCaptions()->GetMessageString('Actions'), true);
|
|
if ($this->GetSecurityInfo()->HasViewGrant())
|
|
{
|
|
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset);
|
|
$grid->AddViewColumn($column, $actionsBandName);
|
|
$column->SetImagePath('images/view_action.png');
|
|
}
|
|
}
|
|
|
|
protected function AddFieldColumns(Grid $grid)
|
|
{
|
|
|
|
}
|
|
|
|
protected function AddSingleRecordViewColumns(Grid $grid)
|
|
{
|
|
|
|
}
|
|
|
|
protected function AddEditColumns(Grid $grid)
|
|
{
|
|
|
|
}
|
|
|
|
protected function AddInsertColumns(Grid $grid)
|
|
{
|
|
|
|
if ($this->GetSecurityInfo()->HasAddGrant())
|
|
{
|
|
$grid->SetShowAddButton(false);
|
|
$grid->SetShowInlineAddButton(false);
|
|
}
|
|
else
|
|
{
|
|
$grid->SetShowInlineAddButton(false);
|
|
$grid->SetShowAddButton(false);
|
|
}
|
|
}
|
|
|
|
protected function AddPrintColumns(Grid $grid)
|
|
{
|
|
|
|
}
|
|
|
|
protected function AddExportColumns(Grid $grid)
|
|
{
|
|
|
|
}
|
|
|
|
public function GetPageDirection()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
|
|
{
|
|
$column->SetShowSetToNullCheckBox(false);
|
|
$column->SetVariableContainer($this->GetColumnVariableContainer());
|
|
}
|
|
|
|
function GetCustomClientScript()
|
|
{
|
|
return ;
|
|
}
|
|
|
|
function GetOnPageLoadedClientScript()
|
|
{
|
|
return ;
|
|
}
|
|
|
|
protected function CreateGrid()
|
|
{
|
|
$result = new Grid($this, $this->dataset, 'ParticipantsGrid');
|
|
if ($this->GetSecurityInfo()->HasDeleteGrant())
|
|
$result->SetAllowDeleteSelected(false);
|
|
else
|
|
$result->SetAllowDeleteSelected(false);
|
|
|
|
ApplyCommonPageSettings($this, $result);
|
|
|
|
$result->SetUseImagesForActions(true);
|
|
$result->SetUseFixedHeader(false);
|
|
|
|
$result->SetShowLineNumbers(false);
|
|
|
|
$result->SetHighlightRowAtHover(false);
|
|
$result->SetWidth('');
|
|
$this->CreateGridSearchControl($result);
|
|
$this->CreateGridAdvancedSearchControl($result);
|
|
$this->AddOperationsColumns($result);
|
|
$this->AddFieldColumns($result);
|
|
$this->AddSingleRecordViewColumns($result);
|
|
$this->AddEditColumns($result);
|
|
$this->AddInsertColumns($result);
|
|
$this->AddPrintColumns($result);
|
|
$this->AddExportColumns($result);
|
|
|
|
$this->SetShowPageList(true);
|
|
$this->SetHidePageListByDefault(false);
|
|
$this->SetExportToExcelAvailable(true);
|
|
$this->SetExportToWordAvailable(true);
|
|
$this->SetExportToXmlAvailable(true);
|
|
$this->SetExportToCsvAvailable(true);
|
|
$this->SetExportToPdfAvailable(true);
|
|
$this->SetPrinterFriendlyAvailable(true);
|
|
$this->SetSimpleSearchAvailable(true);
|
|
$this->SetAdvancedSearchAvailable(true);
|
|
$this->SetFilterRowAvailable(true);
|
|
$this->SetVisualEffectsEnabled(true);
|
|
$this->SetShowTopPageNavigator(true);
|
|
$this->SetShowBottomPageNavigator(true);
|
|
|
|
//
|
|
// Http Handlers
|
|
//
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function OpenAdvancedSearchByDefault()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
protected function DoGetGridHeader()
|
|
{
|
|
return '';
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try
|
|
{
|
|
$Page = new ParticipantsPage("premierevideo.php", "Participants", GetCurrentUserGrantForDataSource("Participants"), 'UTF-8');
|
|
$Page->SetShortCaption('Inventaires');
|
|
$Page->SetHeader(GetPagesHeader());
|
|
$Page->SetFooter(GetPagesFooter());
|
|
$Page->SetCaption('Inventaires');
|
|
$Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("Participants"));
|
|
GetApplication()->SetEnableLessRunTimeCompile(GetEnableLessFilesRunTimeCompilation());
|
|
GetApplication()->SetCanUserChangeOwnPassword(
|
|
!function_exists('CanUserChangeOwnPassword') || CanUserChangeOwnPassword());
|
|
GetApplication()->SetMainPage($Page);
|
|
GetApplication()->Run();
|
|
}
|
|
catch(Exception $e)
|
|
{
|
|
ShowErrorPage($e->getMessage());
|
|
}
|
|
|