Exemplo 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);
 }
Exemplo n.º 2
0
 /**
  * Build items array and group all items by application, module, type and name.
  */
 private function setItems()
 {
     $this->locale = array();
     // get items
     $frontend = BackendLocaleModel::getNonExistingFrontendLocale($this->filter['language']);
     // group by application, module, type and name
     foreach ($frontend as $item) {
         $item['value'] = null;
         $this->locale[$item['application']][$item['module']][$item['type']][$item['name']][] = $item;
     }
     // no need to keep this around
     unset($frontend);
     // get items
     $backend = BackendLocaleModel::getNonExistingBackendLocale($this->filter['language']);
     // group by application, module, type and name
     foreach ($backend as $item) {
         $item['value'] = null;
         $this->locale[$item['application']][$item['module']][$item['type']][$item['name']][] = $item;
     }
     // no need to keep this around
     unset($backend);
 }