Inheritance: extends DataGrid
Esempio n. 1
0
 /**
  * Parse all datagrids
  */
 protected function parse()
 {
     parent::parse();
     // parse the datagrid for the drafts
     $this->tpl->assign('dgDrafts', (string) $this->dgDrafts->getContent());
     // parse the datagrid for all blogposts
     $this->tpl->assign('dgPosts', (string) $this->dgPosts->getContent());
     // parse the datagrid for the most recent blogposts
     $this->tpl->assign('dgRecent', is_object($this->dgRecent) ? $this->dgRecent->getContent() : false);
     // get categories
     $categories = BackendBlogModel::getCategories(true);
     $hasMultipleCategories = count($categories) > 1;
     $this->tpl->assign('hasMultipleCategories', $hasMultipleCategories);
     // multiple categories?
     if ($hasMultipleCategories) {
         // create form
         $frm = new BackendForm('filter', null, 'get', false);
         // create element
         $frm->addDropdown('category', $categories, $this->categoryId);
         $frm->getField('category')->setDefaultElement('');
         // parse the form
         $frm->parse($this->tpl);
     }
     // parse category
     if (!empty($this->category)) {
         $this->tpl->assign('filterCategory', $this->category);
     }
 }
 /**
  * @param ContentBlock $contentBlock
  * @param Locale $locale
  */
 public function __construct(ContentBlock $contentBlock, Locale $locale)
 {
     parent::__construct('SELECT i.id, i.revision_id, i.title, UNIX_TIMESTAMP(i.edited_on) AS edited_on, i.user_id
          FROM content_blocks AS i
          WHERE i.status = :archived AND i.id = :id AND i.language = :language
          ORDER BY i.edited_on DESC', ['archived' => ContentBlockStatus::archived(), 'language' => $locale, 'id' => $contentBlock->getId()]);
 }
Esempio n. 3
0
 /**
  * Parse the datagrid and the reports
  */
 protected function parse()
 {
     parent::parse();
     // assign datagrid
     $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false);
     // assign the selected theme, so we can propagate it to the add/edit actions.
     $this->tpl->assign('selectedTheme', urlencode($this->selectedTheme));
 }
Esempio n. 4
0
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     $this->tpl->assign('dataGridUsers', $this->dataGridUsers->getNumResults() != 0 ? $this->dataGridUsers->getContent() : false);
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('groupName', $this->record['name']);
     // only allow deletion of empty groups
     $this->tpl->assign('showGroupsDelete', $this->dataGridUsers->getNumResults() == 0 && BackendAuthentication::isAllowedAction('Delete'));
 }
Esempio n. 5
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('editOrder');
     // create elements
     $this->frm->addText('email', $this->record['email']);
     $this->frm->addText('fname', $this->record['fname']);
     $this->frm->addText('lname', $this->record['lname']);
     $this->frm->addText('address', $this->record['address']);
     $this->frm->addText('hnumber', $this->record['hnumber']);
     $this->frm->addText('postal', $this->record['postal']);
     $this->frm->addText('hometown', $this->record['hometown']);
     // assign URL
     //$this->tpl->assign('itemURL', BackendModel::getURLForBlock($this->getModule(), 'detail') . '/' . $this->record['product_url'] . '#order-' . $this->record['product_id']);
     $this->tpl->assign('products', $this->record);
     $this->tpl->assign('dgProducts', $this->dgProducts->getNumResults() != 0 ? $this->dgProducts->getContent() : false);
     $this->tpl->assign('orderPerson', $this->record['fname']);
 }
Esempio n. 6
0
 /**
  * Parse & display the page.
  */
 protected function parse()
 {
     parent::parse();
     // parse data grid
     $this->tpl->assign('dgProfiles', $this->dgProfiles->getNumResults() != 0 ? $this->dgProfiles->getContent() : false);
     // parse paging & sorting
     $this->tpl->assign('offset', (int) $this->dgProfiles->getOffset());
     $this->tpl->assign('order', (string) $this->dgProfiles->getOrder());
     $this->tpl->assign('sort', (string) $this->dgProfiles->getSort());
     // parse filter
     $this->tpl->assign($this->filter);
 }
