private function _viewWork($link) { $entry = new \Difra\Unify\Search('PortfolioEntry'); $entry->addCondition('uri', $link); $list = $entry->getList(); if (empty($list)) { throw new \Difra\View\HttpError(404); } $mainXml = $this->root->appendChild($this->xml->createElement('PortfolioWork')); $list[0]->getXML($mainXml); \Difra\Plugins\Portfolio::getWorkImagesXML($list[0]->id, $mainXml); $this->root->setAttribute('pageTitle', $list[0]->name); }
public function addAjaxAction(\Difra\Param\AjaxString $search) { $this->subInit(); /** @var \Difra\Plugins\Widgets\Objects\Directory $class */ $class = \Difra\Unify\Storage::getClass('WidgetsDirectory'); if (strlen($search) > $class::DIRECTORY_LENGTH) { \Difra\Ajaxer::getInstance()->notify(\Difra\Locales::getInstance()->getXPath('widgets/directory/value-too-long')); } $searchObj = new \Difra\Unify\Search('WidgetsDirectory'); $searchObj->addConditions(['directory' => static::directory, 'name' => $search]); $res = $searchObj->doQuery(); if (empty($res)) { $object = $class::create(); $object->directory = static::directory; $object->name = (string) $search; } \Difra\Ajaxer::getInstance()->close(); $this->action((string) $search); }
/** * Проверяет на дубликаты генерируемый ури работы портфолио * @param $title * @return bool */ public static function checkURI($title) { $entry = new \Difra\Unify\Search('PortfolioEntry'); $entry->addCondition('uri', \Difra\Locales::getInstance()->makeLink($title)); $list = $entry->getList(); return !is_null($list) ? false : true; }
public function editAction(\Difra\Param\AnyInt $id) { $mainXml = $this->root->appendChild($this->xml->createElement('PortfolioEntryEdit')); $mainXml->setAttribute('edit', true); $entryNode = $mainXml->appendChild($this->xml->createElement('entry')); $entry = \Difra\Unify::getObj('PortfolioEntry', $id->val()); $entry->getXML($entryNode); $imagesNode = $entryNode->appendChild($this->xml->createElement('images')); $images = new \Difra\Unify\Search('PortfolioImages'); $images->addCondition('portfolio', $entry->id); $images->setOrder(['position']); $images->getListXML($imagesNode); }