예제 #1
0
 public function reverseMap($object)
 {
     parent::reverseMap($object);
     $object->childs = null;
     $object->elements = array();
     if (is_array($this->elements)) {
         foreach ($this->elements as $element) {
             $tag = Document_Tag::factory($element->type, $element->name, $this->id);
             $tag->getFromWebserviceImport($element);
             $object->elements[$element->name] = $tag;
         }
     }
 }
예제 #2
0
파일: View.php 프로젝트: nblackman/pimcore
 /**
  * @param $type
  * @param $name
  * @param array $options
  * @return Tag
  */
 public function tag($type, $name, $options = array())
 {
     $type = strtolower($type);
     try {
         // @todo add document-id to registry key | for example for embeded snippets
         // set suffixes if the tag is inside a block
         try {
             $blocks = Zend_Registry::get("pimcore_tag_block_current");
             $numeration = Zend_Registry::get("pimcore_tag_block_numeration");
             if (is_array($blocks) and count($blocks) > 0) {
                 if ($type == "block") {
                     $tmpBlocks = $blocks;
                     $tmpNumeration = $numeration;
                     array_pop($tmpBlocks);
                     array_pop($tmpNumeration);
                     $tmpName = $name;
                     if (is_array($tmpBlocks)) {
                         $tmpName = $name . implode("_", $tmpBlocks) . implode("_", $tmpNumeration);
                     }
                     if ($blocks[count($blocks) - 1] == $tmpName) {
                         array_pop($blocks);
                         array_pop($numeration);
                     }
                 }
                 $name = $name . implode("_", $blocks) . implode("_", $numeration);
             }
         } catch (Exception $e) {
         }
         $document = $this->document;
         if ($document instanceof Document) {
             $tag = $document->getElement($name);
             if ($tag instanceof Document_Tag && $tag->getType() == $type) {
                 // call the load() method if it exists to reinitialize the data (eg. from serializing, ...)
                 if (method_exists($tag, "load")) {
                     $tag->load();
                 }
                 // set view & controller, editmode
                 $tag->setController($this->controller);
                 $tag->setView($this);
                 $tag->setEditmode($this->editmode);
                 $tag->setOptions($options);
             } else {
                 $tag = Document_Tag::factory($type, $name, $document->getId(), $options, $this->controller, $this, $this->editmode);
                 $document->setElement($name, $tag);
             }
         }
         return $tag;
     } catch (Exception $e) {
         Logger::warning($e);
     }
 }
예제 #3
0
파일: Link.php 프로젝트: ngocanh/pimcore
 /**
  * Returns the current tag's data for web service export
  *
  * @abstract
  * @return array
  */
 public function getForWebserviceExport()
 {
     $el = parent::getForWebserviceExport();
     if ($this->data["internal"]) {
         if (intval($this->data["internalId"]) > 0) {
             if ($this->data["internalType"] == "document") {
                 $referencedDocument = Document::getById($this->data["internalId"]);
                 if (!$referencedDocument instanceof Document) {
                     //detected broken link
                     $document = Document::getById($this->getDocumentId());
                     Element_Service::scheduleForSanityCheck($document);
                 }
             } else {
                 if ($this->data["internalType"] == "asset") {
                     $referencedAsset = Asset::getById($this->data["internalId"]);
                     if (!$referencedAsset instanceof Asset) {
                         //detected broken link
                         $document = Document::getById($this->getDocumentId());
                         Element_Service::scheduleForSanityCheck($document);
                     }
                 }
             }
         }
     }
     $el->data = $this->data;
     return $el;
 }
예제 #4
0
파일: Href.php 프로젝트: nblackman/pimcore
 /**
  * @return array
  */
 public function __sleep()
 {
     $finalVars = array();
     $parentVars = parent::__sleep();
     $blockedVars = array("element");
     foreach ($parentVars as $key) {
         if (!in_array($key, $blockedVars)) {
             $finalVars[] = $key;
         }
     }
     return $finalVars;
 }
예제 #5
0
파일: Video.php 프로젝트: nblackman/pimcore
 /**
  * @see Document_Tag_Interface::admin
  * @return string
  */
 public function admin()
 {
     $html = parent::admin();
     // get frontendcode for preview
     $html .= $this->frontend();
     return $html;
 }
예제 #6
0
 /**
  * @return array
  */
 public function __sleep()
 {
     $this->__sleepData = $this->getDataForResource();
     $this->elements = array();
     return parent::__sleep();
 }