Ejemplo n.º 1
0
 /**
  * Load the datagrids
  */
 private function loadDataGrids()
 {
     /*
      * Frontend datagrid
      */
     $nonExistingFrontendLocale = BackendLocaleModel::getNonExistingFrontendLocale(BL::getWorkingLanguage());
     $this->dgFrontend = new BackendDataGridArray($nonExistingFrontendLocale);
     // overrule default URL
     $this->dgFrontend->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]'), false));
     // sorting columns
     $this->dgFrontend->setSortingColumns(array('language', 'application', 'module', 'type', 'name'), 'name');
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Add')) {
         // set column URLs
         $this->dgFrontend->setColumnURL('name', BackendModel::createURLForAction('Add') . '&language=[language]&application=[application]&module=[module]&type=[type]&name=[name]');
     }
     // set column functions
     $this->dgFrontend->setColumnFunction(array(__CLASS__, 'formatFilesList'), '[used_in]', 'used_in', true);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('SaveTranslation')) {
         // add columns
         $this->dgFrontend->addColumn('translation', null, null, null, BL::lbl('Add'));
         // add a class for the inline edit
         $this->dgFrontend->setColumnAttributes('translation', array('class' => 'translationValue'));
         // add attributes, so the inline editing has all the needed data
         $this->dgFrontend->setColumnAttributes('translation', array('data-id' => '{language: \'[language]\', application: \'[application]\', module: \'[module]\', name: \'[name]\', type: \'[type]\'}'));
         $this->dgFrontend->setColumnAttributes('translation', array('style' => 'width: 150px'));
     }
     // disable paging
     $this->dgFrontend->setPaging(false);
     /*
      * Backend datagrid
      */
     $getNonExistingBackendLocale = BackendLocaleModel::getNonExistingBackendLocale(BL::getWorkingLanguage());
     $this->dgBackend = new BackendDataGridArray($getNonExistingBackendLocale);
     // overrule default URL
     $this->dgBackend->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]'), false));
     // sorting columns
     $this->dgBackend->setSortingColumns(array('language', 'application', 'module', 'type', 'name'), 'name');
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Add')) {
         // set column URLs
         $this->dgBackend->setColumnURL('name', BackendModel::createURLForAction('Add') . '&language=[language]&application=[application]&module=[module]&type=[type]&name=[name]');
     }
     // set column functions
     $this->dgBackend->setColumnFunction(array(__CLASS__, 'formatFilesList'), '[used_in]', 'used_in', true);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('SaveTranslation')) {
         // add columns
         $this->dgBackend->addColumn('translation', null, null, null, BL::lbl('Add'));
         // add a class for the inline edit
         $this->dgBackend->setColumnAttributes('translation', array('class' => 'translationValue'));
         // add attributes, so the inline editing has all the needed data
         $this->dgBackend->setColumnAttributes('translation', array('data-id' => '{language: \'[language]\', application: \'[application]\', module: \'[module]\', name: \'[name]\', type: \'[type]\'}'));
         $this->dgBackend->setColumnAttributes('translation', array('style' => 'width: 150px'));
     }
     // disable paging
     $this->dgBackend->setPaging(false);
 }
Ejemplo n.º 2
0
 /**
  * Load the datagrid
  */
 private function loadDataGrid()
 {
     // init var
     $items = array();
     // get modules
     $modules = BackendModel::getModules();
     // loop modules
     foreach ($modules as $module) {
         // build class name
         $className = 'Backend\\Modules\\' . $module . '\\Engine\\Model';
         if ($module == 'Core') {
             $className = 'Backend\\Core\\Engine\\Model';
         }
         // check if the getByTag-method is available
         if (is_callable(array($className, 'getByTag'))) {
             // make the call and get the item
             $moduleItems = (array) call_user_func(array($className, 'getByTag'), $this->id);
             // loop items
             foreach ($moduleItems as $row) {
                 // check if needed fields are available
                 if (isset($row['url'], $row['name'], $row['module'])) {
                     // add
                     $items[] = array('module' => \SpoonFilter::ucfirst(BL::lbl(\SpoonFilter::toCamelCase($row['module']))), 'name' => $row['name'], 'url' => $row['url']);
                 }
             }
         }
     }
     // create datagrid
     $this->dgUsage = new BackendDataGridArray($items);
     $this->dgUsage->setPaging(false);
     $this->dgUsage->setColumnsHidden(array('url'));
     $this->dgUsage->setHeaderLabels(array('name' => \SpoonFilter::ucfirst(BL::lbl('Title')), 'url' => ''));
     $this->dgUsage->setColumnURL('name', '[url]', \SpoonFilter::ucfirst(BL::lbl('Edit')));
     $this->dgUsage->addColumn('edit', null, \SpoonFilter::ucfirst(BL::lbl('Edit')), '[url]', BL::lbl('Edit'));
 }
Ejemplo n.º 3
0
 /**
  * Load the data grid for installed modules.
  */
 private function loadDataGridInstalled()
 {
     // create datagrid
     $this->dataGridInstalledModules = new BackendDataGridArray($this->installedModules);
     $this->dataGridInstalledModules->setSortingColumns(array('name'));
     $this->dataGridInstalledModules->setColumnsHidden(array('installed', 'raw_name', 'cronjobs_active'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('DetailModule')) {
         $this->dataGridInstalledModules->setColumnURL('name', BackendModel::createURLForAction('DetailModule') . '&module=[raw_name]');
         $this->dataGridInstalledModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('DetailModule') . '&module=[raw_name]', BL::lbl('Details'));
     }
     // add the greyed out option to modules that have warnings
     $this->dataGridInstalledModules->addColumn('hidden');
     $this->dataGridInstalledModules->setColumnFunction(array(new BackendExtensionsModel(), 'hasModuleWarnings'), array('[raw_name]'), array('hidden'));
 }
Ejemplo n.º 4
0
 /**
  * Load the datagrid for unsubscriptions
  */
 private function loadUnsubscriptions()
 {
     // get results
     $results = BackendMailmotorModel::getRecentUnsubscriptions(self::PAGING_LIMIT);
     // there are some results
     if (!empty($results)) {
         $dataGrid = new BackendDataGridArray($results);
         $dataGrid->setPaging(false);
         $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), array('[unsubscribed_on]'), 'unsubscribed_on', true);
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('EditAddress')) {
             $dataGrid->setColumnURL('email', BackendModel::createURLForAction('EditAddress', 'Mailmotor') . '&email=[email]');
         }
         // parse the datagrid
         $this->tpl->assign('dgMailmotorUnsubscriptions', $dataGrid->getContent());
     }
 }