Ejemplo n.º 1
0
 /**
  * Load the datagrid
  */
 private function loadDataGrid()
 {
     // fetch query and parameters
     list($query, $parameters) = $this->buildQuery();
     // create datagrid
     $this->dgProfiles = new BackendDataGridDB($query, $parameters);
     // overrule default URL
     $this->dgProfiles->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'email' => $this->filter['email'], 'status' => $this->filter['status'], 'group' => $this->filter['group']), false));
     // sorting columns
     $this->dgProfiles->setSortingColumns(array('email', 'display_name', 'status', 'registered_on'), 'email');
     // set column function
     $this->dgProfiles->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[registered_on]'), 'registered_on', true);
     // add the mass action controls
     $this->dgProfiles->setMassActionCheckboxes('check', '[id]');
     $ddmMassAction = new \SpoonFormDropdown('action', array('addToGroup' => BL::getLabel('AddToGroup'), 'delete' => BL::getLabel('Delete')), 'addToGroup', false, 'form-control', 'form-control danger');
     $ddmMassAction->setAttribute('id', 'massAction');
     $ddmMassAction->setOptionAttributes('addToGroup', array('data-target' => '#confirmAddToGroup'));
     $ddmMassAction->setOptionAttributes('delete', array('data-target' => '#confirmDelete'));
     $this->dgProfiles->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         // set column URLs
         $this->dgProfiles->setColumnURL('email', BackendModel::createURLForAction('Edit') . '&id=[id]');
         // add columns
         $this->dgProfiles->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('Edit', null, null, null) . '&id=[id]', BL::getLabel('Edit'));
     }
 }
Ejemplo n.º 2
0
 /**
  * Loads the datagrid with all the drafts
  */
 private function loadDataGridDrafts()
 {
     // filter on category?
     if ($this->categoryId != null) {
         // create datagrid
         $this->dgDrafts = new BackendDataGridDB(BackendBlogModel::QRY_DATAGRID_BROWSE_DRAFTS_FOR_CATEGORY, array($this->categoryId, 'draft', BackendAuthentication::getUser()->getUserId(), BL::getWorkingLanguage()));
         // set the URL
         $this->dgDrafts->setURL('&category=' . $this->categoryId, true);
     } else {
         // create datagrid
         $this->dgDrafts = new BackendDataGridDB(BackendBlogModel::QRY_DATAGRID_BROWSE_DRAFTS, array('draft', BackendAuthentication::getUser()->getUserId(), BL::getWorkingLanguage()));
     }
     // set headers
     $this->dgDrafts->setHeaderLabels(array('user_id' => \SpoonFilter::ucfirst(BL::lbl('Author'))));
     // hide columns
     $this->dgDrafts->setColumnsHidden(array('revision_id'));
     // sorting columns
     $this->dgDrafts->setSortingColumns(array('edited_on', 'title', 'user_id', 'comments'), 'edited_on');
     $this->dgDrafts->setSortParameter('desc');
     // set column functions
     $this->dgDrafts->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[edited_on]'), 'edited_on', true);
     $this->dgDrafts->setColumnFunction(array(new BackendDataGridFunctions(), 'getUser'), array('[user_id]'), 'user_id', true);
     // our JS needs to know an id, so we can highlight it
     $this->dgDrafts->setRowAttributes(array('id' => 'row-[revision_id]'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         // set column URLs
         $this->dgDrafts->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&id=[id]&draft=[revision_id]&category=' . $this->categoryId);
         // add edit column
         $this->dgDrafts->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]&draft=[revision_id]&category=' . $this->categoryId, BL::lbl('Edit'));
     }
 }
Ejemplo n.º 3
0
 /**
  * Load the datagrid.
  */
 private function loadDataGrid()
 {
     // fetch query and parameters
     list($query, $parameters) = $this->buildQuery();
     // create datagrid
     $this->dgGroups = new BackendDataGridDB($query, $parameters);
     // overrule default URL
     $this->dgGroups->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'name' => $this->filter['name']), false));
     // sorting columns
     $this->dgGroups->setSortingColumns(array('name', 'members_count'), 'name');
     // set the amount of profiles
     $this->dgGroups->setColumnFunction(array(__CLASS__, 'parseNumProfiles'), array('[id]', '[members_count]'), 'members_count');
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Index')) {
         $this->dgGroups->setColumnURL('members_count', BackendModel::createURLForAction('Index') . '&group=[id]');
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditGroup')) {
         $this->dgGroups->setColumnURL('name', BackendModel::createURLForAction('EditGroup') . '&id=[id]');
         $this->dgGroups->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('EditGroup') . '&id=[id]');
     }
 }