本文整理汇总了PHP中Object_Abstract::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Object_Abstract::getId方法的具体用法?PHP Object_Abstract::getId怎么用?PHP Object_Abstract::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object_Abstract
的用法示例。
在下文中一共展示了Object_Abstract::getId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDependencyForFrontend
/**
* @param Document|Asset|Object_Abstract $element
* @return array
*/
public static function getDependencyForFrontend($element)
{
if ($element instanceof Document) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "document", "subtype" => $element->getType());
} else {
if ($element instanceof Asset) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "asset", "subtype" => $element->getType());
} else {
if ($element instanceof Object_Abstract) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "object", "subtype" => $element->geto_Type());
}
}
}
}
示例2: exportObject
private static function exportObject(Object_Abstract $object, $key = null)
{
if ($object->getId() !== self::ROOT_ID) {
$objectData = array();
$objectClass = get_class($object);
$objectData['class'] = $objectClass;
if ($objectClass != 'Object_Folder') {
foreach ($object->getClass()->getFieldDefinitions() as $field) {
$property = ucfirst($field->getName());
$fieldtype = $field->getFieldtype();
$value = $object->{'get' . $property}();
$objectData[$property] = PimPon_Object_Encoder::encode($value, $fieldtype);
}
}
foreach (self::$includeMethods as $method) {
if (method_exists($object, $method) === false) {
continue;
}
$property = ucfirst(substr($method, 3));
$value = $object->{$method}();
$objectData[$property] = PimPon_Object_Encoder_Default::encode($value);
}
self::writeDataOnFile($objectData);
}
if ($object->hasChilds() === true) {
array_walk($object->getChilds(), 'PimPon_Object_Export::exportObject');
}
}
示例3: getDataForEditmode
/**
* @see Object_Class_Data::getDataForEditmode
* @param Asset|Document|Object_Abstract $data
* @param null|Object_Abstract $object
* @return array
*/
public function getDataForEditmode($data, $object = null)
{
if ($data) {
$r = array("id" => $data->getId(), "path" => $data->getFullPath());
if ($data instanceof Document) {
$r["subtype"] = $data->getType();
$r["type"] = "document";
} else {
if ($data instanceof Asset) {
$r["subtype"] = $data->getType();
$r["type"] = "asset";
} else {
if ($data instanceof Object_Abstract) {
$r["subtype"] = $data->getO_Type();
$r["type"] = "object";
}
}
}
return $r;
}
return;
}
示例4: getTreeNodeConfig
/**
* @param Object_Abstract $child
* @return array
*/
protected function getTreeNodeConfig($child)
{
$tmpObject = array("id" => $child->getId(), "text" => $child->getKey(), "type" => $child->getType(), "path" => $child->getFullPath(), "basePath" => $child->getPath(), "elementType" => "object", "locked" => $child->isLocked(), "lockOwner" => $child->getLocked() ? true : false);
$tmpObject["isTarget"] = false;
$tmpObject["allowDrop"] = false;
$tmpObject["allowChildren"] = false;
$tmpObject["leaf"] = $child->hasNoChilds();
// $tmpObject["iconCls"] = "pimcore_icon_object";
$tmpObject["isTarget"] = true;
$tmpObject["allowDrop"] = true;
$tmpObject["allowChildren"] = true;
$tmpObject["leaf"] = false;
$tmpObject["cls"] = "";
if ($child->getType() == "folder") {
// $tmpObject["iconCls"] = "pimcore_icon_folder";
$tmpObject["qtipCfg"] = array("title" => "ID: " . $child->getId());
} else {
//assemble object preview URL
$previewUrl = $child->getClass()->getPreviewUrl();
if (!empty($previewUrl)) {
$vars = get_object_vars($child);
$assembled = true;
foreach ($vars as $key => $value) {
if (!empty($value) && strpos($previewUrl, "%" . $key) !== false) {
$previewUrl = str_replace("%" . $key, urlencode($value), $previewUrl);
} else {
if (strpos($previewUrl, "%" . $key) !== false) {
$assembled = false;
break;
}
}
if ($assembled) {
$tmpObject['previewUrl'] = $previewUrl;
}
}
}
$tmpObject["published"] = $child->isPublished();
$tmpObject["className"] = $child->getClass()->getName();
$tmpObject["qtipCfg"] = array("title" => "ID: " . $child->getId(), "text" => 'Type: ' . $child->getClass()->getName());
if (!$child->isPublished()) {
$tmpObject["cls"] .= "pimcore_unpublished ";
}
// if ($child->getClass()->getIcon()) {
// unset($tmpObject["iconCls"]);
// $tmpObject["icon"] = $child->getClass()->getIcon();
// }
}
if ($child->getElementAdminStyle()->getElementIcon()) {
$tmpObject["icon"] = $child->getO_elementAdminStyle()->getElementIcon();
}
if ($child->getElementAdminStyle()->getElementIconClass()) {
$tmpObject["iconCls"] = $child->getO_elementAdminStyle()->getElementIconClass();
}
if ($child->getElementAdminStyle()->getElementCssClass()) {
$tmpObject["cls"] .= $child->getO_elementAdminStyle()->getElementCssClass() . " ";
}
$tmpObject["expanded"] = $child->hasNoChilds();
$tmpObject["permissions"] = $child->getUserPermissions($this->getUser());
if ($child->isLocked()) {
$tmpObject["cls"] .= "pimcore_treenode_locked ";
}
if ($child->getLocked()) {
$tmpObject["cls"] .= "pimcore_treenode_lockOwner ";
}
return $tmpObject;
}
示例5: getTreeNodeConfig
/**
* @param Object_Abstract $child
* @return array
*/
protected function getTreeNodeConfig($child)
{
$tmpObject = array("id" => $child->getId(), "text" => $child->getKey(), "type" => $child->getType(), "path" => $child->getFullPath(), "basePath" => $child->getPath(), "elementType" => "object", "locked" => $child->isLocked(), "lockOwner" => $child->getLocked() ? true : false);
$tmpObject["isTarget"] = false;
$tmpObject["allowDrop"] = false;
$tmpObject["allowChildren"] = false;
$tmpObject["leaf"] = $child->hasNoChilds();
// $tmpObject["iconCls"] = "pimcore_icon_object";
$tmpObject["isTarget"] = true;
$tmpObject["allowDrop"] = true;
$tmpObject["allowChildren"] = true;
$tmpObject["leaf"] = false;
$tmpObject["cls"] = "";
if ($child->getType() == "folder") {
// $tmpObject["iconCls"] = "pimcore_icon_folder";
$tmpObject["qtipCfg"] = array("title" => "ID: " . $child->getId());
} else {
$tmpObject["published"] = $child->isPublished();
$tmpObject["className"] = $child->getClass()->getName();
$tmpObject["qtipCfg"] = array("title" => "ID: " . $child->getId(), "text" => 'Type: ' . $child->getClass()->getName());
if (!$child->isPublished()) {
$tmpObject["cls"] .= "pimcore_unpublished ";
}
// if ($child->getClass()->getIcon()) {
// unset($tmpObject["iconCls"]);
// $tmpObject["icon"] = $child->getClass()->getIcon();
// }
}
if ($child->getElementAdminStyle()->getElementIcon()) {
$tmpObject["icon"] = $child->getO_elementAdminStyle()->getElementIcon();
}
if ($child->getElementAdminStyle()->getElementIconClass()) {
$tmpObject["iconCls"] = $child->getO_elementAdminStyle()->getElementIconClass();
}
if ($child->getElementAdminStyle()->getElementCssClass()) {
$tmpObject["cls"] .= $child->getO_elementAdminStyle()->getElementCssClass() . " ";
}
$tmpObject["expanded"] = $child->hasNoChilds();
$tmpObject["permissions"] = $child->getUserPermissions($this->getUser());
if ($child->isLocked()) {
$tmpObject["cls"] .= "pimcore_treenode_locked ";
}
if ($child->getLocked()) {
$tmpObject["cls"] .= "pimcore_treenode_lockOwner ";
}
return $tmpObject;
}
示例6: setO_parent
/**
* @param Object_Abstract $o_parent
* @return void
*/
public function setO_parent($o_parent)
{
$this->o_parent = $o_parent;
if ($o_parent instanceof Object_Abstract) {
$this->setParentId($o_parent->getId());
}
}
示例7: getDataForResource
/**
* @see Object_Class_Data::getDataForResource
* @param array $data
* @param null|Object_Abstract $object
* @return array
*/
public function getDataForResource($data, $object = null)
{
$return = array();
if (is_array($data) && count($data) > 0) {
$counter = 1;
foreach ($data as $object) {
if ($object instanceof Element_Interface) {
$return[] = array("dest_id" => $object->getId(), "type" => Element_Service::getElementType($object), "fieldname" => $this->getName(), "index" => $counter);
}
$counter++;
}
return $return;
} else {
if (is_array($data) and count($data) === 0) {
//give empty array if data was not null
return array();
} else {
//return null if data was null - this indicates data was not loaded
return null;
}
}
}
示例8: copyRecursive
/**
* @param Object_Abstract $target
* @param Object_Abstract $source
* @return
*/
public function copyRecursive($target, $source)
{
// avoid recursion
if (!$this->_copyRecursiveIds) {
$this->_copyRecursiveIds = array();
}
if (in_array($source->getId(), $this->_copyRecursiveIds)) {
return;
}
$source->getProperties();
//load all in case of lazy loading fields
self::loadAllObjectFields($source);
$new = clone $source;
$new->o_id = null;
$new->setChilds(null);
$new->setKey(Element_Service::getSaveCopyName("object", $new->getKey(), $target));
$new->setParentId($target->getId());
$new->setUserOwner($this->_user->getId());
$new->setUserModification($this->_user->getId());
$new->setResource(null);
$new->setLocked(false);
$new->save();
// add to store
$this->_copyRecursiveIds[] = $new->getId();
foreach ($source->getChilds() as $child) {
$this->copyRecursive($new, $child);
}
$this->updateChilds($target, $new);
return $new;
}
示例9: allowObjectRelation
/**
*
* Checks if an object is an allowed relation
* @param Object_Abstract $object
* @return boolean
*/
protected function allowObjectRelation($object)
{
$allowedClasses = $this->getClasses();
$allowed = true;
if (!$this->getObjectsAllowed()) {
$allowed = false;
} else {
if ($this->getObjectsAllowed() and is_array($allowedClasses) and count($allowedClasses) > 0) {
//check for allowed classes
if ($object instanceof Object_Concrete) {
$classname = $object->getO_className();
foreach ($allowedClasses as $c) {
$allowedClassnames[] = $c['classes'];
}
if (!in_array($classname, $allowedClassnames)) {
$allowed = false;
}
} else {
$allowed = false;
}
} else {
//don't check if no allowed classes set
}
}
if ($object instanceof Object_Abstract) {
Logger::debug("checked object relation to target object [" . $object->getId() . "] in field [" . $this->getName() . "], allowed:" . $allowed);
} else {
Logger::debug("checked object relation to target in field [" . $this->getName() . "], not allowed, target ist not an object");
Logger::debug($object);
}
return $allowed;
}