Esempio n. 1
0
 function RenderGrid(Grid $Grid)
 {
     $Rows = array();
     $Grid->GetDataset()->Open();
     while ($Grid->GetDataset()->Next()) {
         $rowValues = $Grid->GetDataset()->GetCurrentFieldValues();
         $Row = array();
         foreach ($Grid->GetExportColumns() as $column) {
             $Row[$this->PrepareColumnCaptionForXml($column->GetCaption())] = $this->RenderViewColumn($column, $rowValues);
         }
         $Rows[] = $Row;
     }
     $this->DisplayTemplate('export/xml_grid.tpl', array('Grid' => $Grid), array('Rows' => $Rows, 'TableName' => $Grid->GetPage()->GetCaption()));
 }
Esempio n. 2
0
 function RenderGrid(Grid $grid)
 {
     $hiddenValues = array(OPERATION_PARAMNAME => OPERATION_COMMIT);
     AddPrimaryKeyParametersToArray($hiddenValues, $grid->GetDataset()->GetPrimaryKeyValues());
     $template = $grid->GetPage()->GetCustomTemplate(PagePart::VerticalGrid, PageMode::Edit, 'edit/grid.tpl');
     $this->DisplayTemplate($template, array('Grid' => $grid->GetEditViewData($this)), array('Authentication' => $grid->GetPage()->GetAuthenticationViewData(), 'HiddenValues' => $hiddenValues));
 }
Esempio n. 3
0
 function RenderGrid(Grid $Grid)
 {
     $primaryKeyMap = array();
     $Grid->GetDataset()->Open();
     $Row = array();
     $hiddenValues = '';
     if ($Grid->GetDataset()->Next()) {
         foreach ($Grid->GetSingleRecordViewColumns() as $column) {
             $Row[] = $this->Render($column);
         }
         $hiddenValues = array(OPERATION_PARAMNAME => OPERATION_COMMIT_DELETE);
         AddPrimaryKeyParametersToArray($hiddenValues, $Grid->GetDataset()->GetPrimaryKeyValues());
         $primaryKeyMap = $Grid->GetDataset()->GetPrimaryKeyValuesMap();
     }
     $this->DisplayTemplate('delete/grid.tpl', array('Grid' => $Grid, 'Columns' => $Grid->GetSingleRecordViewColumns()), array('Title' => $Grid->GetPage()->GetShortCaption(), 'PrimaryKeyMap' => $primaryKeyMap, 'ColumnCount' => count($Grid->GetSingleRecordViewColumns()), 'Row' => $Row, 'HiddenValues' => $hiddenValues));
 }
Esempio n. 4
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));
 }
Esempio n. 5
0
 function RenderGrid(Grid $Grid)
 {
     $Rows = array();
     $HeaderCaptions = array();
     $Grid->GetDataset()->Open();
     foreach ($Grid->GetExportColumns() as $Column) {
         $HeaderCaptions[] = $Column->GetCaption();
     }
     while ($Grid->GetDataset()->Next()) {
         $rowValues = $Grid->GetDataset()->GetCurrentFieldValues();
         $Row = array();
         foreach ($Grid->GetExportColumns() as $Column) {
             $Row[] = htmlspecialchars($this->RenderViewColumn($Column, $rowValues));
         }
         $Rows[] = $Row;
     }
     $this->DisplayTemplate('export/csv_grid.tpl', array('Grid' => $Grid), array('HeaderCaptions' => $HeaderCaptions, 'Rows' => $Rows));
 }
 function RenderGrid(Grid $Grid)
 {
     $Rows = array();
     $HeaderCaptions = array();
     $Grid->GetDataset()->Open();
     foreach ($Grid->GetExportColumns() as $Column) {
         $HeaderCaptions[] = $Column->GetCaption();
     }
     while ($Grid->GetDataset()->Next()) {
         $rowValues = $Grid->GetDataset()->GetCurrentFieldValues();
         $Row = array();
         foreach ($Grid->GetExportColumns() as $Column) {
             $Row[] = StringUtils::EscapeString($this->RenderViewColumn($Column, $rowValues), $Column->GetGrid()->GetPage()->GetContentEncoding());
         }
         $Rows[] = $Row;
     }
     $this->DisplayTemplate('export/csv_grid.tpl', array('Grid' => $Grid), array('HeaderCaptions' => $HeaderCaptions, 'Rows' => $Rows));
 }
