本文整理汇总了PHP中Pimcore\Model\Element\Service::getIdPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getIdPath方法的具体用法?PHP Service::getIdPath怎么用?PHP Service::getIdPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Element\Service
的用法示例。
在下文中一共展示了Service::getIdPath方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")));
}
Element\Editlock::lock($this->getParam("id"), "document");
$snippet = Document\Snippet::getById($this->getParam("id"));
$modificationDate = $snippet->getModificationDate();
$snippet = $this->getLatestVersion($snippet);
$snippet->setVersions(array_splice($snippet->getVersions(), 0, 1));
$snippet->getScheduledTasks();
$snippet->idPath = Element\Service::getIdPath($snippet);
$snippet->userPermissions = $snippet->getUserPermissions();
$snippet->setLocked($snippet->isLocked());
$snippet->setParent(null);
if ($snippet->getContentMasterDocument()) {
$snippet->contentMasterDocumentPath = $snippet->getContentMasterDocument()->getRealFullPath();
}
$this->minimizeProperties($snippet);
// unset useless data
$snippet->setElements(null);
if ($snippet->isAllowed("view")) {
$this->_helper->json($snippet);
}
$this->_helper->json(false);
}
示例2: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
Element\Editlock::lock($this->getParam("id"), "document");
$link = Document\Hardlink::getById($this->getParam("id"));
$link = clone $link;
$link->idPath = Element\Service::getIdPath($link);
$link->userPermissions = $link->getUserPermissions();
$link->setLocked($link->isLocked());
$link->setParent(null);
if ($link->getSourceDocument()) {
$link->sourcePath = $link->getSourceDocument()->getRealFullPath();
}
$this->addTranslationsData($link);
$this->minimizeProperties($link);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($link));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $link, "returnValueContainer" => $returnValueContainer]);
if ($link->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}
示例3: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
Element\Editlock::lock($this->getParam("id"), "document");
$email = Document\Newsletter::getById($this->getParam("id"));
$email = clone $email;
$email = $this->getLatestVersion($email);
$versions = Element\Service::getSafeVersionInfo($email->getVersions());
$email->setVersions(array_splice($versions, 0, 1));
$email->idPath = Element\Service::getIdPath($email);
$email->userPermissions = $email->getUserPermissions();
$email->setLocked($email->isLocked());
$email->setParent(null);
// unset useless data
$email->setElements(null);
$email->childs = null;
$this->addTranslationsData($email);
$this->minimizeProperties($email);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($email));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $email, "returnValueContainer" => $returnValueContainer]);
if ($email->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}
示例4: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")));
}
Element\Editlock::lock($this->getParam("id"), "document");
$page = Document\Page::getById($this->getParam("id"));
$page = $this->getLatestVersion($page);
$page->setVersions(array_splice($page->getVersions(), 0, 1));
$page->getScheduledTasks();
$page->idPath = Element\Service::getIdPath($page);
$page->userPermissions = $page->getUserPermissions();
$page->setLocked($page->isLocked());
$page->setParent(null);
if ($page->getContentMasterDocument()) {
$page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
}
// get depending redirects
$redirectList = new Redirect\Listing();
$redirectList->setCondition("target = ?", $page->getId());
$page->redirects = $redirectList->load();
// unset useless data
$page->setElements(null);
$page->childs = null;
// cleanup properties
$this->minimizeProperties($page);
if ($page->isAllowed("view")) {
$this->_helper->json($page);
}
$this->_helper->json(false);
}
示例5: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (\Pimcore\Model\Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => \Pimcore\Model\Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
\Pimcore\Model\Element\Editlock::lock($this->getParam("id"), "document");
$page = Document\Printpage::getById($this->getParam("id"));
$page = $this->getLatestVersion($page);
$page->getVersions();
$page->getScheduledTasks();
$page->idPath = Service::getIdPath($page);
$page->userPermissions = $page->getUserPermissions();
$page->setLocked($page->isLocked());
if ($page->getContentMasterDocument()) {
$page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
}
$this->addTranslationsData($page);
// unset useless data
$page->setElements(null);
$page->childs = null;
// cleanup properties
$this->minimizeProperties($page);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($page));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $page, "returnValueContainer" => $returnValueContainer]);
if ($page->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}
示例6: getIdPathAction
public function getIdPathAction()
{
$id = (int) $this->getParam("id");
$type = $this->getParam("type");
$response = array("success" => true);
if ($element = Element\Service::getElementById($type, $id)) {
$response["idPath"] = Element\Service::getIdPath($element);
}
$this->_helper->json($response);
}
示例7: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")));
}
Element\Editlock::lock($this->getParam("id"), "document");
$folder = Document\Folder::getById($this->getParam("id"));
$folder->idPath = Element\Service::getIdPath($folder);
$folder->userPermissions = $folder->getUserPermissions();
$folder->setLocked($folder->isLocked());
$folder->setParent(null);
$this->minimizeProperties($folder);
if ($folder->isAllowed("view")) {
$this->_helper->json($folder);
}
$this->_helper->json(false);
}
示例8: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")));
}
Element\Editlock::lock($this->getParam("id"), "document");
$email = Document\Email::getById($this->getParam("id"));
$email = $this->getLatestVersion($email);
$email->setVersions(array_splice($email->getVersions(), 0, 1));
$email->idPath = Element\Service::getIdPath($email);
$email->userPermissions = $email->getUserPermissions();
$email->setLocked($email->isLocked());
$email->setParent(null);
// unset useless data
$email->setElements(null);
$email->childs = null;
// cleanup properties
$this->minimizeProperties($email);
if ($email->isAllowed("view")) {
$this->_helper->json($email);
}
$this->_helper->json(false);
}
示例9: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (\Pimcore\Model\Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => \Pimcore\Model\Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
\Pimcore\Model\Element\Editlock::lock($this->getParam("id"), "document");
$page = Document\Printpage::getById($this->getParam("id"));
$page = $this->getLatestVersion($page);
$page->getVersions();
$page->getScheduledTasks();
$page->idPath = Service::getIdPath($page);
$page->userPermissions = $page->getUserPermissions();
$page->setLocked($page->isLocked());
// unset useless data
$page->setElements(null);
$page->childs = null;
// cleanup properties
$this->minimizeProperties($page);
if ($page->isAllowed("view")) {
$this->_helper->json($page);
}
$this->_helper->json(false);
}
示例10: getFolderAction
public function getFolderAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "object")) {
$this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "object")));
}
Element\Editlock::lock($this->getParam("id"), "object");
$object = Object::getById(intval($this->getParam("id")));
if ($object->isAllowed("view")) {
$objectData = array();
$objectData["general"] = array();
$objectData["idPath"] = Element\Service::getIdPath($object);
$allowedKeys = array("o_published", "o_key", "o_id", "o_type", "o_path", "o_modificationDate", "o_creationDate", "o_userOwner", "o_userModification");
foreach (get_object_vars($object) as $key => $value) {
if (strstr($key, "o_") && in_array($key, $allowedKeys)) {
$objectData["general"][$key] = $value;
}
}
$objectData["general"]["fullpath"] = $object->getFullPath();
$objectData["general"]["o_locked"] = $object->isLocked();
$objectData["properties"] = Element\Service::minimizePropertiesForEditmode($object->getProperties());
$objectData["userPermissions"] = $object->getUserPermissions();
$objectData["classes"] = $object->getDao()->getClasses();
// grid-config
$configFile = PIMCORE_CONFIGURATION_DIRECTORY . "/object/grid/" . $object->getId() . "-user_" . $this->getUser()->getId() . ".psf";
if (is_file($configFile)) {
$gridConfig = Tool\Serialize::unserialize(file_get_contents($configFile));
if ($gridConfig) {
$objectData["selectedClass"] = $gridConfig["classId"];
}
}
$this->_helper->json($objectData);
} else {
\Logger::debug("prevented getting folder id [ " . $object->getId() . " ] because of missing permissions");
$this->_helper->json(array("success" => false, "message" => "missing_permission"));
}
}
示例11: gridObjectData
/**
* @param AbstractObject $object
* @return array
*/
public static function gridObjectData($object, $fields = null)
{
$localizedPermissionsResolved = false;
$data = Element\Service::gridElementData($object);
if ($object instanceof Concrete) {
$data["classname"] = $object->getClassName();
$data["idPath"] = Element\Service::getIdPath($object);
$data['inheritedFields'] = array();
$user = AdminTool::getCurrentUser();
//TODO keep this for later!
// if (!$user->isAdmin()) {
// $permissionSet = $object->getPermissions(null, $user);
// $fieldPermissions = self::getFieldPermissions($object, $permissionSet);
// }
if (empty($fields)) {
$fields = array_keys($object->getclass()->getFieldDefinitions());
}
foreach ($fields as $key) {
$brickType = null;
$brickGetter = null;
$dataKey = $key;
$keyParts = explode("~", $key);
$def = $object->getClass()->getFieldDefinition($key);
if (substr($key, 0, 1) == "~") {
$type = $keyParts[1];
if ($type == "keyvalue") {
$field = $keyParts[2];
$keyid = $keyParts[3];
$getter = "get" . ucfirst($field);
if (method_exists($object, $getter)) {
$keyValuePairs = $object->{$getter}();
if ($keyValuePairs) {
// get with inheritance
$props = $keyValuePairs->getProperties();
foreach ($props as $pair) {
if ($pair["key"] == $keyid) {
if (isset($pair["translated"])) {
if (isset($data['#kv-tr'][$dataKey])) {
if (!is_array($data['#kv-tr'][$dataKey])) {
$arr = array($data['#kv-tr'][$dataKey]);
$data['#kv-tr'][$dataKey] = $arr;
}
$data['#kv-tr'][$dataKey][] = $pair["translated"];
} else {
$data['#kv-tr'][$dataKey] = $pair["translated"];
}
}
if (isset($data[$dataKey])) {
if (!is_array($data[$dataKey])) {
$arr = array($data[$dataKey]);
$data[$dataKey] = $arr;
}
$data[$dataKey][] = $pair["value"];
} else {
$data[$dataKey] = $pair["value"];
}
if ($pair["inherited"]) {
$data['inheritedFields'][$dataKey] = array("inherited" => $pair["inherited"], "objectid" => $pair["source"]);
}
// break;
}
}
}
}
}
} else {
if (count($keyParts) > 1) {
// brick
$brickType = $keyParts[0];
$brickKey = $keyParts[1];
$key = self::getFieldForBrickType($object->getclass(), $brickType);
$brickClass = Objectbrick\Definition::getByKey($brickType);
$def = $brickClass->getFieldDefinition($brickKey);
}
}
if (!empty($key)) {
// some of the not editable field require a special response
$getter = "get" . ucfirst($key);
$brickGetter = null;
if (!empty($brickKey)) {
$brickGetter = "get" . ucfirst($brickKey);
}
$needLocalizedPermissions = false;
// if the definition is not set try to get the definition from localized fields
if (!$def) {
if ($locFields = $object->getClass()->getFieldDefinition("localizedfields")) {
$def = $locFields->getFieldDefinition($key);
if ($def) {
$needLocalizedPermissions = true;
}
}
}
//relation type fields with remote owner do not have a getter
if (method_exists($object, $getter)) {
//system columns must not be inherited
if (in_array($key, Concrete::$systemColumnNames)) {
//.........这里部分代码省略.........
示例12: typePathAction
public function typePathAction()
{
$id = $this->getParam("id");
$type = $this->getParam("type");
$data = [];
if ($type == "asset") {
$element = Asset::getById($id);
} elseif ($type == "document") {
$element = Document::getById($id);
$data["index"] = $element->getIndex();
} else {
$element = Object::getById($id);
}
$typePath = Element\Service::getTypePath($element);
$data["success"] = true;
$data["idPath"] = Element\Service::getIdPath($element);
$data["typePath"] = $typePath;
$data["fullpath"] = $element->getRealFullPath();
$this->_helper->json($data);
}
示例13: gridProxyAction
//.........这里部分代码省略.........
$orderKey = "id";
$order = "ASC";
if ($this->getParam("limit")) {
$limit = $this->getParam("limit");
}
if ($this->getParam("start")) {
$start = $this->getParam("start");
}
if ($this->getParam("dir")) {
$order = $this->getParam("dir");
}
if ($this->getParam("sort")) {
$orderKey = $this->getParam("sort");
if ($orderKey == "fullpath") {
$orderKey = array("path", "filename");
}
}
$conditionFilters = array();
if ($this->getParam("only_direct_children") == "true") {
$conditionFilters[] = "parentId = " . $folder->getId();
} else {
$conditionFilters[] = "path LIKE '" . ($folder->getFullPath() == "/" ? "/%'" : $folder->getFullPath() . "/%'");
}
$conditionFilters[] = "type != 'folder'";
$filterJson = $this->getParam("filter");
if ($filterJson) {
$filters = \Zend_Json::decode($filterJson);
foreach ($filters as $filter) {
$operator = "=";
if ($filter["type"] == "string") {
$operator = "LIKE";
} else {
if ($filter["type"] == "numeric") {
if ($filter["comparison"] == "lt") {
$operator = "<";
} else {
if ($filter["comparison"] == "gt") {
$operator = ">";
} else {
if ($filter["comparison"] == "eq") {
$operator = "=";
}
}
}
} else {
if ($filter["type"] == "date") {
if ($filter["comparison"] == "lt") {
$operator = "<";
} else {
if ($filter["comparison"] == "gt") {
$operator = ">";
} else {
if ($filter["comparison"] == "eq") {
$operator = "=";
}
}
}
$filter["value"] = strtotime($filter["value"]);
} else {
if ($filter["type"] == "list") {
$operator = "=";
} else {
if ($filter["type"] == "boolean") {
$operator = "=";
$filter["value"] = (int) $filter["value"];
}
}
}
}
}
// system field
$value = $filter["value"];
if ($operator == "LIKE") {
$value = "%" . $value . "%";
}
$field = "`" . $filter["field"] . "` ";
if ($filter["field"] == "fullpath") {
$field = "CONCAT(path,filename)";
}
$conditionFilters[] = $field . $operator . " " . $db->quote($value);
}
}
$list = new Asset\Listing();
$condition = implode(" AND ", $conditionFilters);
$list->setCondition($condition);
$list->setLimit($limit);
$list->setOffset($start);
$list->setOrder($order);
$list->setOrderKey($orderKey);
$list->load();
$assets = array();
foreach ($list->getAssets() as $asset) {
/** @var $asset Asset */
$filename = PIMCORE_ASSET_DIRECTORY . "/" . $asset->getFullPath();
$size = filesize($filename);
$assets[] = array("id" => $asset->getid(), "type" => $asset->getType(), "fullpath" => $asset->getFullPath(), "creationDate" => $asset->getCreationDate(), "modificationDate" => $asset->getModificationDate(), "size" => formatBytes($size), "idPath" => $data["idPath"] = Element\Service::getIdPath($asset));
}
$this->_helper->json(array("data" => $assets, "success" => true, "total" => $list->getTotalCount()));
}
}