Пример #1
0
 public function addAction(\Difra\Param\NamedInt $to)
 {
     $addNode = $this->root->appendChild($this->xml->createElement('CatalogExtValueAdd'));
     $addNode->setAttribute('ext', $to->val());
     $ext = \Difra\Plugins\Catalog\Ext::get($to->val());
     $addNode->setAttribute('set', $ext->getSet());
     $addNode->setAttribute('extName', $ext->getName());
 }
Пример #2
0
 public function addAction(\Difra\Param\NamedInt $to = null)
 {
     /** @var \DOMElement $addNode */
     $addNode = $this->root->appendChild($this->xml->createElement('CatalogItemAdd'));
     \Difra\Plugins\Catalog::getInstance()->getCategoriesListXML($addNode);
     if ($to) {
         $addNode->setAttribute('category', $to->val());
     }
     \Difra\Plugins\Catalog\Ext::getListXML($addNode, true, true);
 }
Пример #3
0
 public function addAction(\Difra\Param\NamedInt $to = null)
 {
     /** @var \DOMElement $addNode */
     $addNode = $this->root->appendChild($this->xml->createElement('CatalogCategoriesAdd'));
     if ($to) {
         $addNode->setAttribute('parent', $to->val());
     }
     Catalog::getInstance()->getCategoriesListXML($addNode);
     $conf = \Difra\Config::getInstance()->get('catalog');
     $addNode->setAttribute('maxdepth', $conf['maxdepth']);
 }
Пример #4
0
 public function editpostAction(Param\NamedInt $id = null)
 {
     $this->root->appendChild($this->xml->createElement('blogs-editPost'));
     if ($post = Blogs\Post::getById($id->val())) {
         $Users = Difra\Plugins\Users::getInstance();
         $usersXml = $this->root->appendChild($this->xml->createElement('users'));
         $Users->getListXML($usersXml);
         /** @var $editNode \DOMElement */
         $editNode = $this->root->appendChild($this->xml->createElement('postData'));
         $post->getXML($editNode, true);
     } else {
         $this->view->redirect('/adm/blogs/');
     }
 }
Пример #5
0
 public function indexAction(\Difra\Param\AnyInt $id = null, \Difra\Param\NamedInt $page = null)
 {
     if (!is_null($id)) {
         /** @var \DOMElement $albumNode */
         $albumNode = $this->root->appendChild($this->xml->createElement('GalleryAlbum'));
         $album = \Difra\Plugins\Gallery\Album::get($id->val());
         if (!$album->load()) {
             throw new \Difra\View\HttpError(404);
         }
         $album->getXML($albumNode);
         $albumNode->setAttribute('id', $id);
         $sizesNode = $albumNode->appendChild($this->xml->createElement('sizes'));
         $album->getSizesXML($sizesNode);
         $Locale = \Difra\Locales::getInstance();
         $pageTitle = $Locale->getXPath('gallery/title-album') . $Locale->getXPath('gallery/arrow') . $album->getName();
         $this->root->setAttribute('pageTitle', $pageTitle);
     } else {
         $perpage = \Difra\Config::getInstance()->getValue('gallery', 'perpage');
         $listNode = $this->root->appendChild($this->xml->createElement('GalleryList'));
         \Difra\Plugins\Gallery::getInstance()->getAlbumsListXML($listNode, true, $page ? $page->val() : 1, $perpage ? $perpage : 20);
         $this->root->setAttribute('pageTitle', \Difra\Locales::getInstance()->getXPath('gallery/title'));
     }
 }