Esempio n. 7
0
 function RenderGrid(Grid $Grid)
 {
     $Rows = array();
     $HeaderCaptions = array();
     $Grid->GetDataset()->Open();
     foreach ($Grid->GetExportColumns() as $Column) {
         $HeaderCaptions[] = $this->PrepareForExcel($Column->GetCaption());
     }
     while ($Grid->GetDataset()->Next()) {
         $rowValues = $Grid->GetDataset()->GetCurrentFieldValues();
         $Row = array();
         foreach ($Grid->GetExportColumns() as $Column) {
             $cell['Value'] = $this->PrepareForExcel($this->RenderViewColumn($Column, $rowValues));
             $cell['Align'] = $Column->GetAlign();
             $Row[] = $cell;
         }
         $Rows[] = $Row;
     }
     $this->DisplayTemplate('export/excel_grid.tpl', array('Grid' => $Grid), array('HeaderCaptions' => $HeaderCaptions, 'Rows' => $Rows));
 }
 public final function ProcessMessages()
 {
     $storageProperty = $this->GetStorageProperty();
     if ($this->superGlobals->IsPostValueSet($storageProperty) || $this->superGlobals->IsSessionVariableSet($this->parentGrid->GetId() . $storageProperty)) {
         if ($this->superGlobals->IsPostValueSet($storageProperty)) {
             $filterJson = $this->superGlobals->GetPostValue($storageProperty);
         } else {
             $filterJson = $this->superGlobals->GetSessionVariable($this->parentGrid->GetId() . $storageProperty);
         }
         $this->filter->LoadFromJson($filterJson);
         $this->updateEnabled();
         if (!$this->filter->IsEmpty() && $this->isEnabled()) {
             $this->parentGrid->GetDataset()->AddCustomCondition($this->generator->Generate($this->parentGrid->GetDataset(), $this->filter->GetRoot()));
         }
         $this->superGlobals->SetSessionVariable($this->parentGrid->GetId() . $storageProperty, $filterJson);
     }
     return $this->superGlobals->IsPostValueSet($storageProperty);
 }
 function RenderGrid(Grid $Grid)
 {
     $Rows = array();
     $HeaderCaptions = array();
     $Grid->GetDataset()->Open();
     foreach ($Grid->GetExportColumns() as $Column) {
         $HeaderCaptions[] = $Column->GetCaption();
     }
     while ($Grid->GetDataset()->Next()) {
         $Row = array();
         $rowValues = $Grid->GetDataset()->GetFieldValues();
         $cellStyles = $this->GetStylesForColumn($Grid, $rowValues);
         foreach ($Grid->GetExportColumns() as $column) {
             $columnName = $Grid->GetColumnName($column);
             $cell['Value'] = $this->RenderViewColumn($column, $rowValues);
             $cell['Align'] = $column->GetAlign();
             $cellStyle = new StyleBuilder();
             $cellStyle->Add('width', $column->GetFixedWidth());
             if (!$column->GetWordWrap()) {
                 $cellStyle->Add('white-space', 'nowrap');
             }
             $cellStyle->AddStyleString(ArrayUtils::GetArrayValueDef($cellStyles, $columnName));
             $cell['Style'] = $cellStyle->GetStyleString();
             $Row[] = $cell;
         }
         $Rows[] = $Row;
     }
     $this->DisplayTemplate('export/pdf_grid.tpl', array(), array('TableHeader' => $this->CreateTableHeaderData($Grid), 'Rows' => $Rows));
 }
Esempio n. 10
0
 function RenderGrid(Grid $Grid)
 {
     $Grid->GetDataset()->Open();
     $this->doRenderGrid($Grid, PageMode::PrintOneRecord, 'view/print_grid.tpl');
 }
