Example #1
0
 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());
 }
Example #2
0
 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);
 }
Example #3
0
 public function setMainImage($itemId, $imageId)
 {
     $item = \Difra\Plugins\Catalog\Item::get($itemId);
     $item->setMainImage($imageId);
 }