public function copyInfoAction()
 {
     $transactionId = time();
     $pasteJobs = array();
     $session = new Zend_Session_Namespace("pimcore_copy");
     $session->{$transactionId} = array();
     if ($this->_getParam("type") == "recursive") {
         $object = Object_Abstract::getById($this->_getParam("sourceId"));
         // first of all the new parent
         $pasteJobs[] = array(array("url" => "/admin/object/copy", "params" => array("sourceId" => $this->_getParam("sourceId"), "targetId" => $this->_getParam("targetId"), "type" => "child", "transactionId" => $transactionId, "saveParentId" => true)));
         if ($object->hasChilds(array(Object_Abstract::OBJECT_TYPE_OBJECT, Object_Abstract::OBJECT_TYPE_FOLDER, Object_Abstract::OBJECT_TYPE_VARIANT))) {
             // get amount of childs
             $list = new Object_List();
             $list->setCondition("o_path LIKE '" . $object->getFullPath() . "/%'");
             $list->setOrderKey("LENGTH(o_path)", false);
             $list->setOrder("ASC");
             $list->setObjectTypes(array(Object_Abstract::OBJECT_TYPE_OBJECT, Object_Abstract::OBJECT_TYPE_FOLDER, Object_Abstract::OBJECT_TYPE_VARIANT));
             $childIds = $list->loadIdList();
             if (count($childIds) > 0) {
                 foreach ($childIds as $id) {
                     $pasteJobs[] = array(array("url" => "/admin/object/copy", "params" => array("sourceId" => $id, "targetParentId" => $this->_getParam("targetId"), "sourceParentId" => $this->_getParam("sourceId"), "type" => "child", "transactionId" => $transactionId)));
                 }
             }
         }
     } else {
         if ($this->_getParam("type") == "child" || $this->_getParam("type") == "replace") {
             // the object itself is the last one
             $pasteJobs[] = array(array("url" => "/admin/object/copy", "params" => array("sourceId" => $this->_getParam("sourceId"), "targetId" => $this->_getParam("targetId"), "type" => $this->_getParam("type"), "transactionId" => $transactionId)));
         }
     }
     $this->_helper->json(array("pastejobs" => $pasteJobs));
 }
Esempio n. 2
0
 /**
  * @return array
  */
 public function getO_childs($objectTypes = array(self::OBJECT_TYPE_OBJECT, self::OBJECT_TYPE_FOLDER))
 {
     if ($this->o_childs === null || $this->lastGetChildsObjectTypes != $objectTypes) {
         $this->lastGetChildsObjectTypes = $objectTypes;
         $list = new Object_List(true);
         $list->setCondition("o_parentId = ?", $this->getO_id());
         $list->setOrderKey("o_key");
         $list->setOrder("asc");
         $list->setObjectTypes($objectTypes);
         $this->o_childs = $list->load();
     }
     return $this->o_childs;
 }