예제 #1
0
 protected function doRenderGrid(Grid $Grid, $pageMode, $templatePath, $customParams = array())
 {
     $Rows = array();
     while ($Grid->GetDataset()->Next()) {
         $rowValues = $Grid->GetDataset()->GetCurrentFieldValues();
         $Rows[] = Q::ToArray(Q::Select($Grid->GetPrintColumns(), Q::L('$c => $_1->RenderViewColumn($c, $_2)', $this, $rowValues)));
     }
     $template = $Grid->GetPage()->GetCustomTemplate(PagePart::Grid, $pageMode, $templatePath, $customParams);
     $this->DisplayTemplate($template, array('Grid' => $Grid), array_merge($customParams, array('Columns' => $Grid->GetPrintColumns(), 'Rows' => $Rows)));
 }
예제 #2
0
 public function RenderGrid(Grid $Grid)
 {
     $page = $Grid->GetPage();
     // Remove!!!
     if (isset($page->AdvancedSearchControl)) {
         $linkBuilder = $page->CreateLinkBuilder();
         $linkBuilder->AddParameter(OPERATION_PARAMNAME, OPERATION_ADVANCED_SEARCH);
         $page->AdvancedSearchControl->SetOpenInNewWindowLink($linkBuilder->GetLink());
     }
     $template = $this->renderSingleRow ? 'list/single_row.tpl' : 'list/grid.tpl';
     if (!$this->renderSingleRow) {
         $template = $page->GetCustomTemplate(PagePart::Grid, PageMode::ViewAll, $template);
     }
     $this->DisplayTemplate($template, array('Grid' => $Grid, 'Page' => $Grid->GetPage(), 'DataGrid' => $Grid->GetViewData($this)), array('SingleRowTemplate' => $page->GetCustomTemplate(PagePart::GridRow, PageMode::ViewAll, 'list/single_row.tpl'), 'AdvancedSearchControl' => $page->AdvancedSearchControl, 'HiddenValues' => $Grid->GetHiddenValues(), 'TextsForHighlight' => $page->AdvancedSearchControl ? array_map(Q::L('($v) => StringUtils::JSStringLiteral($v)'), $page->AdvancedSearchControl->GetHighlightedFieldText()) : array(), 'HighlightOptions' => $page->AdvancedSearchControl ? $page->AdvancedSearchControl->GetHighlightedFieldOptions() : array(), 'Authentication' => $page->GetAuthenticationViewData(), 'Columns' => $Grid->GetViewColumns(), 'Bands' => $Grid->GetViewBands(), 'FilterBuilder' => $Grid->GetFilterBuilder()->GetViewData(), 'ActiveFilterBuilderJson' => $Grid->GetFilterBuilder()->GetActiveFilterAsJson(), 'ActiveFilterBuilderAsString' => $Grid->GetFilterBuilder()->GetActiveFilterAsString(), 'IsActiveFilterEmpty' => $Grid->GetFilterBuilder()->IsEmpty()));
 }
예제 #3
0
 function RenderGrid(Grid $Grid)
 {
     $Rows = array();
     $Grid->GetDataset()->Open();
     while ($Grid->GetDataset()->Next()) {
         $rowValues = $Grid->GetDataset()->GetCurrentFieldValues();
         $Rows[] = Q::ToArray(Q::Select($Grid->GetPrintColumns(), Q::L('$c => $_1->RenderViewColumn($c, $_2)', $this, $rowValues)));
     }
     $totals = array();
     if ($Grid->HasTotals()) {
         $totalValues = $Grid->GetTotalValues();
         foreach ($Grid->GetPrintColumns() as $column) {
             $totals[] = $column->GetTotalPresentationData(ArrayUtils::GetArrayValueDef($totalValues, $column->GetName(), null));
         }
     }
     $this->DisplayTemplate('print/grid.tpl', array('Grid' => $Grid), array('Columns' => $Grid->GetPrintColumns(), 'Rows' => $Rows, 'Totals' => $totals));
 }
 public function RenderGrid(Grid $Grid)
 {
     $page = $Grid->GetPage();
     // Remove!!!
     if (isset($page->AdvancedSearchControl)) {
         $linkBuilder = $page->CreateLinkBuilder();
         $linkBuilder->AddParameter(OPERATION_PARAMNAME, OPERATION_ADVANCED_SEARCH);
         $page->AdvancedSearchControl->SetOpenInNewWindowLink($linkBuilder->GetLink());
     }
     $templates = array(ViewMode::TABLE => array('grid' => 'list/grid.tpl', 'single' => 'list/single_row.tpl'), ViewMode::CARD => array('grid' => 'list/grid_card.tpl', 'single' => 'list/single_row_card.tpl'));
     $selectedTemplates = $templates[$Grid->GetViewMode()];
     $template = $this->renderSingleRow ? $selectedTemplates['single'] : $selectedTemplates['grid'];
     $customParams = array();
     if (!$this->renderSingleRow) {
         $template = $page->GetCustomTemplate(PagePart::Grid, PageMode::ViewAll, $template, $customParams);
     }
     $this->DisplayTemplate($template, array('Grid' => $Grid, 'Page' => $Grid->GetPage(), 'DataGrid' => $Grid->GetViewData($this)), array_merge($customParams, array('isMasterGrid' => $Grid->GetName() == 'master_grid', 'SingleRowTemplate' => $page->GetCustomTemplate(PagePart::GridRow, PageMode::ViewAll, $selectedTemplates['single']), 'AdvancedSearchControl' => $page->AdvancedSearchControl, 'HiddenValues' => $Grid->GetHiddenValues(), 'TextsForHighlight' => $page->AdvancedSearchControl ? array_map(Q::L('($v) => StringUtils::JSStringLiteral($v)'), $page->AdvancedSearchControl->GetHighlightedFieldText()) : array(), 'HighlightOptions' => $page->AdvancedSearchControl ? $page->AdvancedSearchControl->GetHighlightedFieldOptions() : array(), 'Authentication' => $page->GetAuthenticationViewData(), 'Columns' => $Grid->GetViewColumns(), 'Bands' => $Grid->GetViewBands(), 'FilterBuilder' => $Grid->GetFilterBuilder()->GetViewData(), 'ActiveFilterBuilderJson' => $Grid->GetFilterBuilder()->GetActiveFilterAsJson(), 'ActiveFilterBuilderAsString' => $Grid->GetFilterBuilder()->GetActiveFilterAsString(), 'IsActiveFilterEmpty' => $Grid->GetFilterBuilder()->IsEmpty(), 'EnableRunTimeCustomization' => $Grid->getEnableRunTimeCustomization(), 'ViewModes' => ViewMode::getList())));
 }