Esempio n. 11
0
 protected function GetDataset()
 {
     return $this->grid->GetDataset();
 }
 function RenderGrid(Grid $grid)
 {
     $columnEditors = array();
     $dataset = $grid->GetDataset();
     if ($grid->GetErrorMessage() != '') {
         foreach ($grid->GetViewColumns() as $column) {
             $editor = $column->GetInsertOperationEditor();
             if (isset($editor)) {
                 $columnEditors[$column->GetName()]['Html'] = $this->Render($editor, false, true);
                 $columnEditors[$column->GetName()]['Script'] = $this->Render($editor, true, false);
             }
         }
         $this->DisplayTemplate('inline_operations/grid_edit_error_response.tpl', array('ErrorCaption' => 'ErrorsDuringInsertProcess', 'ErrorMessage' => $grid->GetErrorMessage(), 'ColumnEditors' => $columnEditors), array());
         return;
     }
     $cellClasses = array();
     $rowStyleByColumns = $grid->GetRowStylesByColumn($grid->GetDataset()->GetFieldValues(), $cellClasses);
     $columns = array();
     foreach ($grid->GetViewColumns() as $column) {
         $columnName = $dataset->IsLookupField($column->GetName()) ? $dataset->IsLookupFieldNameByDisplayFieldName($column->GetName()) : $column->GetName();
         $columns[$column->GetName()]['Value'] = $grid->RenderColumn($this, $column);
         $columns[$column->GetName()]['AfterRowControl'] = $this->Render($column->GetAfterRowControl());
         $columns[$column->GetName()]['Style'] = $rowStyleByColumns[$columnName];
     }
     $primaryKeys = array();
     if ($grid->GetAllowDeleteSelected()) {
         $primaryKeys = $grid->GetDataset()->GetPrimaryKeyValues();
     }
     $actionsRowViewData = array();
     foreach ($grid->getActions()->getOperations() as $operation) {
         $operationName = $dataset->IsLookupField($operation->GetName()) ? $dataset->IsLookupFieldNameByDisplayFieldName($operation->GetName()) : $operation->GetName();
         $actionsRowViewData[$operationName] = array('OperationName' => $operationName, 'Data' => $operation->GetValue());
     }
     $detailsViewData = $grid->GetDetailsViewData();
     $this->DisplayTemplate('inline_operations/grid_insert_commit_response.tpl', array('encoding' => $grid->GetPage()->GetContentEncoding(), 'AllowDeleteSelected' => $grid->GetAllowDeleteSelected(), 'PrimaryKeys' => $primaryKeys, 'Columns' => $columns, 'Actions' => $actionsRowViewData, 'RecordUID' => Random::GetIntRandom(), 'HasDetails' => $grid->GetHasDetails(), 'Details' => array('Items' => $detailsViewData, 'JSON' => htmlspecialchars(SystemUtils::ToJSON($detailsViewData)))), array());
 }
