Exemple #1
0
function ConvertTextToEncoding($text, $sourceEncoding, $targetEncoding)
{
    return StringUtils::ConvertTextToEncoding($text, $sourceEncoding, $targetEncoding);
}
 public function GetViewData(Renderer $renderer)
 {
     $bandsViewData = array();
     foreach ($this->GetViewBands() as $band) {
         $bandsViewData[] = $band->GetViewData();
     }
     $actionsViewData = $this->getActions()->getViewData();
     $rows = array();
     $emptyGridMessage = $this->GetPage()->GetLocalizerCaptions()->GetMessageString('NoDataToDisplay');
     if ($this->RequestFilterFromUser()) {
         $emptyGridMessage = $this->GetPage()->GetLocalizerCaptions()->GetMessageString('CreateFilterConditionFirst');
     } else {
         $rows = $this->GetRowsViewData($renderer);
     }
     $sortableColumns = array();
     $sortableColumnsForJSON = array();
     foreach ($bandsViewData as $band) {
         foreach ($band['Columns'] as $column) {
             if ($column['Sortable']) {
                 $sortableColumn = array('name' => $column['Name'], 'index' => $column['SortIndex'], 'caption' => $column['Caption']);
                 $sortableColumns[$column['Name']] = $sortableColumn;
                 $sortableColumnsForJSON[$column['Name']] = array_merge($sortableColumn, array('caption' => StringUtils::ConvertTextToEncoding($column['Caption'], $this->getPage()->getContentEncoding(), 'UTF-8')));
             }
         }
     }
     return array('SortableColumns' => $sortableColumns, 'SortableColumnsJSON' => json_encode($sortableColumnsForJSON), 'Id' => $this->GetId(), 'MaxWidth' => $this->GetWidth(), 'Classes' => $this->GetGridClasses(), 'Attributes' => $this->GetAdditionalAttributes(), 'HiddenValuesJson' => $this->GetHiddenValuesJson(), 'EmptyGridMessage' => $emptyGridMessage, 'FilterBuilder' => $this->GetShowFilterBuilder() ? $this->GetFilterBuilder()->GetViewData() : null, 'QuickFilter' => $this->GetQuickFilter()->GetViewData(), 'AllowQuickFilter' => $this->GetPage()->GetSimpleSearchAvailable() && $this->UseFilter, 'ActionsPanelAvailable' => $this->GetPage()->GetSimpleSearchAvailable() && $this->UseFilter || $this->GetShowAddButton() || $this->GetShowInlineAddButton() || $this->GetAllowDeleteSelected() || $this->GetShowUpdateLink(), 'Links' => array('ModalInsertDialog' => $this->GetOpenInsertModalDialogLink(), 'InlineEditRequest' => $this->GetInlineEditRequestsAddress(), 'SimpleAddNewRow' => $this->GetAddRecordLink(), 'Refresh' => $this->GetUpdateLink()), 'ActionsPanel' => array('InlineAdd' => $this->GetShowInlineAddButton(), 'AddNewButton' => $this->GetShowAddButton() ? $this->GetUseModalInserting() ? 'modal' : 'simple' : null, 'RefreshButton' => $this->GetShowUpdateLink(), 'DeleteSelectedButton' => $this->GetAllowDeleteSelected()), 'ColumnCount' => count($this->GetViewColumns()) + ($this->GetAllowDeleteSelected() ? 1 : 0) + ($this->GetShowLineNumbers() ? 1 : 0) + ($this->GetHasDetails() ? 1 : 0) + ($actionsViewData ? 1 : 0), 'Bands' => $bandsViewData, 'Actions' => $actionsViewData, 'HasDetails' => $this->GetHasDetails(), 'UseInlineEdit' => $this->GetEnabledInlineEditing(), 'HighlightRowAtHover' => $this->GetHighlightRowAtHover(), 'AllowDeleteSelected' => $this->GetAllowDeleteSelected(), 'ShowLineNumbers' => $this->GetShowLineNumbers(), 'Rows' => $rows, 'Totals' => $this->GetTotalsViewData(), 'GridMessage' => $this->GetGridMessage() == '' ? null : $this->GetGridMessage(), 'ErrorMessage' => $this->GetErrorMessage() == '' ? null : $this->GetErrorMessage(), 'DataSortPriority' => $this->getSortedColumns(), 'EnableRunTimeCustomization' => $this->getEnableRunTimeCustomization(), 'ViewModeList' => ViewMode::getList(), 'ViewMode' => $this->GetViewMode(), 'CardCountInRow' => $this->GetCardCountInRow(), 'CardClasses' => $this->getCardClasses());
 }
Exemple #3
0
 private function GetCaptionByName($name)
 {
     $result = eval('global $c' . $name . '; return $c' . $name . ';');
     return StringUtils::ConvertTextToEncoding($result, 'UTF-8', $this->pageEncoding);
 }
 /**
  * @param string $json
  * @return void
  */
 public function LoadFromJson($json)
 {
     $this->root->LoadFromData(SystemUtils::FromJSON(StringUtils::ConvertTextToEncoding($json, $this->contentEncoding, 'UTF-8')), $this->contentEncoding);
 }