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


PHP Object_Abstract类代码示例

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


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

示例1: 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');
     }
 }
开发者ID:jv10,项目名称:pimpon,代码行数:28,代码来源:Export.php

示例2: restore

 public function restore()
 {
     $raw = file_get_contents($this->getStoreageFile());
     $element = Pimcore_Tool_Serialize::unserialize($raw);
     // check for element with the same name
     if ($element instanceof Document) {
         $indentElement = Document::getByPath($element->getFullpath());
         if ($indentElement) {
             $element->setKey($element->getKey() . "_restore");
         }
     } else {
         if ($element instanceof Asset) {
             $indentElement = Asset::getByPath($element->getFullpath());
             if ($indentElement) {
                 $element->setFilename($element->getFilename() . "_restore");
             }
         } else {
             if ($element instanceof Object_Abstract) {
                 $indentElement = Object_Abstract::getByPath($element->getFullpath());
                 if ($indentElement) {
                     $element->setKey($element->getKey() . "_restore");
                 }
             }
         }
     }
     $this->restoreChilds($element);
     $this->delete();
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:28,代码来源:Item.php

示例3: subscribeAction

 public function subscribeAction()
 {
     // init
     $status = array('message' => 'error', 'success' => false);
     $newsletter = new Pimcore_Tool_Newsletter('customer');
     $params = $this->getAllParams();
     //
     if ($newsletter->checkParams($params)) {
         try {
             $params["parent"] = Object_Abstract::getByPath("/newsletter/subscribers");
             $user = $newsletter->subscribe($params);
             // user and email document
             // parameters available in the email: gender, firstname, lastname, email, token, object
             // ==> see mailing framework
             $newsletter->sendConfirmationMail($user, Document::getByPath('/en/emails/newsletter-confirmation'));
             // do some other stuff with the new user
             //$user->setSomeCustomField(true);
             //$user->save();
             $status['success'] = true;
             $status['message'] = "";
         } catch (\Exception $e) {
             $status['message'] = $e->getMessage();
         }
     }
     // its a ajax request?
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->viewRenderer->setNoRender(true);
         $this->getResponse()->setHeader('Content-Type', 'application/json');
         echo Zend_Json::encode($status);
     } else {
         $this->view->status = $status;
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:33,代码来源:NewsletterController.php

示例4: getIdPathForElement

 /**
  * @static
  * @param  $element
  * @return string
  */
 public static function getIdPathForElement($element)
 {
     $path = "";
     if ($element instanceof Document) {
         $nid = $element->getParentId();
         $ne = Document::getById($nid);
     } else {
         if ($element instanceof Asset) {
             $nid = $element->getParentId();
             $ne = Asset::getById($nid);
         } else {
             if ($element instanceof Object_Abstract) {
                 $nid = $element->getO_parentId();
                 $ne = Object_Abstract::getById($nid);
             }
         }
     }
     if ($ne) {
         $path = self::getIdPathForElement($ne, $path);
     }
     if ($element) {
         $path = $path . "/" . $element->getId();
     }
     return $path;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:30,代码来源:Tool.php

示例5: indexAction

 public function indexAction()
 {
     // check maintenance
     $maintenance_enabled = false;
     $manager = Schedule_Manager_Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = Zend_Json::encode($maintenance_enabled);
     // configuration
     $this->view->config = Pimcore_Config::getSystemConfig();
     //mail settings
     $mailIncomplete = false;
     if ($this->view->config->email) {
         $emailSettings = $this->view->config->email->toArray();
         if ($emailSettings['method'] == "sendmail" and !empty($emailSettings['sender']['email'])) {
             $mailIncomplete = true;
         }
         if ($emailSettings['method'] == "smtp" and !empty($emailSettings['sender']['email']) and !empty($emailSettings['smtp']['host'])) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_incomplete = Zend_Json::encode($mailIncomplete);
     // report configuration
     $this->view->report_config = Pimcore_Config::getReportConfig();
     // customviews config
     $cvConfig = Pimcore_Tool::getCustomViewConfig();
     $cvData = array();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             $rootNode = Object_Abstract::getByPath($tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = explode(",", $tmpData["classes"]);
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $cvData[] = $tmpData;
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $memory_limit = filesize2bytes(ini_get("memory_limit") . "B");
     $upload_mb = min($max_upload, $max_post, $memory_limit);
     $this->view->upload_max_filesize = $upload_mb;
     // live connect
     $liveconnectToken = Pimcore_Liveconnect::getToken();
     $this->view->liveconnectToken = $liveconnectToken;
     // adding css minify filter because of IE issues with CkEditor and more than 31 stylesheets
     if (!PIMCORE_DEVMODE) {
         $front = Zend_Controller_Front::getInstance();
         $front->registerPlugin(new Pimcore_Controller_Plugin_CssMinify(), 800);
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:60,代码来源:IndexController.php

示例6: load

 /**
  * Loads a list of entries for the specicifies parameters, returns an array of Search_Backend_Data
  *
  * @return array
  */
 public function load()
 {
     $entries = array();
     $data = $this->db->fetchAll("SELECT * FROM search_backend_data" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($data as $entryData) {
         if ($entryData['maintype'] == 'document') {
             $element = Document::getById($entryData['id']);
         } else {
             if ($entryData['maintype'] == 'asset') {
                 $element = Asset::getById($entryData['id']);
             } else {
                 if ($entryData['maintype'] == 'object') {
                     $element = Object_Abstract::getById($entryData['id']);
                 } else {
                     Logger::err("unknown maintype ");
                 }
             }
         }
         if ($element) {
             $entry = new Search_Backend_Data();
             $entry->setId(new Search_Backend_Data_Id($element));
             $entry->setFullPath($entryData['fullpath']);
             $entry->setType($entryData['type']);
             $entry->setSubtype($entryData['subtype']);
             $entry->setUserOwner($entryData['userowner']);
             $entry->setUserModification($entryData['usermodification']);
             $entry->setCreationDate($entryData['creationdate']);
             $entry->setModificationDate($entryData['modificationdate']);
             $entry->setPublished($entryData['published'] === 0 ? false : true);
             $entries[] = $entry;
         }
     }
     $this->model->setEntries($entries);
     return $entries;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:40,代码来源:Resource.php

示例7: init

 public function init()
 {
     parent::init();
     // set language
     try {
         $locale = Zend_Registry::get("Zend_Locale");
         $this->setLanguage($locale->getLanguage());
     } catch (Exception $e) {
         if ($this->_getParam("language")) {
             $this->setLanguage($this->_getParam("language"));
         } else {
             $config = Pimcore_Config::getSystemConfig();
             $this->setLanguage($config->general->language);
         }
     }
     try {
         Zend_Registry::get("pimcore_admin_initialized");
         $this->setUser(Zend_Registry::get("pimcore_admin_user"));
     } catch (Exception $e) {
         // general definitions
         Document::setHideUnpublished(false);
         Object_Abstract::setHideUnpublished(false);
         Object_Abstract::setGetInheritedValues(false);
         Pimcore::setAdminMode();
         // init translations
         self::initTranslations($this);
         // init zend action helpers
         Zend_Controller_Action_HelperBroker::addPrefix('Pimcore_Controller_Action_Helper');
         // authenticate user, first try to authenticate with session information
         $user = Pimcore_Tool_Authentication::authenticateSession();
         if ($user instanceof User) {
             $this->setUser($user);
             if ($this->getUser()->getLanguage()) {
                 $this->setLanguage($this->getUser()->getLanguage());
             }
         } else {
             // try to authenticate with digest, but this is only allowed for WebDAV
             if ($this->_getParam("module") == "admin" && $this->_getParam("controller") == "asset" && $this->_getParam("action") == "webdav") {
                 $user = Pimcore_Tool_Authentication::authenticateDigest();
                 if ($user instanceof User) {
                     $this->setUser($user);
                     return;
                 }
             }
         }
         // send a auth header for the client (is covered by the ajax object in javascript)
         if (!$this->getUser() instanceof User) {
             $this->getResponse()->setHeader("X-Pimcore-Auth", "required");
         }
         // redirect to the login-page if the user isn't authenticated
         if (!$this->getUser() instanceof User && !($this->_getParam("module") == "admin" && $this->_getParam("controller") == "login")) {
             $this->_redirect("/admin/login");
             $this->getResponse()->sendResponse();
             exit;
         }
         Zend_Registry::set("pimcore_admin_user", $this->getUser());
         Zend_Registry::set("pimcore_admin_initialized", true);
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:59,代码来源:Admin.php

示例8: setAction

 public function setAction()
 {
     $owner = $_POST['user'];
     $activities = $_POST['activities'];
     $object = $_POST['object'];
     $isValid = Website_P1GlobalFunction::checkValidation($_POST, array('user', 'activities', 'object'));
     if (count($isValid) > 0) {
         $arrayReturn = array("status" => "failed", "message" => "field not found", "data" => $isValid);
         $json_plans = $this->_helper->json($arrayReturn);
         Website_P1GlobalFunction::sendResponse($json_plans);
         exit;
     }
     $ownerId = Object_Abstract::getById($owner);
     $activitiesId = Object_Abstract::getById($activities);
     $key = str_replace(' ', '_', strtolower($ownerId->Name)) . "-" . str_replace(' ', '_', strtolower($activitiesId->Name) . "-" . rand());
     $now = date("Y-m-d,H-i");
     $getDateTime = new Pimcore_Date($now);
     if ($ownerId->o_className == "Customer") {
         $getId = Object_Abstract::getByPath('/log/customers');
         //get folder id
         $setLog = new Object\LogCustomers();
         $setLog->setCustomers($ownerId);
         $setLog->setActivities($activitiesId);
         $setLog->setObjectContent($object);
         $setLog->setDatetime($getDateTime);
         $setLog->setO_parentId($getId->o_id);
         $setLog->setKey($key);
         $setLog->setPublished(1);
         $setLog->save();
         $status = "Success";
         $message = "Success";
         $data = "Add Customer log Success";
     } else {
         if ($ownerId->o_className == "Agen") {
             $getId = Object_Abstract::getByPath('/log/agen');
             //get folder id
             $setLog = new Object\LogAgents();
             $setLog->setAgen($ownerId);
             $setLog->setActivities($activitiesId);
             $setLog->setObjectContent($object);
             $setLog->setDatetime($getDateTime);
             $setLog->setO_parentId($getId->o_id);
             $setLog->setKey($key);
             $setLog->setPublished(1);
             $setLog->save();
             $status = "Success";
             $message = "Success";
             $data = "Add Agen log Success";
         } else {
             $status = "Field";
             $message = "Log id not found";
             $data = "Null";
         }
     }
     $arrayReturn = array("status" => $status, "message" => $message, "data" => $data);
     $json_log = $this->_helper->json($arrayReturn);
     Website_P1GlobalFunction::sendResponse($json_log);
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:58,代码来源:LogController.php

示例9: productDetailAction

 public function productDetailAction()
 {
     $key = $this->_getParam('text');
     $id = $this->_getParam('id');
     $entries = Object_Abstract::getById($id);
     $data = $entries;
     $this->view->product = $data;
     $this->enableLayout();
     $this->view->layout()->setLayout("layout_mobile");
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:10,代码来源:ProductController.php

示例10: previewAction

 /**
  * Preview entry in pimcore admin.
  *
  * @throws Zend_Controller_Action_Exception
  */
 public function previewAction()
 {
     $id = (int) $this->_getParam('o_id');
     $entry = Object_Abstract::getById($id);
     /* @var $entry Blog_Entry */
     if (null == $entry) {
         throw new Zend_Controller_Action_Exception("No entry with ID '{$id}'", 404);
     }
     return $this->_forward('show', null, null, array('key' => $entry->getUrlPath()));
 }
开发者ID:weblizards-gmbh,项目名称:blog,代码行数:15,代码来源:EntryController.php

示例11: cleanUp

 /**
  * legacy - not required anymore
  *
  *
  * @return void
  */
 protected function cleanUp()
 {
     try {
         $class = Object_Class::getByName("unittest");
         if ($class instanceof Object_Class) {
             $class->delete();
         }
     } catch (Exception $e) {
     }
     try {
         $objectRoot = Object_Abstract::getById(1);
         if ($objectRoot and $objectRoot->hasChilds()) {
             $childs = $objectRoot->getChilds();
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     } catch (Exception $e) {
     }
     try {
         $assetRoot = Asset::getById(1);
         if ($assetRoot and $assetRoot->hasChilds()) {
             $childs = $assetRoot->getChilds();
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     } catch (Exception $e) {
     }
     try {
         $documentRoot = Asset::getById(1);
         if ($documentRoot and $documentRoot->hasChilds()) {
             $childs = $documentRoot->getChilds();
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     } catch (Exception $e) {
     }
     try {
         $userList = new User_List();
         $userList->setCondition("id > 1");
         $users = $userList->load();
         if (is_array($users) and count($users) > 0) {
             foreach ($users as $user) {
                 $user->delete();
             }
         }
     } catch (Exception $e) {
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:57,代码来源:AllTests.php

示例12: getCondition

 protected function getCondition()
 {
     if ($cond = $this->model->getCondition()) {
         if (Object_Abstract::doHideUnpublished() && !$this->model->getUnpublished()) {
             return " WHERE (" . $cond . ") AND o_published = 1";
         }
         return " WHERE " . $cond . " ";
     } else {
         if (Object_Abstract::doHideUnpublished() && !$this->model->getUnpublished()) {
             return " WHERE o_published = 1";
         }
     }
     return "";
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:14,代码来源:Resource.php

示例13: setAction

 public function setAction()
 {
     $ipAddress = $_POST['ipaddress'];
     $array = array();
     $arrays = array();
     $http_user_agent = $_SERVER['HTTP_USER_AGENT'];
     //get user agent information
     $getBrowser = $this->getBrowser($http_user_agent);
     $getOS = $this->getOS($http_user_agent);
     $key = $ipAddress . "_" . rand();
     $now = date("Y-m-d,H-i");
     $date = date("Y-m-d");
     $date = strtotime($date);
     $date = strtotime("+7 day", $date);
     $getStartDate = new Pimcore_Date($now);
     $getExpiredDate = new Pimcore_Date($date);
     $is_exist = $this->checkVaalidate($ipAddress);
     //check is exsisting ip or new
     if ($is_exist["status"] != "failed") {
         $this->putAction();
         $this->getAction();
     } else {
         $getId = Object_Abstract::getByPath('/session/');
         //get folder id
         $setSession = new Object\Sessions();
         $setSession->setCreatedAt($getStartDate);
         $setSession->setExpiredAt($getExpiredDate);
         $setSession->setMessage('setNew');
         $setSession->setStatus('Active');
         $setSession->setOs($getOS);
         $setSession->setBrowser($getBrowser);
         $setSession->setIpAddress($ipAddress);
         $setSession->setO_parentId($getId->o_id);
         $setSession->setKey($key);
         $setSession->setPublished(1);
         $setSession->save();
         //$startDate = date("d/m/Y",strtotime(new Pimcore_Date($session->date_tglBuat)));
         //$endDate= date("d/m/Y",strtotime(new Pimcore_Date($session->date_tglLahir)));
         $array['status'] = "success";
         $array['message'] = "success";
         $array['ip_address'] = $ip_address;
         //get active ip from user
         $array['browser'] = $getBrowser;
         $array['os'] = $getOS;
     }
     $json_session = $this->_helper->json($array);
     Website_P1GlobalFunction::sendResponse($json_session);
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:48,代码来源:CoreSessionController.php

示例14: load

 /**
  * Loads a list of objects for the specicifies parameters, returns an array of Object_Abstract elements
  *
  * @return array 
  */
 public function load()
 {
     $objects = array();
     try {
         $objectsData = $this->db->fetchAll("SELECT DISTINCT " . $this->getTableName() . ".o_id AS o_id,o_type FROM `" . $this->getTableName() . "`" . $this->getJoins() . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     } catch (Exception $e) {
         return $this->exceptionHandler($e);
     }
     foreach ($objectsData as $objectData) {
         if ($object = Object_Abstract::getById($objectData["o_id"])) {
             $objects[] = Object_Abstract::getById($objectData["o_id"]);
         }
     }
     $this->model->setObjects($objects);
     return $objects;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:21,代码来源:Resource.php

示例15: __construct

 public function __construct($element)
 {
     parent::__construct($element);
     if ($element instanceof Object_Product) {
         $backup = Object_Abstract::doGetInheritedValues($element);
         Object_Abstract::setGetInheritedValues(true);
         if ($element->getParent() instanceof Object_Product) {
             $this->elementIcon = '/pimcore/static/img/icon/tag_green.png';
             $this->elementIconClass = null;
         } else {
             $this->elementIcon = '/pimcore/static/img/icon/tag_blue.png';
             $this->elementIconClass = null;
         }
         Object_Abstract::setGetInheritedValues($backup);
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:16,代码来源:AdminStyle.php


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