Esempio n. 7
0
 /**
  * Parse & display the page
  */
 protected function parse()
 {
     parent::parse();
     // published datagrid and num results
     $this->tpl->assign('dgPublished', (string) $this->dgPublished->getContent());
     $this->tpl->assign('numPublished', $this->dgPublished->getNumResults());
     // moderation datagrid and num results
     $this->tpl->assign('dgModeration', (string) $this->dgModeration->getContent());
     $this->tpl->assign('numModeration', $this->dgModeration->getNumResults());
     // spam datagrid and num results
     $this->tpl->assign('dgSpam', (string) $this->dgSpam->getContent());
     $this->tpl->assign('numSpam', $this->dgSpam->getNumResults());
 }
Esempio n. 8
0
 /**
  * Parse all datagrids
  */
 protected function parse()
 {
     parent::parse();
     // a campaign was found, so parse the campaign record
     if (!empty($this->campaign)) {
         $this->tpl->assign($this->campaign);
     }
     // parse the datagrid for all unsent mailings
     $this->tpl->assign('dgUnsentMailings', (string) $this->dgUnsentMailings->getContent());
     // parse the datagrid for all sent mailings
     $this->tpl->assign('dgSentMailings', (string) $this->dgSentMailings->getContent());
     // parse the datagrid for all queued mailings
     $this->tpl->assign('dgQueuedMailings', (string) $this->dgQueuedMailings->getContent());
 }
Esempio n. 9
0
 /**
  * Parse the datagrid and the reports
  */
 protected function parse()
 {
     parent::parse();
     // parse dgRecentlyEdited
     $this->tpl->assign('dgRecentlyEdited', $this->dgRecentlyEdited->getNumResults() != 0 ? $this->dgRecentlyEdited->getContent() : false);
     $this->tpl->assign('dgDrafts', $this->dgDrafts->getNumResults() != 0 ? $this->dgDrafts->getContent() : false);
     // parse the tree
     $this->tpl->assign('tree', BackendPagesModel::getTreeHTML());
     // open the tree on a specific page
     if ($this->getParameter('id', 'int') !== null) {
         $this->tpl->assign('openedPageId', $this->getParameter('id', 'int'));
     } else {
         $this->tpl->assign('openedPageId', 1);
     }
 }
Esempio n. 10
0
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // assign the active record and additional variables
     $this->tpl->assign('profile', $this->profile);
     // parse data grids
     $this->tpl->assign('dgGroups', $this->dgGroups->getNumResults() != 0 ? $this->dgGroups->getContent() : false);
     // show delete or undelete button?
     if ($this->profile['status'] === 'deleted') {
         $this->tpl->assign('deleted', true);
     }
     // show block or unblock button?
     if ($this->profile['status'] === 'blocked') {
         $this->tpl->assign('blocked', true);
     }
 }
Esempio n. 11
0
 /**
  * Parse
  */
 protected function parse()
 {
     parent::parse();
     // set
     $this->record['url'] = $this->meta->getURL();
     if ($this->id == 1) {
         $this->record['url'] = '';
     }
     // parse some variables
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('isGod', $this->isGod);
     $this->tpl->assign('templates', $this->templates);
     $this->tpl->assign('positions', $this->positions);
     $this->tpl->assign('extrasData', json_encode(BackendExtensionsModel::getExtrasData()));
     $this->tpl->assign('extrasById', json_encode(BackendExtensionsModel::getExtras()));
     $this->tpl->assign('prefixURL', rtrim(BackendPagesModel::getFullURL($this->record['parent_id']), '/'));
     $this->tpl->assign('formErrors', (string) $this->frm->getErrors());
     $this->tpl->assign('showTags', $this->showTags());
     // init var
     $showDelete = true;
     // has children?
     if (BackendPagesModel::getFirstChildId($this->record['id']) !== false) {
         $showDelete = false;
     }
     if (!$this->record['delete_allowed']) {
         $showDelete = false;
     }
     // allowed?
     if (!BackendAuthentication::isAllowedAction('Delete', $this->getModule())) {
         $showDelete = false;
     }
     // show delete button
     $this->tpl->assign('allowPagesDelete', $showDelete);
     // assign template
     $this->tpl->assignArray($this->templates[$this->record['template_id']], 'template');
     // parse datagrids
     $this->tpl->assign('revisions', $this->dgRevisions->getNumResults() != 0 ? $this->dgRevisions->getContent() : false);
     $this->tpl->assign('drafts', $this->dgDrafts->getNumResults() != 0 ? $this->dgDrafts->getContent() : false);
     // parse the tree
     $this->tpl->assign('tree', BackendPagesModel::getTreeHTML());
     // assign if profiles module is installed
     $this->tpl->assign('showAuthenticationTab', BackendModel::isModuleInstalled('Profiles'));
 }
