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


PHP Pimcore::getEventManager方法代码示例

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


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

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

示例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");
     $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);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:30,代码来源:NewsletterController.php

示例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");
     $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);
 }
开发者ID:solverat,项目名称:pimcore,代码行数:27,代码来源:HardlinkController.php

示例4: init

 public function init()
 {
     // Disable plugin if the allowed domain is not yet set
     $settingDomain = WebsiteSetting::getByName("subdomainAdmin");
     if (!is_object($settingDomain) || $settingDomain->getData() == "") {
         return;
     }
     // Create temporary request object - not available yet in front controller
     $currentUrl = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     $request = new \Zend_Controller_Request_Http($currentUrl);
     // Disable main domain setting to allow admin access on another domain
     $conf = Config::getSystemConfig();
     $mainDomain = $conf->general->domain;
     if (Tool::isRequestToAdminBackend($request) && Tool::isDomainAllowedToAdminBackend($request)) {
         $confArr = $conf->toArray();
         $mainDomain = $confArr['general']['domain'];
         $confArr['general']['domain'] = "";
         Config::setSystemConfig(new \Zend_Config($confArr));
     }
     // Register plugin
     \Pimcore::getEventManager()->attach("system.startup", function ($event) use(&$mainDomain) {
         $front = \Zend_Controller_Front::getInstance();
         $frontControllerPlugin = new FrontControllerPlugin();
         $front->registerPlugin($frontControllerPlugin);
         // Restore main domain
         $conf = Config::getSystemConfig();
         $confArr = $conf->toArray();
         $confArr['general']['domain'] = $mainDomain;
         Config::setSystemConfig(new \Zend_Config($confArr));
     });
 }
开发者ID:shanky0110,项目名称:pimcore-plugin-subdomain-admin,代码行数:31,代码来源:Plugin.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $validJobs = array();
     if ($input->getOption("job")) {
         $validJobs = explode(",", $input->getOption("job"));
     }
     // create manager
     $manager = Schedule\Manager\Factory::getManager("maintenance.pid");
     $manager->setValidJobs($validJobs);
     $manager->setForce((bool) $input->getOption("force"));
     // register scheduled tasks
     $manager->registerJob(new Schedule\Maintenance\Job("scheduledtasks", new Schedule\Task\Executor(), "execute"));
     $manager->registerJob(new Schedule\Maintenance\Job("logmaintenance", new \Pimcore\Log\Maintenance(), "mail"));
     $manager->registerJob(new Schedule\Maintenance\Job("cleanuplogfiles", new \Pimcore\Log\Maintenance(), "cleanupLogFiles"));
     $manager->registerJob(new Schedule\Maintenance\Job("httperrorlog", new \Pimcore\Log\Maintenance(), "httpErrorLogCleanup"));
     $manager->registerJob(new Schedule\Maintenance\Job("usagestatistics", new \Pimcore\Log\Maintenance(), "usageStatistics"));
     $manager->registerJob(new Schedule\Maintenance\Job("checkErrorLogsDb", new \Pimcore\Log\Maintenance(), "checkErrorLogsDb"));
     $manager->registerJob(new Schedule\Maintenance\Job("archiveLogEntries", new \Pimcore\Log\Maintenance(), "archiveLogEntries"));
     $manager->registerJob(new Schedule\Maintenance\Job("sanitycheck", "\\Pimcore\\Model\\Element\\Service", "runSanityCheck"));
     $manager->registerJob(new Schedule\Maintenance\Job("versioncleanup", new \Pimcore\Model\Version(), "maintenanceCleanUp"));
     $manager->registerJob(new Schedule\Maintenance\Job("versioncompress", new \Pimcore\Model\Version(), "maintenanceCompress"));
     $manager->registerJob(new Schedule\Maintenance\Job("redirectcleanup", "\\Pimcore\\Model\\Redirect", "maintenanceCleanUp"));
     $manager->registerJob(new Schedule\Maintenance\Job("cleanupbrokenviews", "\\Pimcore\\Db", "cleanupBrokenViews"));
     $manager->registerJob(new Schedule\Maintenance\Job("downloadmaxminddb", "\\Pimcore\\Update", "updateMaxmindDb"));
     $manager->registerJob(new Schedule\Maintenance\Job("cleanupcache", "\\Pimcore\\Model\\Cache", "maintenance"));
     $manager->registerJob(new Schedule\Maintenance\Job("tmpstorecleanup", "\\Pimcore\\Model\\Tool\\TmpStore", "cleanup"));
     $manager->registerJob(new Schedule\Maintenance\Job("imageoptimize", "\\Pimcore\\Model\\Asset\\Image\\Thumbnail\\Processor", "processOptimizeQueue"));
     \Pimcore::getEventManager()->trigger("system.maintenance", $manager);
     $manager->run();
     \Logger::info("All maintenance-jobs finished!");
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:31,代码来源:MaintenanceCommand.php

