Exemple #1
0
 /**
  * Create the instance of the destination.
  *
  * If succesful, the instance is stored in the m_destInstance member variable.
  *
  * @return bool true if succesful, false if something went wrong.
  */
 public function createDestination()
 {
     if (!is_object($this->m_destInstance)) {
         $atk = Atk::getInstance();
         $cache_id = $this->m_owner . '.' . $this->m_name;
         $this->m_destInstance = $atk->atkGetNode($this->m_destination, true, $cache_id);
         // Validate if destination was created succesfully
         if (!is_object($this->m_destInstance)) {
             Tools::atkerror("Relation with unknown nodetype '" . $this->m_destination . "' (in node '" . $this->m_owner . "')");
             $this->m_destInstance = null;
             return false;
         }
         if ($this->hasFlag(self::AF_NO_FILTER)) {
             $this->m_destInstance->m_flags |= Node::NF_NO_FILTER;
         }
         foreach (array_keys($this->m_destInstance->m_attribList) as $key) {
             $attribute = $this->m_destInstance->m_attribList[$key];
             if (is_subclass_of($attribute, 'Relation') && is_object($this->m_ownerInstance) && $attribute->m_destination == $this->m_ownerInstance->atkNodeUri()) {
                 $attribute->m_destInstance = $this->m_ownerInstance;
                 if (count($attribute->m_tabs) == 1 && $attribute->m_tabs[0] == 'default') {
                     $attribute->setTabs($this->m_tabs);
                 }
             }
         }
         if (!empty($this->m_descHandler)) {
             $this->m_destInstance->setDescriptorHandler($this);
         }
         if (!empty($this->m_descTemplate)) {
             $this->m_destInstance->setDescriptorTemplate($this->m_descTemplate);
         }
     }
     return true;
 }