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

483 lines
21 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 config_clientPage extends Page
{
protected function DoBeforeCreate()
{
$this->dataset = new TableDataset(
new MyConnectionFactory(),
GetConnectionOptions(),
'`config_client`');
$field = new IntegerField('pk_config_client', null, null, true);
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('clef');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('info');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
}
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('config_client')->HasViewGrant())
$result->AddPage(new PageLink($this->RenderText('Config Client'), 'config_client.php', $this->RenderText('Config Client'), $currentPageCaption == $this->RenderText('Config Client')));
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('config_clientssearch', $this->dataset,
array('pk_config_client', 'clef', 'info'),
array($this->RenderText('Pk Config Client'), $this->RenderText('Clef'), $this->RenderText('Info')),
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('config_clientasearch', $this->dataset, $this->GetLocalizerCaptions(), $this->GetColumnVariableContainer(), $this->CreateLinkBuilder());
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('pk_config_client', $this->RenderText('Pk Config Client')));
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('clef', $this->RenderText('Clef')));
$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('info', $this->RenderText('Info')));
}
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');
}
if ($this->GetSecurityInfo()->HasEditGrant())
{
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset);
$grid->AddViewColumn($column, $actionsBandName);
$column->SetImagePath('images/edit_action.png');
$column->OnShow->AddListener('ShowEditButtonHandler', $this);
}
if ($this->GetSecurityInfo()->HasDeleteGrant())
{
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset);
$grid->AddViewColumn($column, $actionsBandName);
$column->SetImagePath('images/delete_action.png');
$column->OnShow->AddListener('ShowDeleteButtonHandler', $this);
$column->SetAdditionalAttribute("data-modal-delete", "true");
$column->SetAdditionalAttribute("data-delete-handler-name", $this->GetModalGridDeleteHandler());
}
if ($this->GetSecurityInfo()->HasAddGrant())
{
$column = new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Copy'), OPERATION_COPY, $this->dataset);
$grid->AddViewColumn($column, $actionsBandName);
$column->SetImagePath('images/copy_action.png');
}
}
protected function AddFieldColumns(Grid $grid)
{
//
// View column for pk_config_client field
//
$column = new TextViewColumn('pk_config_client', 'Pk Config Client', $this->dataset);
$column->SetOrderable(true);
$column->SetDescription($this->RenderText(''));
$column->SetFixedWidth(null);
$grid->AddViewColumn($column);
//
// View column for clef field
//
$column = new TextViewColumn('clef', 'Clef', $this->dataset);
$column->SetOrderable(true);
/* <inline edit column> */
//
// Edit column for clef field
//
$editor = new TextEdit('clef_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Clef', 'clef', $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 clef field
//
$editor = new TextEdit('clef_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Clef', 'clef', $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 info field
//
$column = new TextViewColumn('info', 'Info', $this->dataset);
$column->SetOrderable(true);
/* <inline edit column> */
//
// Edit column for info field
//
$editor = new TextEdit('info_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Info', 'info', $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 info field
//
$editor = new TextEdit('info_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Info', 'info', $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 pk_config_client field
//
$column = new TextViewColumn('pk_config_client', 'Pk Config Client', $this->dataset);
$column->SetOrderable(true);
$grid->AddSingleRecordViewColumn($column);
//
// View column for clef field
//
$column = new TextViewColumn('clef', 'Clef', $this->dataset);
$column->SetOrderable(true);
$grid->AddSingleRecordViewColumn($column);
//
// View column for info field
//
$column = new TextViewColumn('info', 'Info', $this->dataset);
$column->SetOrderable(true);
$grid->AddSingleRecordViewColumn($column);
}
protected function AddEditColumns(Grid $grid)
{
//
// Edit column for clef field
//
$editor = new TextEdit('clef_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Clef', 'clef', $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 info field
//
$editor = new TextEdit('info_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Info', 'info', $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 clef field
//
$editor = new TextEdit('clef_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Clef', 'clef', $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 info field
//
$editor = new TextEdit('info_edit');
$editor->SetSize(45);
$editor->SetMaxLength(45);
$editColumn = new CustomEditColumn('Info', 'info', $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(true);
$grid->SetShowInlineAddButton(false);
}
else
{
$grid->SetShowInlineAddButton(false);
$grid->SetShowAddButton(false);
}
}
protected function AddPrintColumns(Grid $grid)
{
//
// View column for pk_config_client field
//
$column = new TextViewColumn('pk_config_client', 'Pk Config Client', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
//
// View column for clef field
//
$column = new TextViewColumn('clef', 'Clef', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
//
// View column for info field
//
$column = new TextViewColumn('info', 'Info', $this->dataset);
$column->SetOrderable(true);
$grid->AddPrintColumn($column);
}
protected function AddExportColumns(Grid $grid)
{
//
// View column for pk_config_client field
//
$column = new TextViewColumn('pk_config_client', 'Pk Config Client', $this->dataset);
$column->SetOrderable(true);
$grid->AddExportColumn($column);
//
// View column for clef field
//
$column = new TextViewColumn('clef', 'Clef', $this->dataset);
$column->SetOrderable(true);
$grid->AddExportColumn($column);
//
// View column for info field
//
$column = new TextViewColumn('info', 'Info', $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 ;
}
public function ShowEditButtonHandler(&$show)
{
if ($this->GetRecordPermission() != null)
$show = $this->GetRecordPermission()->HasEditGrant($this->GetDataset());
}
public function ShowDeleteButtonHandler(&$show)
{
if ($this->GetRecordPermission() != null)
$show = $this->GetRecordPermission()->HasDeleteGrant($this->GetDataset());
}
public function GetModalGridDeleteHandler() { return 'config_client_modal_delete'; }
protected function GetEnableModalGridDelete() { return true; }
protected function CreateGrid()
{
$result = new Grid($this, $this->dataset, 'config_clientGrid');
if ($this->GetSecurityInfo()->HasDeleteGrant())
$result->SetAllowDeleteSelected(true);
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 config_clientPage("config_client.php", "config_client", GetCurrentUserGrantForDataSource("config_client"), 'UTF-8');
$Page->SetShortCaption('Config Client');
$Page->SetHeader(GetPagesHeader());
$Page->SetFooter(GetPagesFooter());
$Page->SetCaption('Config Client');
$Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("config_client"));
GetApplication()->SetEnableLessRunTimeCompile(GetEnableLessFilesRunTimeCompilation());
GetApplication()->SetCanUserChangeOwnPassword(
!function_exists('CanUserChangeOwnPassword') || CanUserChangeOwnPassword());
GetApplication()->SetMainPage($Page);
GetApplication()->Run();
}
catch(Exception $e)
{
ShowErrorPage($e->getMessage());
}