public function editAction(\Difra\Param\AnyInt $id) { /** @var \DOMElement $editNode */ $editNode = $this->root->appendChild($this->xml->createElement('CatalogItemEdit')); \Difra\Plugins\Catalog::getInstance()->getCategoriesListXML($editNode); \Difra\Plugins\Catalog\Ext::getListXML($editNode, true, true); $itemNode = $editNode->appendChild($this->xml->createElement('item')); $item = \Difra\Plugins\Catalog\Item::get($id->val()); $item->loadExt(); $item->getXML($itemNode); $editNode->setAttribute('category', $item->getCategory()); }
public function indexAction() { /** @var \DOMElement $configNode */ $configNode = $this->root->appendChild($this->xml->createElement('CatalogConfig')); $conf = \Difra\Config::getInstance(); $configNode->setAttribute('maxdepth', $conf->getValue('catalog', 'maxdepth')); $configNode->setAttribute('perpage', $conf->getValue('catalog', 'perpage')); $configNode->setAttribute('hideempty', $conf->getValue('catalog', 'hideempty')); $configNode->setAttribute('allownoimage', $conf->getValue('catalog', 'allownoimage')); $configNode->setAttribute('usescale', $conf->getValue('catalog', 'usescale')); $imgSizes = \Difra\Plugins\Catalog\Item::getSizes(); $imgSizes2 = []; foreach ($imgSizes as $k => $arr) { if ($k == 'f') { continue; } $imgSizes2[] = $k . ' ' . implode(' ', $arr); } $configNode->setAttribute('imgSizes', implode("\n", $imgSizes2)); }
public function viewItem(&$controller, $link, $action, $title) { $itemNode = $controller->root->appendChild($controller->xml->createElement('CatalogItem')); $link = explode('-', $link, 2); if (sizeof($link) < 2 or !is_numeric($link[0])) { throw new \Difra\View\HttpError(404); return; } $item = \Difra\Plugins\Catalog\Item::get($link[0]); if (!$item->load()) { throw new \Difra\View\HttpError(404); return; } if (rawurldecode($link[1]) != $item->getLink()) { throw new \Difra\View\HttpError(404); return; } $item->loadExt(); $item->getXML($itemNode); $title[] = $item->getName(); $title = implode(' → ', $title); $controller->root->setAttribute('pageTitle', $title); }
/** * Возвращает тип сортировки * @return string */ public function getSort() { return \Difra\Plugins\Catalog\Item::getSort(); }