/** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. */ public function getItems() { $items = parent::getItems(); $db = $this->getDbo(); $query = $db->getQuery(true); $query->select('id, title')->from('#__viewlevels'); $db->setQuery($query); $viewLevels = $db->loadObjectList('id'); // Get the join element name of those elements not in a joined group foreach ($items as &$item) { if ($item->full_element_name == '') { $item->full_element_name = $item->db_table_name . '___' . $item->name; } // Add a tip containing the access level information $params = new JRegistry($item->params); $addAccessTitle = FArrayHelper::getValue($viewLevels, $item->access); $addAccessTitle = is_object($addAccessTitle) ? $addAccessTitle->title : 'n/a'; $editAccessTitle = FArrayHelper::getValue($viewLevels, $params->get('edit_access', 1)); $editAccessTitle = is_object($editAccessTitle) ? $editAccessTitle->title : 'n/a'; $viewAccessTitle = FArrayHelper::getValue($viewLevels, $params->get('view_access', 1)); $viewAccessTitle = is_object($viewAccessTitle) ? $viewAccessTitle->title : 'n/a'; $item->tip = FText::_('COM_FABRIK_ACCESS_EDITABLE_ELEMENT') . ': ' . $addAccessTitle . '<br />' . FText::_('COM_FABRIK_ELEMENT_EDIT_ACCESS_LABEL') . ': ' . $editAccessTitle . '<br />' . FText::_('COM_FABRIK_ACCESS_VIEWABLE_ELEMENT') . ': ' . $viewAccessTitle; $validations = $params->get('validations'); $v = array(); // $$$ hugh - make sure the element has validations, if not it could return null or 0 length array if (is_object($validations)) { for ($i = 0; $i < count($validations->plugin); $i++) { $pname = $validations->plugin[$i]; /* * $$$ hugh - it's possible to save an element with a validation that hasn't * actually had a plugin type selected yet. */ if (empty($pname)) { $v[] = ' <strong>' . FText::_('COM_FABRIK_ELEMENTS_NO_VALIDATION_SELECTED') . '</strong>'; continue; } $msgs = $params->get($pname . '-message'); /* * $$$ hugh - elements which haven't been saved since Published param was added won't have * plugin_published, and just default to Published */ if (!isset($validations->plugin_published)) { $published = FText::_('JPUBLISHED'); } else { $published = $validations->plugin_published[$i] ? FText::_('JPUBLISHED') : FText::_('JUNPUBLISHED'); } $v[] = ' <strong>' . $pname . ': <em>' . $published . '</em></strong>' . '<br /> ' . FText::_('COM_FABRIK_FIELD_ERROR_MSG_LABEL') . ': <em>' . htmlspecialchars(FArrayHelper::getValue($msgs, $i, 'n/a')) . '</em>'; } } $item->numValidations = count($v); $item->validationTip = $v; } return $items; }
/** * (non-PHPdoc) * @see JModelList::getItems() */ public function getItems() { $items = parent::getItems(); // get the join elemnent name of those elements not in a joined group foreach ($items as &$item) { if ($item->full_element_name == '') { $item->full_element_name = $item->db_table_name . '___' . $item->name; } } return $items; }
/** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. */ public function getItems() { $items = parent::getItems(); foreach ($items as &$i) { $n = $i->component_name . '_' . $i->version; $file = JPATH_ROOT . '/tmp/' . $i->component_name . '/pkg_' . $n . '.zip'; $url = COM_FABRIK_LIVESITE . 'tmp/' . $i->component_name . '/pkg_' . $n . '.zip'; if (JFile::exists($file)) { $i->file = '<a href="' . $url . '"><span class="icon-download"></span> pkg_' . $n . '.zip</a>'; } else { $i->file = JText::_('COM_FABRIK_EXPORT_PACKAGE_TO_CREATE_ZIP'); } } return $items; }
/** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. */ public function getItems() { $items = parent::getItems(); $db = $this->getDbo(); $query = $db->getQuery(true); $query->select('id, title')->from('#__viewlevels'); $db->setQuery($query); $viewLevels = $db->loadObjectList('id'); // Get the join elemnent name of those elements not in a joined group foreach ($items as &$item) { if ($item->full_element_name == '') { $item->full_element_name = $item->db_table_name . '___' . $item->name; } // Add a tip containing the access level information $params = new JRegistry($item->params); $item->tip = JText::_('COM_FABRIK_ACCESS_EDITABLE_ELEMENT') . ': ' . $viewLevels[$item->access]->title . '<br />' . JText::_('COM_FABRIK_ACCESS_VIEWABLE_ELEMENT') . ': ' . $viewLevels[$params->get('view_access')]->title; } return $items; }