示例#1
0
文件: view.php 项目: difra-org/difra
 /**
  * @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;
 }
示例#2
0
文件: index.php 项目: difra-org/difra
 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');
     }
 }
示例#3
0
 public function downAjaxAction(\Difra\Param\AnyInt $id)
 {
     \Difra\Plugins\Catalog::getInstance()->moveCategoryDown($id->val());
     $this->ajax->refresh();
 }
示例#4
0
文件: items.php 项目: difra-org/difra
 public function setmainimageAjaxAction(\Difra\Param\AnyInt $itemId, \Difra\Param\AnyInt $imgId)
 {
     \Difra\Plugins\Catalog::getInstance()->setMainImage($itemId, $imgId);
     $this->ajax->refresh();
 }
示例#5
0
文件: c.php 项目: difra-org/difra
 public function sortAjaxAction(\Difra\Param\AnyString $sort)
 {
     \Difra\Plugins\Catalog::getInstance()->setSort($sort->val());
     \Difra\Ajaxer::refresh();
 }