Files
ms1inscription-v5/rapports/Query01.php
2026-05-13 09:43:32 -04:00

404 lines
17 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 Query01Page extends Page
{
protected function DoBeforeCreate()
{
$selectQuery = 'SELECT
inscriptions_panier_participants.par_id,
inscriptions_panier_participants.par_nom
FROM
inscriptions_panier_participants';
$insertQuery = array();
$updateQuery = array();
$deleteQuery = array();
$this->dataset = new QueryDataset(
new MyConnectionFactory(),
GetConnectionOptions(),
$selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'Query01');
$field = new StringField('par_id');
$this->dataset->AddField($field, true);
$field = new StringField('par_nom');
$this->dataset->AddField($field, true);
}
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('Query01')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Query01'), 'Query01.php', $this->RenderText('Query01'), $currentPageCaption == $this->RenderText('Query01')));
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 = true;
$grid->SearchControl = new SimpleSearch('Query01ssearch', $this->dataset,
array('par_id', 'par_nom'),
array($this->RenderText('Par Id'), $this->RenderText('Par Nom')),
array(
'=' => $this->GetLocalizerCaptions()->GetMessageString('equals'),
'<>' => $this->GetLocalizerCaptions()->GetMessageString('doesNotEquals'),
'<' => $this->GetLocalizerCaptions()->GetMessageString('isLessThan'),
'<=' => $this->GetLocalizerCaptions()->GetMessageString('isLessThanOrEqualsTo'),
'>' => $this->GetLocalizerCaptions()->GetMessageString('isGreaterThan'),
'>=' => $this->GetLocalizerCaptions()->GetMessageString('isGreaterThanOrEqualsTo'),
'ILIKE' => $this->GetLocalizerCaptions()->GetMessageString('Like'),
'STARTS' => $this->GetLocalizerCaptions()->GetMessageString('StartsWith'),
'ENDS' => $this->GetLocalizerCaptions()->GetMessageString('EndsWith'),
'CONTAINS' => $this->GetLocalizerCaptions()->GetMessageString('Contains')
), $this->GetLocalizerCaptions(), $this, 'CONTAINS'
);
}
protected function CreateGridAdvancedSearchControl(Grid $grid)
{
$this->AdvancedSearchControl = new AdvancedSearchControl('Query01asearch', $this->dataset, $this->GetLocalizerCaptions(), $this->GetColumnVariableContainer(), $this->CreateLinkBuilder());
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('par_id', $this->RenderText('Par Id')));
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('par_nom', $this->RenderText('Par Nom')));
}
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)
{
//
// View column for par_id field
//
$column = new TextViewColumn('par_id', 'Par Id', $this->dataset);
$column->SetOrderable(true);
/* <inline edit column> */
//
// Edit column for par_id field
//
$editor = new TextEdit('par_id_edit');
$editColumn = new CustomEditColumn('Par Id', 'par_id', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$column->SetEditOperationColumn($editColumn);
/* </inline edit column> */
/* <inline insert column> */
//
// Edit column for par_id field
//
$editor = new TextEdit('par_id_edit');
$editColumn = new CustomEditColumn('Par Id', 'par_id', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$column->SetInsertOperationColumn($editColumn);
/* </inline insert column> */
$column->SetDescription($this->RenderText(''));
$column->SetFixedWidth(null);
$grid->AddViewColumn($column);
//
// View column for par_nom field
//
$column = new TextViewColumn('par_nom', 'Par Nom', $this->dataset);
$column->SetOrderable(true);
/* <inline edit column> */
//
// Edit column for par_nom field
//
$editor = new TextEdit('par_nom_edit');
$editColumn = new CustomEditColumn('Par Nom', 'par_nom', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$column->SetEditOperationColumn($editColumn);
/* </inline edit column> */
/* <inline insert column> */
//
// Edit column for par_nom field
//
$editor = new TextEdit('par_nom_edit');
$editColumn = new CustomEditColumn('Par Nom', 'par_nom', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$column->SetInsertOperationColumn($editColumn);
/* </inline insert column> */
$column->SetDescription($this->RenderText(''));
$column->SetFixedWidth(null);
$grid->AddViewColumn($column);
}
protected function AddSingleRecordViewColumns(Grid $grid)
{
//
// View column for par_id field
//
$column = new TextViewColumn('par_id', 'Par Id', $this->dataset);
$column->SetOrderable(true);
$grid->AddSingleRecordViewColumn($column);
//
// View column for par_nom field
//
$column = new TextViewColumn('par_nom', 'Par Nom', $this->dataset);
$column->SetOrderable(true);
$grid->AddSingleRecordViewColumn($column);
}
protected function AddEditColumns(Grid $grid)
{
//
// Edit column for par_id field
//
$editor = new TextEdit('par_id_edit');
$editColumn = new CustomEditColumn('Par Id', 'par_id', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddEditColumn($editColumn);
//
// Edit column for par_nom field
//
$editor = new TextEdit('par_nom_edit');
$editColumn = new CustomEditColumn('Par Nom', 'par_nom', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddEditColumn($editColumn);
}
protected function AddInsertColumns(Grid $grid)
{
//
// Edit column for par_id field
//
$editor = new TextEdit('par_id_edit');
$editColumn = new CustomEditColumn('Par Id', 'par_id', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddInsertColumn($editColumn);
//
// Edit column for par_nom field
//
$editor = new TextEdit('par_nom_edit');
$editColumn = new CustomEditColumn('Par Nom', 'par_nom', $editor, $this->dataset);
$validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
$editor->GetValidatorCollection()->AddValidator($validator);
$this->ApplyCommonColumnEditProperties($editColumn);
$grid->AddInsertColumn($editColumn);
if ($this->GetSecurityInfo()->HasAddGrant())
{
$grid->SetShowAddButton(false);
$grid->SetShowInlineAddButton(false);
}
else
{
$grid->SetShowInlineAddButton(false);
$grid->SetShowAddButton(false);
}
}
protected function AddPrintColumns(Grid $grid)
{
//
// View column for par_id field
//
$column = new TextViewColumn('par_id', 'Par Id', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
//
// View column for par_nom field
//
$column = new TextViewColumn('par_nom', 'Par Nom', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
}
protected function AddExportColumns(Grid $grid)
{
//
// View column for par_id field
//
$column = new TextViewColumn('par_id', 'Par Id', $this->dataset);
$column->SetOrderable(true);
$grid->AddExportColumn($column);
//
// View column for par_nom field
//
$column = new TextViewColumn('par_nom', 'Par Nom', $this->dataset);
$column->SetOrderable(true);
$grid->AddExportColumn($column);
}
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, 'Query01Grid');
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 Query01Page("Query01.php", "Query01", GetCurrentUserGrantForDataSource("Query01"), 'UTF-8');
$Page->SetShortCaption('Query01');
$Page->SetHeader(GetPagesHeader());
$Page->SetFooter(GetPagesFooter());
$Page->SetCaption('Query01');
$Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("Query01"));
GetApplication()->SetEnableLessRunTimeCompile(GetEnableLessFilesRunTimeCompilation());
GetApplication()->SetCanUserChangeOwnPassword(
!function_exists('CanUserChangeOwnPassword') || CanUserChangeOwnPassword());
GetApplication()->SetMainPage($Page);
GetApplication()->Run();
}
catch(Exception $e)
{
ShowErrorPage($e->getMessage());
}