Пример #1
0
    $oParam->SetName('id')->SetKey('id');
    $oLink = new Builder_Helper_Link();
    $oLink->SetPath(BuildUrl('company.php'))->SetParam($oParam);
    $oColumn3 = new Builder_Helper_Column();
    $oColumn3->SetName('name')->SetLabel('Name')->SetSort(Builder_Grid::SORT_ALPHA)->SetLink($oLink);
    $oColumn4 = new Builder_Helper_Column();
    $oColumn4->SetName('category')->SetLabel('Category')->SetSort(Builder_Grid::SORT_ALPHA);
    $oColumn5 = new Builder_Helper_Column();
    $oColumn5->SetName('coords')->SetLabel('Map')->SetFormat('coordinates');
    $oColumn6 = new Builder_Helper_Column();
    $oColumn6->SetName('description')->SetLabel('Description')->SetFormat('truncate', array(40, '...'));
    $oColumns = new Builder_Helper_Columns();
    $oColumns->AddColumn($oColumn1)->AddColumn($oColumn2)->AddColumn($oColumn3)->AddColumn($oColumn4)->AddColumn($oColumn5)->AddColumn($oColumn6);
    $oAction1 = new Builder_Helper_Action();
    $oAction1->SetName('Add New Company')->SetClass('add');
    $oAction2 = new Builder_Helper_Action();
    $oAction1->SetName('Delete Company')->SetClass('delete');
    $oActions = new Builder_Helper_Actions();
    $oActions->AddAction($oAction1)->AddAction($oAction2);
    // Add our groups to our form helper and set some basic attributes
    $oGridHelper = new Builder_Helper_Grid('company-grid');
    $oGridHelper->AddColumns($oColumns)->AddFooterActions($oActions)->SetHeading('Companies')->SetSubheading('List of companies that do business in this area')->SetCopy('Easily sorted list of companies')->SetPaging(array('num-records' => 10))->SetScript('post_to_this_form.php');
    // Build our form
    $oGrid = new Builder_Grid();
    echo $oGrid->Render($oGridHelper->ToArray(), $aCompanies);
} catch (Exception $oException) {
    echo 'Exception: ' . $oException->getMessage();
}
?>
</body>
</html>
Пример #2
0
    $oParam->SetName('id')->SetKey('id');
    $oLink = new Builder_Helper_Link();
    $oLink->SetPath(BuildUrl('company.php'))->SetParam($oParam);
    $oColumn3 = new Builder_Helper_Column();
    $oColumn3->SetName('name')->SetLabel('Name')->SetLink($oLink);
    $oColumn4 = new Builder_Helper_Column();
    $oColumn4->SetName('category')->SetLabel('Category');
    $oColumn5 = new Builder_Helper_Column();
    $oColumn5->SetName('coords')->SetLabel('Map')->SetFormat('coordinates');
    $oColumn6 = new Builder_Helper_Column();
    $oColumn6->SetName('description')->SetLabel('Description')->SetFormat('truncate', array(40, '...'));
    $oColumns = new Builder_Helper_Columns();
    $oColumns->AddColumn($oColumn1)->AddColumn($oColumn2)->AddColumn($oColumn3)->AddColumn($oColumn4)->AddColumn($oColumn5)->AddColumn($oColumn6);
    $oAction1 = new Builder_Helper_Action();
    $oAction1->SetName('Add New Company')->SetClass('add');
    $oAction2 = new Builder_Helper_Action();
    $oAction2->SetName('Delete Company')->SetClass('delete');
    $oActions = new Builder_Helper_Actions();
    $oActions->AddAction($oAction1)->AddAction($oAction2);
    // Add our groups to our form helper and set some basic attributes
    $oGridHelper = new Builder_Helper_Grid('company-grid');
    $oGridHelper->AddColumns($oColumns)->AddFooterActions($oActions)->SetHeading('Companies')->SetSubheading('List of companies that do business in this area grouped by category')->SetCopy("Grouping currently does not support ordering as well (it gets messy quickly). But don't worry. It's in the TODO list.")->SetPaging(array('num-records' => 10))->SetGroup('category')->SetScript('post_to_this_form.php');
    // Build our form
    $oGrid = new Builder_Grid();
    echo $oGrid->Render($oGridHelper->ToArray(), $aCompanies);
} catch (Exception $oException) {
    echo 'Exception: ' . $oException->getMessage();
}
?>
</body>
</html>