getId() 공개 메소드

public getId ( ) : integer
리턴 integer
예제 #1
0
 /**
  * @param  Model\Asset $target
  * @param  Model\Asset $source
  * @return Model\Asset copied asset
  */
 public function copyRecursive($target, $source)
 {
     // avoid recursion
     if (!$this->_copyRecursiveIds) {
         $this->_copyRecursiveIds = [];
     }
     if (in_array($source->getId(), $this->_copyRecursiveIds)) {
         return;
     }
     $source->getProperties();
     $new = clone $source;
     $new->id = null;
     if ($new instanceof Asset\Folder) {
         $new->setChilds(null);
     }
     $new->setFilename(Element\Service::getSaveCopyName("asset", $new->getFilename(), $target));
     $new->setParentId($target->getId());
     $new->setUserOwner($this->_user->getId());
     $new->setUserModification($this->_user->getId());
     $new->setDao(null);
     $new->setLocked(false);
     $new->setCreationDate(time());
     $new->setStream($source->getStream());
     $new->save();
     // add to store
     $this->_copyRecursiveIds[] = $new->getId();
     foreach ($source->getChilds() as $child) {
         $this->copyRecursive($new, $child);
     }
     if ($target instanceof Asset\Folder) {
         $this->updateChilds($target, $new);
     }
     return $new;
 }
예제 #2
0
 /**
  * @throws DAV\Exception\Forbidden
  * @throws \Exception
  */
 function delete()
 {
     if ($this->asset->isAllowed("delete")) {
         Asset\Service::loadAllFields($this->asset);
         $this->asset->delete();
         // add the asset to the delete history, this is used so come over problems with programs like photoshop (delete, create instead of replace => move)
         // for details see Asset\WebDAV\Tree::move()
         $log = Asset\WebDAV\Service::getDeleteLog();
         $this->asset->_fulldump = true;
         $log[$this->asset->getFullpath()] = array("id" => $this->asset->getId(), "timestamp" => time(), "data" => \Pimcore\Tool\Serialize::serialize($this->asset));
         unset($this->asset->_fulldump);
         Asset\WebDAV\Service::saveDeleteLog($log);
     } else {
         throw new DAV\Exception\Forbidden();
     }
 }
예제 #3
0
 /**
  * @param string $name
  * @throws DAV\Exception\Forbidden
  */
 function createDirectory($name)
 {
     $user = AdminTool::getCurrentUser();
     if ($this->asset->isAllowed("create")) {
         $asset = Asset::create($this->asset->getId(), array("filename" => File::getValidFilename($name), "type" => "folder", "userModification" => $user->getId(), "userOwner" => $user->getId()));
     } else {
         throw new DAV\Exception\Forbidden();
     }
 }
예제 #4
0
파일: Folder.php 프로젝트: pimcore/pimcore
 /**
  * @param string $name
  * @throws DAV\Exception\Forbidden
  */
 public function createDirectory($name)
 {
     $user = AdminTool::getCurrentUser();
     if ($this->asset->isAllowed("create")) {
         $asset = Asset::create($this->asset->getId(), ["filename" => Element\Service::getValidKey($name, "asset"), "type" => "folder", "userModification" => $user->getId(), "userOwner" => $user->getId()]);
     } else {
         throw new DAV\Exception\Forbidden();
     }
 }
예제 #5
0
파일: Manager.php 프로젝트: pimcore/pimcore
 /**
  * Returns the available statuses given an action and a state
  *
  * @param $actionName
  * @param $stateName
  * @return array
  * @throws \Exception
  */
 public function getAvailableStatuses($actionName, $stateName)
 {
     $actionConfig = $this->workflow->getActionConfig($actionName);
     $globalAction = $this->workflow->isGlobalAction($actionName);
     $hasTransition = $this->actionHasTransition($actionConfig);
     if ($globalAction || !$hasTransition) {
         $objectStatus = $this->getElementStatus();
         $availableStatuses = [$objectStatus => $this->workflow->getStatusConfig($objectStatus)];
     } else {
         //we have a check here for the state being an existing one
         if (!isset($actionConfig['transitionTo'][$stateName])) {
             throw new \Exception("Workflow::getAvailableStatuses, State [{$stateName}] not valid for action [{$actionName}] on element [{$this->element->getId()}] with status [{$this->getElementStatus()}]");
         }
         $availableStatuses = [];
         foreach ($actionConfig['transitionTo'][$stateName] as $statusName) {
             $availableStatuses[$statusName] = $this->workflow->getStatusConfig($statusName);
         }
     }
     return $availableStatuses;
 }
예제 #6
0
파일: Href.php 프로젝트: sfie/pimcore
 /**
  * @see Object\ClassDefinition\Data::getDataForEditmode
  * @param Asset|Document|Object\AbstractObject $data
  * @param null|Model\Object\AbstractObject $object
  * @return array
  */
 public function getDataForEditmode($data, $object = null)
 {
     if ($data instanceof Element\ElementInterface) {
         $r = array("id" => $data->getId(), "path" => $data->getFullPath(), "subtype" => $data->getType(), "type" => Element\Service::getElementType($data));
         return $r;
     }
     return;
 }
예제 #7
0
파일: Image.php 프로젝트: ptaferner/pimcore
 /**
  * @see Object\ClassDefinition\Data::getDataForQueryResource
  * @param Asset $data
  * @param null|Model\Object\AbstractObject $object
  * @return integer|null
  */
 public function getDataForQueryResource($data, $object = null)
 {
     if ($data instanceof Asset) {
         return $data->getId();
     }
     return null;
 }
예제 #8
0
파일: Asset.php 프로젝트: Gerhard13/pimcore
 /**
  * @param Asset $parent
  * @return void
  */
 public function setParent($parent)
 {
     $this->parent = $parent;
     if ($parent instanceof Asset) {
         $this->parentId = $parent->getId();
     }
     return $this;
 }
 /**
  * @see Object\ClassDefinition\Data::getDataForResource
  * @param Asset $data
  * @param null|Model\Object\AbstractObject $object
  * @return integer|null
  */
 public function getDataForResource($data, $object = null)
 {
     if ($data instanceof Object\CoreShopOrderState) {
         return $data->getId();
     }
     return null;
 }
예제 #10
0
 /**
  * @param Document|Asset|Object\AbstractObject $element
  * @return array
  */
 public static function getDependencyForFrontend($element)
 {
     if ($element instanceof ElementInterface) {
         return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => self::getElementType($element), "subtype" => $element->getType());
     }
 }