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


PHP Object_Abstract::getByPath方法代码示例

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


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

示例1: 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

示例2: 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

示例3: setDataFromEditmode

 /**
  * Takes data from editmode and convert it to internal objects
  *
  * @param mixed $data
  * @return void
  */
 public function setDataFromEditmode($data)
 {
     // IMPORTANT: if you use this method be sure that the type of the property is already set
     if ($this->type == "document") {
         $this->data = Document::getByPath($data);
     } else {
         if ($this->type == "asset") {
             $this->data = Asset::getByPath($data);
         } else {
             if ($this->type == "object") {
                 $this->data = Object_Abstract::getByPath($data);
             } else {
                 if ($this->type == "date") {
                     $this->data = new Zend_Date($data);
                 } else {
                     if ($this->type == "bool") {
                         $this->data = false;
                         if (!empty($data)) {
                             $this->data = true;
                         }
                     } else {
                         // plain text
                         $this->data = $data;
                     }
                 }
             }
         }
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:35,代码来源:Property.php

示例4: 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

示例5: 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

示例6: addAction

 public function addAction()
 {
     $id_customer = $_POST['id_customer'];
     $id_product = $_POST['id_product'];
     $description = $_POST['description'];
     $rate = $_POST['rate'];
     // $data;
     $namekey = str_replace(' ', '_', $id_customer) . "_" . strtotime(date("YmdHis"));
     $getCustomerObj = Object_Abstract::getById($id_customer);
     $getProductObj = Object_Abstract::getById($id_product);
     $return_array = array();
     // if($id_customer == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Customer ID is required';
     //     $return_array['data']       = '';
     // }
     // else if($id_product == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Product ID is required';
     //     $return_array['data']       = '';
     // }
     // else if($description == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Description is required';
     //     $return_array['data']       = '';
     // }
     // else if($rate == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Rate is required';
     //     $return_array['data']       = '';
     // }
     $getPath = Object_Abstract::getByPath('/review');
     $addreview = array();
     $addreview = new Object_Review();
     $addreview->setcustomer($getCustomerObj);
     $addreview->setproduct($getProductObj);
     $addreview->setdescription($description);
     $addreview->setrating($rate);
     $addreview->setKey(strtolower($namekey));
     $addreview->setO_parentId($getPath->o_id);
     $addreview->setIndex(0);
     $addreview->setPublished(0);
     $addreview->save();
     $return_array['status'] = 'success';
     $return_array['message'] = 'Thank you for your review & rating';
     // $return_array['data']       = $addreview;
     $json_review = $this->_helper->json($return_array);
     Website_P1GlobalFunction::sendResponse($json_review);
     $this->sendResponse($json_review);
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:54,代码来源:ReviewController.php

示例7: objectSave

 private function objectSave(&$object)
 {
     try {
         $object->save();
     } catch (Exception $ex) {
         if ($this->getAllowReplace() === true && self::isDuplicateException($ex) === true) {
             $objectHinder = Object_Abstract::getByPath($object->getFullPath());
             $objectHinder->delete();
             $object->save();
         } else {
             self::l($ex->getMessage());
             throw $ex;
         }
     }
 }
开发者ID:jv10,项目名称:pimpon,代码行数:15,代码来源:Import.php

示例8: 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

示例9: getWebsiteConfig

 /**
  * @static
  * @return mixed|Zend_Config
  */
 public static function getWebsiteConfig()
 {
     try {
         $config = Zend_Registry::get("pimcore_config_website");
     } catch (Exception $e) {
         $cacheKey = "website_config";
         if (!($config = Pimcore_Model_Cache::load($cacheKey))) {
             $websiteSettingFile = PIMCORE_CONFIGURATION_DIRECTORY . "/website.xml";
             $settingsArray = array();
             if (is_file($websiteSettingFile)) {
                 $rawConfig = new Zend_Config_Xml($websiteSettingFile);
                 $arrayData = $rawConfig->toArray();
                 foreach ($arrayData as $key => $value) {
                     $s = null;
                     if ($value["type"] == "document") {
                         $s = Document::getByPath($value["data"]);
                     } else {
                         if ($value["type"] == "asset") {
                             $s = Asset::getByPath($value["data"]);
                         } else {
                             if ($value["type"] == "object") {
                                 $s = Object_Abstract::getByPath($value["data"]);
                             } else {
                                 if ($value["type"] == "bool") {
                                     $s = (bool) $value["data"];
                                 } else {
                                     if ($value["type"] == "text") {
                                         $s = (string) $value["data"];
                                     }
                                 }
                             }
                         }
                     }
                     if ($s) {
                         $settingsArray[$key] = $s;
                     }
                 }
             }
             $config = new Zend_Config($settingsArray, true);
             Pimcore_Model_Cache::save($config, $cacheKey, array("websiteconfig", "system", "config"), null, 998);
         }
         self::setWebsiteConfig($config);
     }
     return $config;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:49,代码来源:Config.php

示例10: correctPath

 public function correctPath()
 {
     // set path
     if ($this->getId() != 1) {
         // not for the root node
         $parent = Object_Abstract::getById($this->getParentId());
         if ($parent) {
             $this->setPath(str_replace("//", "/", $parent->getFullPath() . "/"));
         } else {
             // parent document doesn't exist anymore, so delete this document
             //$this->delete();
             // parent document doesn't exist anymore, set the parent to to root
             $this->setO_parentId(1);
             $this->setO_path("/");
         }
     }
     if (Object_Service::pathExists($this->getFullPath())) {
         $duplicate = Object_Abstract::getByPath($this->getFullPath());
         if ($duplicate instanceof Object_Abstract and $duplicate->getId() != $this->getId()) {
             throw new Exception("Duplicate full path [ " . $this->getFullPath() . " ] - cannot create object");
         }
     }
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:23,代码来源:Abstract.php

示例11: array

$data = array();
foreach ($arrayData as $key => $value) {
    $setting = new WebsiteSetting();
    $setting->setName($key);
    $type = $value["type"];
    $setting->setType($type);
    $data = $value["data"];
    if ($type == "bool") {
        $data = (bool) $data;
    } else {
        if ($type == "document") {
            $data = Document::getByPath($value["data"]);
        } else {
            if ($type == "asset") {
                $data = Asset::getByPath($value["data"]);
            } else {
                if ($type == "object") {
                    $data = Object_Abstract::getByPath($value["data"]);
                }
            }
        }
    }
    if ($data instanceof Element_Interface) {
        $data = $data->getId();
    }
    $setting->setData($data);
    $siteId = $value["siteId"] > 0 ? (int) $value["siteId"] : null;
    $setting->setSiteId($siteId);
    $setting->save();
}
@rename($configFile, $configFileNew);
开发者ID:SeerUK,项目名称:pimcore-manual-updater,代码行数:31,代码来源:postupdate.php

示例12: addAction


//.........这里部分代码省略.........
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // if($username == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Username is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($password == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Password is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($name == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Name is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($address == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Address is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($email == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Email is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($delivery_address == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Delivery Address is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($mailing_address == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Mailing Address is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($race == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Race is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     // else if($nationality == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Nationality is required';
     //     $return_array['data']       = '';
     //     $valid = false;
     // }
     if ($valid) {
         $addregister = array();
         $addregister = new Object_Customer();
         $addregister->setusername($username);
         $addregister->setpassword($password);
         $addregister->setname($name);
         $addregister->setaddress($address);
         $addregister->setemailAddress($email);
         $addregister->setdeliveryAddress($delivery_address);
         $addregister->setmailingAddress($mailing_address);
         $addregister->setrace($getRaceObj);
         $addregister->setnationality($getNationalityObj);
         $addregister->setpassportNo($passport);
         $addregister->setPostcode($postcode);
         $addregister->setcity($city);
         $addregister->setstate($state);
         $addregister->setcountry($getCountryObj);
         $addregister->setmobileNo($mobile);
         $addregister->setgender($gender);
         $addregister->setdob($date_ob);
         $getPath = Object_Abstract::getByPath('/customers');
         $addregister->setKey(strtolower($namekey));
         $addregister->setO_parentId($getPath->o_id);
         $addregister->setIndex(0);
         $addregister->setPublished(1);
         $addregister->save();
         $return_array['status'] = 'success';
         $return_array['message'] = 'Thank you for your registration';
         $return_array['data'] = $addregister;
     }
     $json_customer = $this->_helper->json($return_array);
     Website_P1GlobalFunction::sendResponse($json_customer);
     $this->sendResponse($json_customer);
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:101,代码来源:CustomerController.php

示例13: getEntry

 /**
  * @param string $key
  * @return Blog_Entry
  */
 public function getEntry($key)
 {
     return Object_Abstract::getByPath('/blog/entries/' . $key);
 }
开发者ID:Cube-Solutions,项目名称:blog,代码行数:8,代码来源:Blog.php

示例14: getFromCsvImport

 /**
  * fills object field data values from CSV Import String
  * @abstract
  * @param string $importValue
  * @param Object_Abstract $abstract
  * @return Object_Class_Data
  */
 public function getFromCsvImport($importValue)
 {
     $value = null;
     $values = explode(":", $importValue);
     if (count($values) == 2) {
         $type = $values[0];
         $path = $values[1];
         $value = Element_Service::getElementByPath($type, $path);
     } else {
         //fallback for old export files
         if ($el = Asset::getByPath($importValue)) {
             $value = $el;
         } else {
             if ($el = Document::getByPath($importValue)) {
                 $value = $el;
             } else {
                 if ($el = Object_Abstract::getByPath($importValue)) {
                     $value = $el;
                 }
             }
         }
     }
     return $value;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:31,代码来源:Href.php

示例15: getElementByPath

 /**
  * @static
  * @param  string $type
  * @param  string $path
  * @return Element_Interface
  */
 public static function getElementByPath($type, $path)
 {
     if ($type == "asset") {
         $element = Asset::getByPath($path);
     } else {
         if ($type == "object") {
             $element = Object_Abstract::getByPath($path);
         } else {
             if ($type == "document") {
                 $element = Document::getByPath($path);
             }
         }
     }
     return $element;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:21,代码来源:Service.php


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