Esempio n. 13
0
 function RenderGrid(Grid $Grid)
 {
     /*
             $Rows = array();
             $RowPrimaryKeys = array();
             $AfterRows = array();
             $rowCssStyles = array();
             $rowColumnsChars = array();
             $rowColumnsCssStyles = array();
             $bandHeadColumnsStyles = array();
             $columnsNames = array();
     
             $exportColumns = $Grid->GetExportColumns();
             foreach($exportColumns as $Column)
             {
                 $headColumnsStyleBuilder = new StyleBuilder();
     
                 if ($Column->GetFixedWidth() != null)
                     $headColumnsStyleBuilder->Add('width', $Column->GetFixedWidth());
     
                 $headColumnsStyles[] = $headColumnsStyleBuilder->GetStyleString();
                 $columnsNames[] = $Column->GetName();
             }
     
             $Grid->GetDataset()->Open();
             $recordCount = 0;
             while($Grid->GetDataset()->Next())
             {
                 $show = true;
                 $Grid->BeforeShowRecord->Fire(array(&$show));
                 if (!$show)
                     continue;
     
                 $Row = array();
                 $AfterRowControls = '';
     
                 $rowValues = $Grid->GetDataset()->GetFieldValues();
                 $rowCssStyle = '';
                 $cellCssStyles = array();
     
                 $Grid->OnCustomDrawCell->Fire(array($rowValues, &$cellCssStyles, &$rowCssStyle));
                 $cellCssStyles_Simple = $this->GetStylesForColumn($Grid, $rowValues);
                 $cellCssStyles = array_merge($cellCssStyles_Simple, $cellCssStyles);
     
                 $currentRowColumnsCssStyles = array();
     
                 $columnsChars = array();
                 for($i = 0; $i < count($bands); $i++)
                 {
                     $band = $bands[$i];
     
                     foreach($band->GetColumns() as $Column)
                     {
                         $columnName = $Grid->GetDataset()->IsLookupField($Column->GetName()) ?
                             $Grid->GetDataset()->IsLookupFieldNameByDisplayFieldName($Column->GetName()) :
                             $Column->GetName();
     
     
                         if (array_key_exists($columnName, $cellCssStyles))
                         {
                             $styleBuilder = new StyleBuilder();
                             $styleBuilder->AddStyleString($rowCssStyle);
                             $styleBuilder->AddStyleString($cellCssStyles[$columnName]);
                             $currentRowColumnsCssStyles[] = $styleBuilder->GetStyleString();
                         }
                         else
                             $currentRowColumnsCssStyles[] = $rowCssStyle;
     
                         if ($Column->GetFixedWidth() != null)
                             $currentRowColumnsCssStyles[count($currentRowColumnsCssStyles) - 1] .=  sprintf('width: %s;', $Column->GetFixedWidth());
                         if (!$Column->GetWordWrap())
                             $currentRowColumnsCssStyles[count($currentRowColumnsCssStyles) - 1] .=  sprintf('white-space: nowrap;', $Column->GetFixedWidth());
     
     
                         $columnRenderResult = '';
                         $customRenderColumnHandled = false;
                         $Grid->OnCustomRenderColumn->Fire(array($columnName, $Column->GetData(), $rowValues, &$columnRenderResult, &$customRenderColumnHandled));
                         $columnRenderResult = $customRenderColumnHandled ? $Grid->GetPage()->RenderText($columnRenderResult) : $this->Render($Column);
                         $Row[] = $columnRenderResult;
                         $columnsChars[] = ($Column->IsDataColumn() ? 'data' : 'misc');
     
                         $afterRow = $Column->GetAfterRowControl();
                         if (isset($afterRow))
                             $AfterRowControls .= $this->Render($afterRow);
                     }
     
                     if ($i < (count($bands) - 1))
                         $currentRowColumnsCssStyles[count($currentRowColumnsCssStyles) - 1] .= ($Grid->GetPage()->GetPageDirection() == 'rtl' ? 'border-left: ' : 'border-right: ' ). 'solid 2px' . ' #000000;';
                 }
                 $recordCount++;
                 if ($Grid->GetAllowDeleteSelected())
                     $RowPrimaryKeys[] = $Grid->GetDataset()->GetPrimaryKeyValues();
                 $Rows[] = $Row;
                 $AfterRows[] = $AfterRowControls;
                 $rowCssStyles[] = $rowCssStyle;
                 $rowColumnsCssStyles[] = $currentRowColumnsCssStyles;
                 $rowColumnsChars[] = $columnsChars;
             }
     */
     $Rows = array();
     $HeaderCaptions = array();
     $Grid->GetDataset()->Open();
     foreach ($Grid->GetExportColumns() as $Column) {
         $HeaderCaptions[] = $Column->GetCaption();
     }
     while ($Grid->GetDataset()->Next()) {
         $Row = array();
         $rowValues = $Grid->GetDataset()->GetFieldValues();
         $cellStyles = $this->GetStylesForColumn($Grid, $rowValues);
         foreach ($Grid->GetExportColumns() as $column) {
             $columnName = $Grid->GetDataset()->IsLookupField($column->GetName()) ? $Grid->GetDataset()->IsLookupFieldNameByDisplayFieldName($column->GetName()) : $column->GetName();
             $cell['Value'] = $this->RenderViewColumn($column, $rowValues);
             $cell['Align'] = $column->GetAlign();
             $cellStyle = new StyleBuilder();
             $cellStyle->Add('width', $column->GetFixedWidth());
             if (!$column->GetWordWrap()) {
                 $cellStyle->Add('white-space', 'nowrap');
             }
             $cellStyle->AddStyleString(ArrayUtils::GetArrayValueDef($cellStyles, $columnName));
             $cell['Style'] = $cellStyle->GetStyleString();
             $Row[] = $cell;
         }
         $Rows[] = $Row;
     }
     $this->DisplayTemplate('export/pdf_grid.tpl', array(), array('TableHeader' => $this->CreateTableHeaderData($Grid), 'Rows' => $Rows));
 }
 function RenderGrid(Grid $grid)
 {
     $columnEditors = array();
     $dataset = $grid->GetDataset();
     if ($grid->GetErrorMessage() != '') {
         foreach ($grid->GetViewColumns() as $column) {
             $editor = $column->GetInsertOperationEditor();
             if (isset($editor)) {
                 $columnEditors[$column->GetName()]['Html'] = $this->Render($editor, false, true);
                 $columnEditors[$column->GetName()]['Script'] = $this->Render($editor, true, false);
             }
         }
         $this->DisplayTemplate('inline_operations/grid_edit_error_response.tpl', array('ErrorMessage' => $grid->GetErrorMessage(), 'ColumnEditors' => $columnEditors), array());
         return;
     }
     $rowStyleByColumns = $grid->GetRowStylesByColumn($grid->GetDataset()->GetFieldValues());
     $columns = array();
     foreach ($grid->GetViewColumns() as $column) {
         $columnName = $dataset->IsLookupField($column->GetName()) ? $dataset->IsLookupFieldNameByDisplayFieldName($column->GetName()) : $column->GetName();
         $columns[$column->GetName()]['Value'] = $grid->RenderColumn($this, $column);
         $columns[$column->GetName()]['AfterRowControl'] = $this->Render($column->GetAfterRowControl());
         $columns[$column->GetName()]['Style'] = $rowStyleByColumns[$columnName];
     }
     $primaryKeys = array();
     if ($grid->GetAllowDeleteSelected()) {
         $primaryKeys = $grid->GetDataset()->GetPrimaryKeyValues();
     }
     $this->DisplayTemplate('inline_operations/grid_insert_commit_response.tpl', array('AllowDeleteSelected' => $grid->GetAllowDeleteSelected(), 'PrimaryKeys' => $primaryKeys, 'Columns' => $columns, 'RecordUID' => Random::GetIntRandom()), array());
 }