You are on page 1of 4

<?

php

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

* ATTENTION!

* If you see this message in browser (Internet Explorer, Mozilla firefox, etc.)

* this means that

***************************************

*/

require_once 'components/utils/check_utils.php';

CheckPHPVersion();

require_once 'database_engine/mysql_engine.php';

require_once 'components/page.php';

require_once 'phpgen_settings.php';

function GetConnectionOptions()

$result = GetGlobalConnectionOptions();

$result['client_encoding'] = 'utf8';

GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);

return $result;

?><?php
?><?php

class articlePage extends Page

protected function DoBeforeCreate()

$this->dataset = new TableDataset(

new MyConnectionFactory(),

GetConnectionOptions(),

'`article`');

$field = new StringField('code-art');

$this->dataset->AddField($field, true);

$field = new StringField('article');

$this->dataset->AddField($field, false);

$field = new IntegerField('prix_unitaire');

$this->dataset->AddField($field, false);

$field = new IntegerField('tva');

$this->dataset->AddField($field, false);

$field = new IntegerField('ptix-ttc');

$this->dataset->AddField($field, false);

$field = new BlobField('IMAGE');

$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('article')->HasViewGrant())

$result->AddPage(new PageLink($this->RenderText('Article'), 'index.php', $this-


>RenderText('Article'), $currentPageCaption == $this->RenderText('Article')));

if ( HasAdminPage() && GetApplication()->HasAdminGrantForCurrentUser() )

$result->AddPage(new PageLink($this->RenderText('Admin page'), 'phpgen_admin.php',


'Admin page', false, true));

return $result;

protected function CreateRssGenerator()

return null;

protected function CreateGridSearchControl($grid)

$grid->UseFilter = true;

$grid->SearchControl = new SimpleSearch('articlessearch', $this->dataset,

array('code-art', 'article', 'prix_unitaire', 'tva', 'ptix-ttc', 'IMAGE'),

array($this->RenderText('Code-art'), $this->RenderText('Article'), $this->RenderText('Prix


Unitaire'), $this->RenderText('Tva'), $this->RenderText('Ptix-ttc'), $this->RenderText('IMAGE')),

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)

$this->AdvancedSearchControl = new AdvancedSearchControl('articleasearch', $this->dataset,


$this->GetLocalizerCaptions(), $this->GetColumnVariableContainer(), $this->CreateLinkBuilder());

$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl-
>CreateStringSearchInput('code-art', $this->RenderText('Code-art')));

$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl-
>CreateStringSearchInput('article', $this->RenderText('Article')));

$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl-
>CreateStringSearchInput('prix_unitaire', $this->RenderText('Prix Unitaire')));

$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl-
>CreateStringSearchInput('tva', $this->RenderText('Tva')));

$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl-
>CreateStringSearchInput('ptix-ttc', $this->RenderText('Ptix-ttc')));

$this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl-
>CreateBlobSearchInput('IMAGE', $this->RenderText('IMAGE')));

protected function AddOperationsColumns($grid)

$actionsBandName = 'actions';

You might also like