当前位置: 首页>>代码示例>>PHP>>正文


PHP Object\AbstractObject类代码示例

本文整理汇总了PHP中Pimcore\Model\Object\AbstractObject的典型用法代码示例。如果您正苦于以下问题:PHP AbstractObject类的具体用法?PHP AbstractObject怎么用?PHP AbstractObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AbstractObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: allowObjectRelation

 /**
  *
  * Checks if an object is an allowed relation
  * @param Model\Object\AbstractObject $object
  * @return boolean
  */
 protected function allowObjectRelation($object)
 {
     $allowedClasses = $this->getClasses();
     $allowed = true;
     if (!$this->getObjectsAllowed()) {
         $allowed = false;
     } elseif ($this->getObjectsAllowed() and is_array($allowedClasses) and count($allowedClasses) > 0) {
         //check for allowed classes
         if ($object instanceof Object\Concrete) {
             $classname = $object->getClassName();
             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\AbstractObject) {
         \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;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:36,代码来源:AbstractRelations.php

示例2: preGetValue

 /**
  * enables inheritance for field collections, if xxxInheritance field is available and set to string 'true'
  *
  * @param string $key
  * @return mixed|\Pimcore\Model\Object\Fieldcollection
  */
 public function preGetValue($key)
 {
     if ($this->getClass()->getAllowInherit() && \Pimcore\Model\Object\AbstractObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition($key) instanceof \Pimcore\Model\Object\ClassDefinition\Data\Fieldcollections) {
         $checkInheritanceKey = $key . "Inheritance";
         if ($this->{'get' . $checkInheritanceKey}() == "true") {
             $parentValue = $this->getValueFromParent($key);
             $data = $this->{$key};
             if (!$data) {
                 $data = $this->getClass()->getFieldDefinition($key)->preGetData($this);
             }
             if (!$data) {
                 return $parentValue;
             } else {
                 if (!empty($parentValue)) {
                     $value = new \Pimcore\Model\Object\Fieldcollection($parentValue->getItems());
                     if (!empty($data)) {
                         foreach ($data as $entry) {
                             $value->add($entry);
                         }
                     }
                 } else {
                     $value = new \Pimcore\Model\Object\Fieldcollection($data->getItems());
                 }
                 return $value;
             }
         }
     }
     return parent::preGetValue($key);
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:35,代码来源:AbstractFilterDefinition.php

示例3: getById

 /**
  * @static
  * @param int $id
  * @return null|\Pimcore\Model\Object\AbstractObject
  */
 public static function getById($id)
 {
     $object = \Pimcore\Model\Object\AbstractObject::getById($id);
     if ($object instanceof OnlineShop_Framework_AbstractCategory) {
         return $object;
     }
     return null;
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:13,代码来源:AbstractCategory.php

示例4: getProduct

 /**
  * @return OnlineShop_Framework_ProductInterfaces_ICheckoutable
  */
 public function getProduct()
 {
     if ($this->product) {
         return $this->product;
     }
     $this->product = \Pimcore\Model\Object\AbstractObject::getById($this->productId);
     return $this->product;
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:11,代码来源:AbstractCartItem.php

示例5: getCoreShopDimensionSize

 /**
 * @return \Pimcore\Model\Object\Objectbrick\Data\CoreShopDimensionSize
 */
 public function getCoreShopDimensionSize()
 {
     if (!$this->CoreShopDimensionSize && \Pimcore\Model\Object\AbstractObject::doGetInheritedValues($this->getObject())) {
         $brick = $this->getObject()->getValueFromParent("dimensions");
         if (!empty($brick)) {
             return $this->getObject()->getValueFromParent("dimensions")->getCoreShopDimensionSize();
         }
     }
     return $this->CoreShopDimensionSize;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:13,代码来源:Dimensions.php

示例6: getGroupByValuesForFilterGroup

 /**
  * returns all possible group by values for given column group, product list and field combination
  *
  * @param $columnGroup
  * @param OnlineShop_Framework_IProductList $productList
  * @param string $field
  * @return array
  */
 public static function getGroupByValuesForFilterGroup($columnGroup, OnlineShop_Framework_IProductList $productList, $field)
 {
     $columnType = self::getColumnTypeForColumnGroup($columnGroup);
     $data = array();
     if ($columnType == "relation") {
         $productList->prepareGroupByRelationValues($field);
         $values = $productList->getGroupByRelationValues($field);
         foreach ($values as $v) {
             $obj = \Pimcore\Model\Object\AbstractObject::getById($v);
             if ($obj) {
                 $name = $obj->getKey();
                 if (method_exists($obj, "getName")) {
                     $name = $obj->getName();
                 }
                 $data[$v] = array("key" => $v, "value" => $name . " (" . $obj->getId() . ")");
             }
         }
     } else {
         if ($columnType == "multiselect") {
             $values = $productList->getGroupByValues($field);
             sort($values);
             foreach ($values as $v) {
                 $helper = explode(OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER, $v);
                 foreach ($helper as $h) {
                     $data[$h] = array("key" => $h, "value" => $h);
                 }
             }
         } else {
             if ($columnType == "category") {
                 $values = $productList->getGroupByValues($field);
                 foreach ($values as $v) {
                     $helper = explode(",", $v);
                     foreach ($helper as $h) {
                         $obj = \Pimcore\Model\Object\AbstractObject::getById($h);
                         if ($obj) {
                             $name = $obj->getKey();
                             if (method_exists($obj, "getName")) {
                                 $name = $obj->getName();
                             }
                             $data[$h] = array("key" => $h, "value" => $name . " (" . $obj->getId() . ")");
                         }
                     }
                 }
             } else {
                 $values = $productList->getGroupByValues($field);
                 sort($values);
                 foreach ($values as $v) {
                     $data[] = array("key" => $v, "value" => $v);
                 }
             }
         }
     }
     return $data;
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:62,代码来源:FilterGroupHelper.php

示例7: __call

 /**
  * @param $method
  * @param $args
  *
  * @return mixed
  * @throws \Exception
  */
 public function __call($method, $args)
 {
     $field = substr($method, 3);
     if (substr($method, 0, 3) == 'get' && array_key_exists($field, $this->resultRow)) {
         return $this->resultRow[$field];
     }
     $object = \Pimcore\Model\Object\AbstractObject::getById($this->getId());
     if ($object) {
         return call_user_func_array(array($object, $method), $args);
     } else {
         throw new \Exception("Object with {$this->getId()} not found.");
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:20,代码来源:Item.php

示例8: getById

 /**
  * @param $id
  * @throws \Exception
  */
 public function getById($id)
 {
     $data = $this->db->fetchRow("SELECT * FROM notes WHERE id = ?", $id);
     if (!$data["id"]) {
         throw new \Exception("Note item with id " . $id . " not found");
     }
     $this->assignVariablesToModel($data);
     // get key-value data
     $keyValues = $this->db->fetchAll("SELECT * FROM notes_data WHERE id = ?", $id);
     $preparedData = array();
     foreach ($keyValues as $keyValue) {
         $data = $keyValue["data"];
         $type = $keyValue["type"];
         $name = $keyValue["name"];
         if ($type == "document") {
             if ($data) {
                 $data = Document::getById($data);
             }
         } else {
             if ($type == "asset") {
                 if ($data) {
                     $data = Asset::getById($data);
                 }
             } else {
                 if ($type == "object") {
                     if ($data) {
                         $data = Object\AbstractObject::getById($data);
                     }
                 } else {
                     if ($type == "date") {
                         if ($data > 0) {
                             $data = new \Zend_Date($data);
                         }
                     } else {
                         if ($type == "bool") {
                             $data = (bool) $data;
                         }
                     }
                 }
             }
         }
         $preparedData[$name] = array("data" => $data, "type" => $type);
     }
     $this->model->setData($preparedData);
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:49,代码来源:Dao.php

示例9: makeParticipation

 /**
  * @return AbstractObject|\Pimcore\Model\Object\Participation
  * @throws \Exception
  */
 public function makeParticipation()
 {
     $objectFolderPath = Plugin::getConfig()->get(Plugin::CONFIG_OBJECTFOLDERPATH);
     $objectFolder = AbstractObject::getByPath($objectFolderPath);
     if (!$objectFolder instanceof Folder) {
         throw new \Exception("Error: objectFolderPath [{$objectFolderPath}] " . "is not a valid object folder.");
     }
     // create basic object stuff
     $key = $this->createParticipationKey();
     $participation = new Participation();
     $participation->setKey($key);
     $participation->setParent($objectFolder);
     $participation->setPublished(true);
     $participation->setCreationDate(time());
     $participation->SetIpCreated($_SERVER['REMOTE_ADDR']);
     $confirmation = $this->makeConfirmation();
     $participation->setConfirmationCode($confirmation->createCode());
     return $participation;
 }
开发者ID:basilicom,项目名称:pimcore-plugin-participation,代码行数:23,代码来源:Manager.php

示例10: getFilterFrontend

 public function getFilterFrontend(OnlineShop_Framework_AbstractFilterDefinitionType $filterDefinition, OnlineShop_Framework_IProductList $productList, $currentFilter)
 {
     $field = $this->getField($filterDefinition);
     $values = $productList->getGroupByRelationValues($field, true);
     $objects = array();
     Logger::log("Load Objects...", Zend_Log::INFO);
     $availableRelations = array();
     if ($filterDefinition->getAvailableRelations()) {
         $availableRelations = $this->loadAllAvailableRelations($filterDefinition->getAvailableRelations());
     }
     foreach ($values as $v) {
         if (empty($availableRelations) || $availableRelations[$v['value']] === true) {
             $objects[$v['value']] = \Pimcore\Model\Object\AbstractObject::getById($v['value']);
         }
     }
     Logger::log("done.", Zend_Log::INFO);
     if ($filterDefinition->getScriptPath()) {
         $script = $filterDefinition->getScriptPath();
     } else {
         $script = $this->script;
     }
     return $this->view->partial($script, array("hideFilter" => $filterDefinition->getRequiredFilterField() && empty($currentFilter[$filterDefinition->getRequiredFilterField()]), "label" => $filterDefinition->getLabel(), "currentValue" => $currentFilter[$field], "values" => $values, "objects" => $objects, "fieldname" => $field, "metaData" => $filterDefinition->getMetaData()));
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:23,代码来源:SelectRelation.php

示例11: save

 /**
  *
  */
 public function save()
 {
     $this->delete(false);
     $object = $this->model->getObject();
     $validLanguages = Tool::getValidLanguages();
     $context = $this->model->getContext();
     if ($context && $context["containerType"] == "fieldcollection") {
         $containerKey = $context["containerKey"];
         $container = Object\Fieldcollection\Definition::getByKey($containerKey);
     } else {
         $container = $this->model->getClass();
     }
     $fieldDefinitions = $container->getFielddefinition("localizedfields")->getFielddefinitions();
     foreach ($validLanguages as $language) {
         $inheritedValues = Object\AbstractObject::doGetInheritedValues();
         Object\AbstractObject::setGetInheritedValues(false);
         $insertData = ["ooo_id" => $this->model->getObject()->getId(), "language" => $language];
         if ($container instanceof Object\Fieldcollection\Definition) {
             $insertData["fieldname"] = $context["fieldname"];
             $insertData["index"] = $context["index"];
         }
         foreach ($fieldDefinitions as $fd) {
             if (method_exists($fd, "save")) {
                 // for fieldtypes which have their own save algorithm eg. objects, multihref, ...
                 $context = $this->model->getContext() ? $this->model->getContext() : [];
                 if ($context["containerType"] == "fieldcollection") {
                     $context["subContainerType"] = "localizedfield";
                 }
                 $childParams = ["context" => $context, "language" => $language];
                 $fd->save($this->model, $childParams);
             } else {
                 if (is_array($fd->getColumnType())) {
                     $insertDataArray = $fd->getDataForResource($this->model->getLocalizedValue($fd->getName(), $language, true), $object);
                     $insertData = array_merge($insertData, $insertDataArray);
                 } else {
                     $insertData[$fd->getName()] = $fd->getDataForResource($this->model->getLocalizedValue($fd->getName(), $language, true), $object);
                 }
             }
         }
         $storeTable = $this->getTableName();
         $queryTable = $this->getQueryTableName() . "_" . $language;
         $this->db->insertOrUpdate($storeTable, $insertData);
         if ($container instanceof Object\ClassDefinition) {
             // query table
             $data = [];
             $data["ooo_id"] = $this->model->getObject()->getId();
             $data["language"] = $language;
             $this->inheritanceHelper = new Object\Concrete\Dao\InheritanceHelper($object->getClassId(), "ooo_id", $storeTable, $queryTable);
             $this->inheritanceHelper->resetFieldsToCheck();
             $sql = "SELECT * FROM " . $queryTable . " WHERE ooo_id = " . $object->getId() . " AND language = '" . $language . "'";
             $oldData = [];
             try {
                 $oldData = $this->db->fetchRow($sql);
             } catch (\Exception $e) {
                 // if the table doesn't exist -> create it!
                 if (strpos($e->getMessage(), "exist")) {
                     // the following is to ensure consistent data and atomic transactions, while having the flexibility
                     // to add new languages on the fly without saving all classes having localized fields
                     // first we need to roll back all modifications, because otherwise they would be implicitly committed
                     // by the following DDL
                     $this->db->rollBack();
                     // this creates the missing table
                     $this->createUpdateTable();
                     // at this point we throw an exception so that the transaction gets repeated in Object::save()
                     throw new \Exception("missing table created, start next run ... ;-)");
                 }
             }
             // get fields which shouldn't be updated
             $untouchable = [];
             // @TODO: currently we do not support lazyloading in localized fields
             $inheritanceEnabled = $object->getClass()->getAllowInherit();
             $parentData = null;
             if ($inheritanceEnabled) {
                 // get the next suitable parent for inheritance
                 $parentForInheritance = $object->getNextParentForInheritance();
                 if ($parentForInheritance) {
                     // we don't use the getter (built in functionality to get inherited values) because we need to avoid race conditions
                     // we cannot Object\AbstractObject::setGetInheritedValues(true); and then $this->model->getLocalizedValue($key, $language)
                     // so we select the data from the parent object using FOR UPDATE, which causes a lock on this row
                     // so the data of the parent cannot be changed while this transaction is on progress
                     $parentData = $this->db->fetchRow("SELECT * FROM " . $queryTable . " WHERE ooo_id = ? AND language = ? FOR UPDATE", [$parentForInheritance->getId(), $language]);
                 }
             }
             foreach ($fieldDefinitions as $fd) {
                 if ($fd->getQueryColumnType()) {
                     $key = $fd->getName();
                     // exclude untouchables if value is not an array - this means data has not been loaded
                     if (!(in_array($key, $untouchable) and !is_array($this->model->{$key}))) {
                         $localizedValue = $this->model->getLocalizedValue($key, $language);
                         $insertData = $fd->getDataForQueryResource($localizedValue, $object);
                         $isEmpty = $fd->isEmpty($localizedValue);
                         if (is_array($insertData)) {
                             $columnNames = array_keys($insertData);
                             $data = array_merge($data, $insertData);
                         } else {
                             $columnNames = [$key];
                             $data[$key] = $insertData;
//.........这里部分代码省略.........
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:Dao.php

示例12: preGetData

 /**
  * @param $object
  * @param array $params
  * @return null|Object\Fieldcollection\Data\Object\Concrete|Object\Objectbrick\Data\
  */
 public function preGetData($object, $params = array())
 {
     $data = null;
     if ($object instanceof Object\Concrete) {
         $data = $object->{$this->getName()};
         if ($this->getLazyLoading() and !in_array($this->getName(), $object->getO__loadedLazyFields())) {
             $data = $this->load($object, array("force" => true));
             $setter = "set" . ucfirst($this->getName());
             if (method_exists($object, $setter)) {
                 $object->{$setter}($data);
             }
         }
     } else {
         if ($object instanceof Object\Localizedfield) {
             $data = $params["data"];
         } else {
             if ($object instanceof Object\Fieldcollection\Data\AbstractData) {
                 $data = $object->{$this->getName()};
             } else {
                 if ($object instanceof Object\Objectbrick\Data\AbstractData) {
                     $data = $object->{$this->getName()};
                 }
             }
         }
     }
     if (Object\AbstractObject::doHideUnpublished() and $data instanceof Element\ElementInterface) {
         if (!Element\Service::isPublished($data)) {
             return null;
         }
     }
     return $data;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:37,代码来源:Href.php

示例13: save

 /**
  * @param Object\Concrete $object
  * @throws \Exception
  */
 public function save(Object\Concrete $object)
 {
     // HACK: set the pimcore admin mode to false to get the inherited values from parent if this source one is empty
     $inheritedValues = Object\AbstractObject::doGetInheritedValues();
     $storetable = $this->model->getDefinition()->getTableName($object->getClass(), false);
     $querytable = $this->model->getDefinition()->getTableName($object->getClass(), true);
     $this->inheritanceHelper = new Object\Concrete\Dao\InheritanceHelper($object->getClassId(), "o_id", $storetable, $querytable);
     Object\AbstractObject::setGetInheritedValues(false);
     $fieldDefinitions = $this->model->getDefinition()->getFieldDefinitions();
     $data = [];
     $data["o_id"] = $object->getId();
     $data["fieldname"] = $this->model->getFieldname();
     // remove all relations
     try {
         $this->db->delete("object_relations_" . $object->getClassId(), "src_id = " . $object->getId() . " AND ownertype = 'objectbrick' AND ownername = '" . $this->model->getFieldname() . "' AND (position = '" . $this->model->getType() . "' OR position IS NULL OR position = '')");
     } catch (\Exception $e) {
         Logger::warning("Error during removing old relations: " . $e);
     }
     foreach ($fieldDefinitions as $key => $fd) {
         $getter = "get" . ucfirst($fd->getName());
         if (method_exists($fd, "save")) {
             // for fieldtypes which have their own save algorithm eg. objects, multihref, ...
             $fd->save($this->model);
         } elseif ($fd->getColumnType()) {
             if (is_array($fd->getColumnType())) {
                 $insertDataArray = $fd->getDataForResource($this->model->{$getter}(), $object, ['context' => $this->model]);
                 $data = array_merge($data, $insertDataArray);
             } else {
                 $insertData = $fd->getDataForResource($this->model->{$getter}(), $object, ['context' => $this->model]);
                 $data[$key] = $insertData;
             }
         }
     }
     $this->db->insertOrUpdate($storetable, $data);
     // get data for query table
     // $tableName = $this->model->getDefinition()->getTableName($object->getClass(), true);
     // this is special because we have to call each getter to get the inherited values from a possible parent object
     $data = [];
     $data["o_id"] = $object->getId();
     $data["fieldname"] = $this->model->getFieldname();
     $this->inheritanceHelper->resetFieldsToCheck();
     $oldData = $this->db->fetchRow("SELECT * FROM " . $querytable . " WHERE o_id = ?", $object->getId());
     $inheritanceEnabled = $object->getClass()->getAllowInherit();
     $parentData = null;
     if ($inheritanceEnabled) {
         // get the next suitable parent for inheritance
         $parentForInheritance = $object->getNextParentForInheritance();
         if ($parentForInheritance) {
             // we don't use the getter (built in functionality to get inherited values) because we need to avoid race conditions
             // we cannot Object\AbstractObject::setGetInheritedValues(true); and then $this->model->$method();
             // so we select the data from the parent object using FOR UPDATE, which causes a lock on this row
             // so the data of the parent cannot be changed while this transaction is on progress
             $parentData = $this->db->fetchRow("SELECT * FROM " . $querytable . " WHERE o_id = ? FOR UPDATE", $parentForInheritance->getId());
         }
     }
     foreach ($fieldDefinitions as $key => $fd) {
         if ($fd->getQueryColumnType()) {
             //exclude untouchables if value is not an array - this means data has not been loaded
             $method = "get" . $key;
             $fieldValue = $this->model->{$method}();
             $insertData = $fd->getDataForQueryResource($fieldValue, $object);
             $isEmpty = $fd->isEmpty($fieldValue);
             if (is_array($insertData)) {
                 $columnNames = array_keys($insertData);
                 $data = array_merge($data, $insertData);
             } else {
                 $columnNames = [$key];
                 $data[$key] = $insertData;
             }
             // if the current value is empty and we have data from the parent, we just use it
             if ($isEmpty && $parentData) {
                 foreach ($columnNames as $columnName) {
                     if (array_key_exists($columnName, $parentData)) {
                         $data[$columnName] = $parentData[$columnName];
                         if (is_array($insertData)) {
                             $insertData[$columnName] = $parentData[$columnName];
                         } else {
                             $insertData = $parentData[$columnName];
                         }
                     }
                 }
             }
             if ($inheritanceEnabled) {
                 //get changed fields for inheritance
                 if ($fd instanceof Object\ClassDefinition\Data\CalculatedValue) {
                     // nothing to do, see https://github.com/pimcore/pimcore/issues/727
                     continue;
                 } elseif ($fd->isRelationType()) {
                     if (is_array($insertData)) {
                         $doInsert = false;
                         foreach ($insertData as $insertDataKey => $insertDataValue) {
                             if ($isEmpty && $oldData[$insertDataKey] == $parentData[$insertDataKey]) {
                                 // do nothing, ... value is still empty and parent data is equal to current data in query table
                             } elseif ($oldData[$insertDataKey] != $insertDataValue) {
                                 $doInsert = true;
                                 break;
//.........这里部分代码省略.........
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:Dao.php

示例14: init

 /**
  * @throws \Zend_Controller_Router_Exception
  */
 public function init()
 {
     // this is only executed once per request (first request)
     if (self::$isInitial) {
         \Pimcore::getEventManager()->trigger("frontend.controller.preInit", $this);
     }
     parent::init();
     // log exceptions if handled by error_handler
     $this->checkForErrors();
     // general definitions
     if (self::$isInitial) {
         \Pimcore::unsetAdminMode();
         Document::setHideUnpublished(true);
         Object\AbstractObject::setHideUnpublished(true);
         Object\AbstractObject::setGetInheritedValues(true);
         Object\Localizedfield::setGetFallbackValues(true);
     }
     // assign variables
     $this->view->controller = $this;
     // init website config
     $config = Config::getWebsiteConfig();
     $this->config = $config;
     $this->view->config = $config;
     $document = $this->getParam("document");
     if (!$document instanceof Document) {
         \Zend_Registry::set("pimcore_editmode", false);
         $this->editmode = false;
         $this->view->editmode = false;
         self::$isInitial = false;
         // check for a locale first, and set it if available
         if ($this->getParam("pimcore_parentDocument")) {
             // this is a special exception for renderlets in editmode (ajax request), because they depend on the locale of the parent document
             // otherwise there'll be notices like:  Notice: 'No translation for the language 'XX' available.'
             if ($parentDocument = Document::getById($this->getParam("pimcore_parentDocument"))) {
                 if ($parentDocument->getProperty("language")) {
                     $this->setLocaleFromDocument($parentDocument->getProperty("language"));
                 }
             }
         }
         // no document available, continue, ...
         return;
     } else {
         $this->setDocument($document);
         // register global locale if the document has the system property "language"
         if ($this->getDocument()->getProperty("language")) {
             $this->setLocaleFromDocument($this->getDocument()->getProperty("language"));
         }
         if (self::$isInitial) {
             // append meta-data to the headMeta() view helper,  if it is a document-request
             if (!Model\Staticroute::getCurrentRoute() && $this->getDocument() instanceof Document\Page) {
                 if (is_array($this->getDocument()->getMetaData())) {
                     foreach ($this->getDocument()->getMetaData() as $meta) {
                         // only name
                         if (!empty($meta["idName"]) && !empty($meta["idValue"]) && !empty($meta["contentValue"])) {
                             $method = "append" . ucfirst($meta["idName"]);
                             $this->view->headMeta()->{$method}($meta["idValue"], $meta["contentValue"]);
                         }
                     }
                 }
             }
         }
     }
     // this is only executed once per request (first request)
     if (self::$isInitial) {
         // contains the logged in user if necessary
         $user = null;
         // default is to set the editmode to false, is enabled later if necessary
         \Zend_Registry::set("pimcore_editmode", false);
         if (Tool::isFrontentRequestByAdmin()) {
             $this->disableBrowserCache();
             // start admin session & get logged in user
             $user = Authentication::authenticateSession();
         }
         if (\Pimcore::inDebugMode()) {
             $this->disableBrowserCache();
         }
         if (!$this->document->isPublished()) {
             if (Tool::isFrontentRequestByAdmin()) {
                 if (!$user) {
                     throw new \Zend_Controller_Router_Exception("access denied for " . $this->document->getFullPath());
                 }
             } else {
                 throw new \Zend_Controller_Router_Exception("access denied for " . $this->document->getFullPath());
             }
         }
         // logged in users only
         if ($user) {
             // set the user to registry so that it is available via \Pimcore\Tool\Admin::getCurrentUser();
             \Zend_Registry::set("pimcore_admin_user", $user);
             // document editmode
             if ($this->getParam("pimcore_editmode")) {
                 \Zend_Registry::set("pimcore_editmode", true);
                 // check if there is the document in the session
                 $docKey = "document_" . $this->getDocument()->getId();
                 $docSession = Session::getReadOnly("pimcore_documents");
                 if ($docSession->{$docKey}) {
                     // if there is a document in the session use it
//.........这里部分代码省略.........
开发者ID:tododo,项目名称:pimcore,代码行数:101,代码来源:Frontend.php

示例15: csvObjectData

 /**
  * Flattens object data to an array with key=>value where
  * value is simply a string representation of the value (for objects, hrefs and assets the full path is used)
  *
  * @param Object\AbstractObject $object
  * @return array
  */
 protected function csvObjectData($object)
 {
     $o = array();
     foreach ($object->getClass()->getFieldDefinitions() as $key => $value) {
         //exclude remote owner fields
         if (!($value instanceof Object\ClassDefinition\Data\Relations\AbstractRelations and $value->isRemoteOwner())) {
             $o[$key] = $value->getForCsvExport($object);
         }
     }
     $o["id (system)"] = $object->getId();
     $o["key (system)"] = $object->getKey();
     $o["fullpath (system)"] = $object->getFullPath();
     $o["published (system)"] = $object->isPublished();
     $o["type (system)"] = $object->getType();
     return $o;
 }
开发者ID:cannonerd,项目名称:pimcore,代码行数:23,代码来源:ObjectHelperController.php


注:本文中的Pimcore\Model\Object\AbstractObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。