Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/zoo.php.tar
Назад
home/wuectly/www/libraries/regularlabs/fields/zoo.php 0000604 00000007226 15245556150 0017074 0 ustar 00 <?php /** * @package Regular Labs Library * @version 21.4.10972 * * @author Peter van Westen <info@regularlabs.com> * @link http://www.regularlabs.com * @copyright Copyright © 2021 Regular Labs All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper as JHtml; use Joomla\CMS\Language\Text as JText; use RegularLabs\Library\Form as RL_Form; if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')) { return; } require_once JPATH_LIBRARIES . '/regularlabs/autoload.php'; class JFormFieldRL_Zoo extends \RegularLabs\Library\FieldGroup { public $type = 'Zoo'; protected function getInput() { if ($error = $this->missingFilesOrTables(['applications' => 'application', 'categories' => 'category', 'items' => 'item'])) { return $error; } return $this->getSelectList(); } function getCategories() { $query = $this->db->getQuery(true) ->select('COUNT(*)') ->from('#__zoo_category AS c') ->where('c.published > -1'); $this->db->setQuery($query); $total = $this->db->loadResult(); if ($total > $this->max_list_count) { return -1; } $options = []; if ($this->get('show_ignore')) { if (in_array('-1', $this->value)) { $this->value = ['-1']; } $options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_IGNORE') . ' -'); $options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', true); } $query->clear() ->select('a.id, a.name') ->from('#__zoo_application AS a') ->order('a.name, a.id'); $this->db->setQuery($query); $apps = $this->db->loadObjectList(); foreach ($apps as $i => $app) { $query->clear() ->select('c.id, c.parent AS parent_id, c.name AS title, c.published') ->from('#__zoo_category AS c') ->where('c.application_id = ' . (int) $app->id) ->where('c.published > -1') ->order('c.ordering, c.name'); $this->db->setQuery($query); $items = $this->db->loadObjectList(); if ($i) { $options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', true); } // establish the hierarchy of the menu // TODO: use node model $children = []; if ($items) { // first pass - collect children foreach ($items as $v) { $pt = $v->parent_id; $list = @$children[$pt] ? $children[$pt] : []; array_push($list, $v); $children[$pt] = $list; } } // second pass - get an indent list of the items $list = JHtml::_('menu.treerecurse', 0, '', [], $children, 9999, 0, 0); // assemble items to the array $options[] = JHtml::_('select.option', 'app' . $app->id, '[' . $app->name . ']'); foreach ($list as $item) { $item->treename = ' ' . str_replace('  - ', ' ', $item->treename); $item->treename = RL_Form::prepareSelectItem($item->treename, $item->published); $option = JHtml::_('select.option', $item->id, $item->treename); $option->level = 1; $options[] = $option; } } return $options; } function getItems() { $query = $this->db->getQuery(true) ->select('COUNT(*)') ->from('#__zoo_item AS i') ->where('i.state > -1'); $this->db->setQuery($query); $total = $this->db->loadResult(); if ($total > $this->max_list_count) { return -1; } $query->clear('select') ->select('i.id, i.name, a.name as cat, i.state as published') ->join('LEFT', '#__zoo_application AS a ON a.id = i.application_id') ->group('i.id') ->order('i.name, i.priority, i.id'); $this->db->setQuery($query); $list = $this->db->loadObjectList(); return $this->getOptionsByList($list, ['cat', 'id']); } } home/wuectly/www/libraries/regularlabs/helpers/assignments/zoo.php 0000604 00000013015 15245667506 0021624 0 ustar 00 <?php /** * @package Regular Labs Library * @version 21.4.10972 * * @author Peter van Westen <info@regularlabs.com> * @link http://www.regularlabs.com * @copyright Copyright © 2021 Regular Labs All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ /* @DEPRECATED */ defined('_JEXEC') or die; use Joomla\CMS\Factory as JFactory; if (is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')) { require_once JPATH_LIBRARIES . '/regularlabs/autoload.php'; } require_once dirname(__DIR__) . '/assignment.php'; class RLAssignmentsZoo extends RLAssignment { public function init() { if ( ! $this->request->view) { $this->request->view = $this->request->task; } switch ($this->request->view) { case 'item': $this->request->idname = 'item_id'; break; case 'category': $this->request->idname = 'category_id'; break; } $this->request->id = JFactory::getApplication()->input->getInt($this->request->idname, 0); } public function initAssignment($assignment, $article = 0) { parent::initAssignment($assignment, $article); if ($this->request->option != 'com_zoo' && ! isset($this->request->idname)) { return; } switch ($this->request->idname) { case 'item_id': $this->request->view = 'item'; break; case 'category_id': $this->request->view = 'category'; break; } } public function passPageTypes() { return $this->passByPageTypes('com_zoo', $this->selection, $this->assignment); } public function passCategories() { if ($this->request->option != 'com_zoo') { return $this->pass(false); } $pass = ( ($this->params->inc_apps && $this->request->view == 'frontpage') || ($this->params->inc_categories && $this->request->view == 'category') || ($this->params->inc_items && $this->request->view == 'item') ); if ( ! $pass) { return $this->pass(false); } $cats = $this->getCategories(); if ($cats === false) { return $this->pass(false); } $cats = $this->makeArray($cats); $pass = $this->passSimple($cats, 'include'); if ($pass && $this->params->inc_children == 2) { return $this->pass(false); } if ( ! $pass && $this->params->inc_children) { foreach ($cats as $cat) { $cats = array_merge($cats, $this->getCatParentIds($cat)); } } return $this->passSimple($cats); } private function getCategories() { if ($this->article && isset($this->article->catid)) { return [$this->article->catid]; } $menuparams = $this->getMenuItemParams($this->request->Itemid); switch ($this->request->view) { case 'frontpage': if ($this->request->id) { return [$this->request->id]; } if ( ! isset($menuparams->application)) { return []; } return ['app' . $menuparams->application]; case 'category': $cats = []; if ($this->request->id) { $cats[] = $this->request->id; } else if (isset($menuparams->category)) { $cats[] = $menuparams->category; } if (empty($cats[0])) { return []; } $query = $this->db->getQuery(true) ->select('c.application_id') ->from('#__zoo_category AS c') ->where('c.id = ' . (int) $cats[0]); $this->db->setQuery($query); $cats[] = 'app' . $this->db->loadResult(); return $cats; case 'item': $id = $this->request->id; if ( ! $id && isset($menuparams->item_id)) { $id = $menuparams->item_id; } if ( ! $id) { return []; } $query = $this->db->getQuery(true) ->select('c.category_id') ->from('#__zoo_category_item AS c') ->where('c.item_id = ' . (int) $id) ->where('c.category_id != 0'); $this->db->setQuery($query); $cats = $this->db->loadColumn(); $query = $this->db->getQuery(true) ->select('i.application_id') ->from('#__zoo_item AS i') ->where('i.id = ' . (int) $id); $this->db->setQuery($query); $cats[] = 'app' . $this->db->loadResult(); return $cats; default: return false; } } public function passItems() { if ( ! $this->request->id || $this->request->option != 'com_zoo') { return $this->pass(false); } if ($this->request->view != 'item') { return $this->pass(false); } $pass = false; // Pass Article Id if ( ! $this->passItemByType($pass, 'ContentIds')) { return $this->pass(false); } // Pass Authors if ( ! $this->passItemByType($pass, 'Authors')) { return $this->pass(false); } return $this->pass($pass); } public function getItem($fields = []) { $query = $this->db->getQuery(true) ->select($fields) ->from('#__zoo_item') ->where('id = ' . (int) $this->request->id); $this->db->setQuery($query); return $this->db->loadObject(); } private function getCatParentIds($id = 0) { $parent_ids = []; if ( ! $id) { return $parent_ids; } while ($id) { if (substr($id, 0, 3) == 'app') { $parent_ids[] = $id; break; } $query = $this->db->getQuery(true) ->select('c.parent') ->from('#__zoo_category AS c') ->where('c.id = ' . (int) $id); $this->db->setQuery($query); $pid = $this->db->loadResult(); if ( ! $pid) { $query = $this->db->getQuery(true) ->select('c.application_id') ->from('#__zoo_category AS c') ->where('c.id = ' . (int) $id); $this->db->setQuery($query); $app = $this->db->loadResult(); if ($app) { $parent_ids[] = 'app' . $app; } break; } $parent_ids[] = $pid; $id = $pid; } return $parent_ids; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка