Пример #1
0
 /**
  * Show confirmation before moving anything
  *
  * @return void
  */
 public function show()
 {
     $input = JFactory::getApplication()->input;
     // Overwrite the view
     $input->set('view', 'moveelementconfirm');
     $groups = $input->get('groups', array(), 'array');
     $tables = $input->get('tables', array(), 'array');
     $files = $input->get('files', array(), 'files');
     // If a group is selected then load all the elements from that group
     if (!empty($groups)) {
         foreach ($groups as $groupId) {
             $group = NenoContentElementGroup::getGroup($groupId);
             // Handle tables
             $groupTables = $group->getTables();
             if (!empty($groupTables)) {
                 /* @var $groupTable NenoContentElementGroup */
                 foreach ($groupTables as $groupTable) {
                     // Add the table id to the tables array
                     $tables[] = $groupTable->getId();
                 }
             }
             // Handle files
             $groupFiles = $group->getLanguageFiles();
             if (!empty($groupFiles)) {
                 /* @var $groupFile NenoContentElementLanguageFile */
                 foreach ($groupFiles as $groupFile) {
                     // Add the file id to the files array
                     $files[] = $groupFile->getId();
                 }
             }
         }
     }
     // Remove duplicates
     array_unique($tables);
     array_unique($files);
     // Load table info
     if (!empty($tables)) {
         foreach ($tables as $key => $table) {
             $tables[$key] = NenoContentElementTable::load($table);
         }
     }
     // Load files info
     if (!empty($files)) {
         foreach ($files as $key => $file) {
             $files[$key] = NenoContentElementLanguageFile::load($file);
         }
     }
     // Show output
     // Get the view
     /* @var $view NenoViewMoveElementConfirm */
     $view = $this->getView('MoveElementConfirm', 'html');
     $view->groups = NenoHelper::convertNenoObjectListToJObjectList(NenoHelper::getGroups());
     // Assign data from the model
     $view->tables = NenoHelper::convertNenoObjectListToJObjectList($tables);
     $view->files = NenoHelper::convertNenoObjectListToJObjectList($files);
     // Display the view
     $view->display();
 }
Пример #2
0
 /**
  * Display the view
  *
  * @param   string $tpl Template
  *
  * @return void
  *
  * @throws Exception This will happen if there are errors during the process to load the data
  *
  * @since 1.0
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = NenoHelper::convertNenoObjectListToJObjectList($this->get('Items'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     NenoHelperBackend::addSubmenu('groupselements');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Пример #3
0
 /**
  * Load elements using AJAX
  *
  * @return void
  *
  * @throws Exception
  */
 public function getElements()
 {
     $input = JFactory::getApplication()->input;
     $groupId = $input->getInt('group_id');
     if (!empty($groupId)) {
         /* @var $group NenoContentElementGroup */
         $group = NenoContentElementGroup::load($groupId);
         $tables = $group->getTables(false, false, true);
         $files = $group->getLanguageFiles();
         $displayData = array();
         /* @var $model NenoModelStrings */
         $model = $this->getModel();
         $displayData['tables'] = NenoHelper::convertNenoObjectListToJObjectList($tables);
         //Remove fields marked as Don't translate
         foreach ($displayData['tables'] as $table) {
             foreach ($table->fields as $key => $field) {
                 if (!$field->translate) {
                     unset($table->fields[$key]);
                 }
             }
         }
         $displayData['files'] = NenoHelper::convertNenoObjectListToJObjectList($files);
         $displayData['state'] = $model->getState();
         $tablesHTML = JLayoutHelper::render('multiselecttables', $displayData, JPATH_NENO_LAYOUTS);
         echo $tablesHTML;
     }
     JFactory::getApplication()->close();
 }
Пример #4
0
 /**
  * Get elements
  *
  * @return void
  */
 public function getElements()
 {
     $input = JFactory::getApplication()->input;
     $groupId = $input->getInt('group_id');
     /* @var $group NenoContentElementGroup */
     $group = NenoContentElementGroup::load($groupId);
     $tables = $group->getTables();
     $files = $group->getLanguageFiles();
     $displayData = array();
     $displayData['group'] = $group->prepareDataForView();
     $displayData['tables'] = NenoHelper::convertNenoObjectListToJObjectList($tables);
     $displayData['files'] = NenoHelper::convertNenoObjectListToJObjectList($files);
     $tablesHTML = JLayoutHelper::render('rowelementtable', $displayData, JPATH_NENO_LAYOUTS);
     echo $tablesHTML;
     JFactory::getApplication()->close();
 }