示例#1
0
文件: index.php 项目: difra-org/difra
 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);
 }
示例#2
0
 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);
 }
示例#3
0
 /**
  * Проверяет на дубликаты генерируемый ури работы портфолио
  * @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;
 }
示例#4
0
文件: index.php 项目: difra-org/difra
 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);
 }