예제 #1
0
 /**
  * Load the data grid which contains the events.
  */
 private function loadDataGridTemplates()
 {
     // no hooks so dont bother
     if (!isset($this->information['templates'])) {
         return;
     }
     // build data for display in datagrid
     $templates = array();
     foreach ($this->information['templates'] as $template) {
         // set template name & path
         $record['name'] = $template['label'];
         $record['path'] = $template['path'];
         // set positions
         $record['positions'] = array();
         foreach ($template['positions'] as $position) {
             $record['positions'][] = $position['name'];
         }
         $record['positions'] = implode(', ', $record['positions']);
         // add template to list
         $templates[] = $record;
     }
     // create data grid
     $this->dataGridTemplates = new BackendDataGridArray($templates);
     // add label for path
     $this->dataGridTemplates->setHeaderLabels(array('path' => BL::msg('PathToTemplate')));
     // no paging
     $this->dataGridTemplates->setPaging(false);
 }
예제 #2
0
 /**
  * Load the datagrid with drafts
  *
  * @return	void
  */
 private function loadDrafts()
 {
     // create datagrid
     $this->dgDrafts = new BackendDataGridDB(BackendPagesModel::QRY_DATAGRID_BROWSE_SPECIFIC_DRAFTS, array($this->record['id'], 'draft', BL::getWorkingLanguage()));
     // hide columns
     $this->dgDrafts->setColumnsHidden(array('id', 'revision_id'));
     // disable paging
     $this->dgDrafts->setPaging(false);
     // set headers
     $this->dgDrafts->setHeaderLabels(array('user_id' => ucfirst(BL::lbl('By')), 'edited_on' => ucfirst(BL::lbl('LastEditedOn'))));
     // set colum URLs
     $this->dgDrafts->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]&draft=[revision_id]');
     // set column-functions
     $this->dgDrafts->setColumnFunction(array('BackendDataGridFunctions', 'getUser'), array('[user_id]'), 'user_id');
     $this->dgDrafts->setColumnFunction(array('BackendDataGridFunctions', 'getTimeAgo'), array('[edited_on]'), 'edited_on');
     // add use column
     $this->dgDrafts->addColumn('use_draft', null, ucfirst(BL::lbl('UseThisDraft')), BackendModel::createURLForAction('edit') . '&id=[id]&draft=[revision_id]', BL::lbl('UseThisDraft'));
     // our JS needs to know an id, so we can highlight it
     $this->dgDrafts->setRowAttributes(array('id' => 'row-[revision_id]'));
 }