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 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'));
 }