/** * @param \Difra\Controller $controller * @param int $catId * @param int $page * @param array $linkparts * @param bool|string $title * @param int $cperpage * @return mixed */ public function viewCategory(&$controller, $catId, $page, $linkparts, $title = false, $cperpage = 0) { if (!$cperpage) { if (!($perpage = \Difra\Config::getInstance()->getValue('catalog', 'perpage'))) { $perpage = 20; } } else { $perpage = $cperpage; } $catalogNode = $controller->root->appendChild($controller->xml->createElement('CatalogList')); $catalog = \Difra\Plugins\Catalog::getInstance(); $catalogNode->setAttribute('sort', $sort = $catalog->getSort()); $baseLink = $linkparts ? '/c/' . implode('/', $linkparts) : '/c'; $list = $catalog->getItemsXML($catalogNode, $catId, true, $page, $perpage, true, true); if (!$cperpage) { $pages = floor((\Difra\Plugins\Catalog::getInstance()->getItemsCount() - 1) / $perpage) + 1; $catalogNode->setAttribute('pages', $pages); $catalogNode->setAttribute('current', $page); $catalogNode->setAttribute('link', $baseLink); } if ($title) { $title = implode(' → ', $title); $controller->root->setAttribute('pageTitle', $title); } return $list; }
public function saveAjaxAction(\Difra\Param\AjaxString $name, \Difra\Param\AjaxInt $set, \Difra\Param\AjaxInt $group, \Difra\Param\AjaxInt $id = null) { if (!$id) { $ext = \Difra\Plugins\Catalog::getInstance()->addExt($name->val(), $set->val(), $group->val()); } else { $ext = \Difra\Plugins\Catalog::getInstance()->editExt($id->val(), $name->val(), $set->val(), $group->val()); } if ($set->val()) { $this->ajax->redirect('/adm/catalog/ext/values/' . $ext->getId()); } else { $this->ajax->redirect('/adm/catalog/ext'); } }
public function downAjaxAction(\Difra\Param\AnyInt $id) { \Difra\Plugins\Catalog::getInstance()->moveCategoryDown($id->val()); $this->ajax->refresh(); }
public function setmainimageAjaxAction(\Difra\Param\AnyInt $itemId, \Difra\Param\AnyInt $imgId) { \Difra\Plugins\Catalog::getInstance()->setMainImage($itemId, $imgId); $this->ajax->refresh(); }
public function sortAjaxAction(\Difra\Param\AnyString $sort) { \Difra\Plugins\Catalog::getInstance()->setSort($sort->val()); \Difra\Ajaxer::refresh(); }