示例6: getHref

 /**
  * @return string
  */
 public function getHref()
 {
     $this->updatePathFromInternal();
     $url = $this->data['path'];
     if ($this->data['internalType'] == 'object') {
         $objectInfo = explode('::', $url);
         if (count($objectInfo) == 2) {
             $path = FALSE;
             $cmdEv = \Pimcore::getEventManager()->trigger('toolbox.url.objectFrontendUrl', null, array('className' => $objectInfo[0], 'path' => $objectInfo[1]));
             if ($cmdEv->stopped()) {
                 $path = $cmdEv->last();
                 if (!empty($path)) {
                     $path = \Toolbox\Tools\GlobalLink::parse($path);
                 }
             }
             return $path;
         } else {
             return FALSE;
         }
     }
     if (strlen($this->data['parameters']) > 0) {
         $url .= "?" . str_replace("?", "", $this->getParameters());
     }
     if (strlen($this->data['anchor']) > 0) {
         $url .= "#" . str_replace("#", "", $this->getAnchor());
     }
     return $url;
 }
开发者ID:dachcom-digital,项目名称:pimcore-toolbox,代码行数:31,代码来源:Globallink.php

示例7: attachEvents

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function attachEvents()
 {
     self::getInstall()->attachEvents();
     \Pimcore::getEventManager()->attach('coreshop.payment.getProvider', function ($e) {
         return $this;
     });
 }
开发者ID:coreshop,项目名称:sofortueberweisung,代码行数:10,代码来源:Shop.php

示例8: init

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function init()
 {
     // attach event-listener
     foreach (["asset", "object", "document", "object.class"] as $type) {
         \Pimcore::getEventManager()->attach($type . ".postAdd", array($this, "createUuid"));
         \Pimcore::getEventManager()->attach($type . ".postDelete", array($this, "deleteUuid"));
     }
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:11,代码来源:Module.php

示例9: attachEvents

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function attachEvents()
 {
     self::getInstall()->attachEvents();
     $shopProvider = new Provider();
     \Pimcore::getEventManager()->attach("coreshop.payment.getProvider", function ($e) use($shopProvider) {
         return $shopProvider;
     });
 }
开发者ID:coreshop,项目名称:Paypal,代码行数:11,代码来源:Shop.php

示例10: __construct

 /**
  * Constructor.
  *
  * @param string $name The name of the application
  * @param string $version The version of the application
  *
  * @api
  */
 public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
 {
     parent::__construct('Pimcore CLI', Version::getVersion());
     // init default autoload namespaces
     $this->initDefaultAutoloadNamespaces();
     // allow to register commands here (e.g. through plugins)
     \Pimcore::getEventManager()->trigger('system.console.init', $this);
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:16,代码来源:Application.php

示例11: __construct

 /**
  * Constructor.
  *
  * @param string $name The name of the application
  * @param string $version The version of the application
  *
  * @api
  */
 public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
 {
     parent::__construct('Pimcore CLI', Version::getVersion());
     foreach ($this->defaultAutoloadNamespaces as $namespace => $directory) {
         $this->addAutoloadNamespace($namespace, $directory);
     }
     // allow to register commands here (e.g. through plugins)
     \Pimcore::getEventManager()->trigger('system.console.init', $this);
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:17,代码来源:Application.php

示例12: init

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function init()
 {
     parent::init();
     \Pimcore::getEventManager()->attach('system.maintenance', array($this, 'maintenanceJob'));
     \Pimcore::getEventManager()->attach('system.console.init', function (\Zend_EventManager_Event $e) {
         $application = $e->getTarget();
         $application->add(new \LuceneSearch\Console\Command\FrontendCrawlCommand());
     });
 }
开发者ID:dachcom-digital,项目名称:pimcore-lucene-search,代码行数:12,代码来源:Plugin.php

示例13: init

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function init()
 {
     // attach event-listener
     foreach (["asset", "object", "document"] as $type) {
         \Pimcore::getEventManager()->attach($type . ".postAdd", array($this, "postAddElement"));
         \Pimcore::getEventManager()->attach($type . ".postUpdate", array($this, "postUpdateElement"));
         \Pimcore::getEventManager()->attach($type . ".preDelete", array($this, "preDeleteElement"));
     }
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:12,代码来源:Module.php

示例14: init

 /**
  * Init Plugin.
  *
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function init()
 {
     parent::init();
     \Pimcore::getEventManager()->attach('system.startup', function (\Zend_EventManager_Event $e) {
         $frontController = $e->getTarget();
         if ($frontController instanceof \Zend_Controller_Front) {
             $frontController->registerPlugin(new Controller\Plugin\GatewayRouter());
         }
     });
 }
开发者ID:coreshop,项目名称:omnipay,代码行数:15,代码来源:Plugin.php

示例15: init

 /**
  * Init Plugin.
  */
 public function init()
 {
     parent::init();
     \Pimcore::getEventManager()->attach('system.console.init', function (\Zend_EventManager_Event $e) {
         /** @var \Pimcore\Console\Application $application */
         $application = $e->getTarget();
         // add a namespace to autoload commands from
         $application->addAutoloadNamespace('Manager\\Console', PIMCORE_PLUGINS_PATH . '/Manager/lib/Manager/Console');
     });
 }
开发者ID:pimcore-extensions,项目名称:manager,代码行数:13,代码来源:Plugin.php


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