Esempio n. 12
0
 /**
  * Loads the dataGrids
  */
 private function loadDatagrids()
 {
     // load all categories
     $categories = BackendFaqModel::getCategories(true);
     // loop categories and create a dataGrid for each one
     foreach ($categories as $categoryId => $categoryTitle) {
         $dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
         $dataGrid->enableSequenceByDragAndDrop();
         $dataGrid->setColumnsHidden(array('category_id', 'sequence'));
         $dataGrid->setColumnAttributes('question', array('class' => 'title'));
         $dataGrid->setRowAttributes(array('id' => '[id]'));
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('Edit')) {
             $dataGrid->setColumnURL('question', BackendModel::createURLForAction('Edit') . '&id=[id]');
             $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]', BL::lbl('Edit'));
         }
         // add dataGrid to list
         $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
     }
     // set empty datagrid
     $this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => '')));
     $this->emptyDatagrid->setAttributes(array('class' => 'table table-hover table-striped fork-data-grid jsDataGrid sequenceByDragAndDrop emptyGrid'));
     $this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
 }
Esempio n. 13
0
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // get url
     $url = BackendModel::getURLForBlock($this->URL->getModule(), 'detail');
     $url404 = BackendModel::getURL(404);
     // parse additional variables
     if ($url404 != $url) {
         $this->tpl->assign('detailURL', SITE_URL . $url);
     }
     // fetch proper slug
     $this->record['url'] = $this->meta->getURL();
     // assign the active record and additional variables
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('status', BL::lbl(\SpoonFilter::ucfirst($this->record['status'])));
     // assign revisions-datagrid
     $this->tpl->assign('revisions', $this->dgRevisions->getNumResults() != 0 ? $this->dgRevisions->getContent() : false);
     $this->tpl->assign('drafts', $this->dgDrafts->getNumResults() != 0 ? $this->dgDrafts->getContent() : false);
     $this->tpl->assign('imageIsAllowed', $this->imageIsAllowed);
     // assign category
     if ($this->categoryId !== null) {
         $this->tpl->assign('categoryId', $this->categoryId);
     }
 }
 /**
  * Load the datagrids
  *
  * @return  void
  */
 private function loadDataGrids()
 {
     // load all categories that are in use
     $categories = BackendSlideshowModel::getActiveCategories(true);
     // run over categories and create datagrid for each one
     foreach ($categories as $categoryId => $categoryTitle) {
         // create datagrid
         $dataGrid = new BackendDataGridDB(BackendSlideshowModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
         // disable paging
         $dataGrid->setPaging(false);
         // set colum URLs
         $dataGrid->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&id=[id]');
         // set column functions
         $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[publish_on]'), 'publish_on', true);
         $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getUser'), array('[user_id]'), 'user_id', true);
         // set headers
         $dataGrid->setHeaderLabels(array('user_id' => \SpoonFilter::ucfirst(BL::lbl('Author')), 'publish_on' => \SpoonFilter::ucfirst(BL::lbl('PublishedOn'))));
         // enable drag and drop
         $dataGrid->enableSequenceByDragAndDrop();
         // our JS needs to know an id, so we can send the new order
         $dataGrid->setRowAttributes(array('id' => '[id]'));
         $dataGrid->setAttributes(array('data-action' => "GallerySequence"));
         // create a column #images
         $dataGrid->addColumn('images', ucfirst(BL::lbl('Images')));
         $dataGrid->setColumnFunction(array('Backend\\Modules\\Slideshow\\Engine\\Model', 'getImagesByGallery'), array('[id]', true), 'images', true);
         // hide columns
         $dataGrid->setColumnsHidden(array('category_id', 'sequence', 'filename'));
         // add edit column
         $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]', BL::lbl('Edit'));
         // set column order
         $dataGrid->setColumnsSequence('dragAndDropHandle', 'title', 'images', 'user_id', 'publish_on', 'edit');
         // add dataGrid to list
         $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
     }
 }
Esempio n. 15
0
 /**
  * @param Locale $locale
  */
 public function __construct(Locale $locale)
 {
     parent::__construct('SELECT i.id, i.title, i.hidden
          FROM content_blocks AS i
          WHERE i.status = :active AND i.language = :language', ['active' => ContentBlockStatus::active(), 'language' => $locale]);
 }
Esempio n. 16
0
 /**
  * Parse & display the page
  */
 protected function parse()
 {
     $this->tpl->assign('dataGrid', (string) $this->dataGrid->getContent());
 }