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


PHP Event::setParam方法代码示例

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


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

示例1: clearCache

 public function clearCache($id)
 {
     $event = new Event();
     $event->setParam('id', $id);
     $result = $this->getEventManager()->trigger('clear', $event);
     return $result->last();
 }
开发者ID:zource,项目名称:zource,代码行数:7,代码来源:CacheManager.php

示例2: checkModules

 /**
  * Check other modules and register comments if available
  *
  * @param Event $e
  * @return void
  */
 public function checkModules(Event $e)
 {
     $module = $e->getParam('module');
     $modules = Pi::registry('module')->read();
     if (isset($modules['comment'])) {
         unset($modules['comment']);
     }
     $moduleList = array_keys($modules);
     foreach ($moduleList as $mod) {
         $options = Pi::service('module')->loadMeta($mod, 'comment', true);
         if (empty($options)) {
             continue;
         }
         /*
         if (is_string($options)) {
             $optionsFile = sprintf(
                 '%s/%s/config/%s',
                 Pi::path('module'),
                 Pi::service('module')->directory($mod),
                 $options
             );
             $options = include $optionsFile;
             if (empty($options) || !is_array($options)) {
                 continue;
             }
         }
         */
         $resourceHandler = new CommentResource($options);
         $e->setParam('module', $mod);
         $resourceHandler->setEvent($e);
         $resourceHandler->installAction();
     }
     $e->setParam('module', $module);
 }
开发者ID:Andyyang1981,项目名称:pi,代码行数:40,代码来源:Install.php

示例3: setBusinessSlug

 public function setBusinessSlug(Event $e)
 {
     $data = $e->getParam('data');
     if (!$data['slug']) {
         $data['slug'] = $data['company'];
     }
     $e->setParam('data', $data);
 }
开发者ID:uthando-cms,项目名称:uthando-business-list,代码行数:8,代码来源:ServiceListener.php

示例4: addVocabularyServices

 public function addVocabularyServices(Event $event)
 {
     $vocabs = $this->getServiceLocator()->get('Omeka\\ApiManager')->search('custom_vocabs')->getContent();
     if (!$vocabs) {
         return;
     }
     $names = $event->getParam('registered_names');
     foreach ($vocabs as $vocab) {
         $names[] = 'customvocab:' . $vocab->id();
     }
     $event->setParam('registered_names', $names);
 }
开发者ID:omeka-s-modules,项目名称:CustomVocab,代码行数:12,代码来源:Module.php

示例5: preSave

 /**
  * @param Event $e
  */
 public function preSave(Event $e)
 {
     $articleService = $this->getService('UthandoArticle');
     $model = $e->getParam('data');
     $article = $model->getArticle();
     $article->setDateModified();
     $result = $articleService->save($article);
     if (!$model->getArticleId()) {
         $model->setArticleId($result);
     }
     $e->setParam('data', $model);
 }
开发者ID:uthando-cms,项目名称:uthando-news,代码行数:15,代码来源:News.php

示例6: checkModules

 /**
  * Check module model availability
  *
  * @param Event $e
  * @return bool
  */
 public function checkModules(Event $e)
 {
     $module = $this->event->getParam('module');
     $model = Pi::mdel('module');
     //$rowset = $model->select(array('dirname <> ?' => $module));
     $count = $model->count(array('dirname <> ?' => $module));
     if ($count > 0) {
         $result = array('status' => false, 'message' => 'Modules are not unistalled completely.');
         $e->setParam('result', $result);
         return false;
     }
     return true;
 }
开发者ID:Andyyang1981,项目名称:pi,代码行数:19,代码来源:Uninstall.php

示例7: configureElement

 /**
  * Configure an element from annotations
  *
  * @param  AnnotationCollection $annotations
  * @param  PropertyReflection $reflection
  * @param  ArrayObject $formSpec
  * @param  ArrayObject $filterSpec
  * @return void
  *
  * @triggers checkForExclude
  * @triggers discoverName
  * @triggers configureElement
  */
 protected function configureElement($annotations, $reflection, $formSpec, $filterSpec)
 {
     // If the element is marked as exclude, return early
     if ($this->checkForExclude($annotations)) {
         return;
     }
     $events = $this->getEventManager();
     $name = $this->discoverName($annotations, $reflection);
     $elementSpec = new ArrayObject(['flags' => [], 'spec' => ['name' => $name]]);
     $inputSpec = new ArrayObject(['name' => $name]);
     $event = new Event();
     $event->setParams(['name' => $name, 'elementSpec' => $elementSpec, 'inputSpec' => $inputSpec, 'formSpec' => $formSpec, 'filterSpec' => $filterSpec]);
     foreach ($annotations as $annotation) {
         $event->setParam('annotation', $annotation);
         $events->trigger(__FUNCTION__, $this, $event);
     }
     // Since "filters", "type", "validators" is a reserved names in the filter specification,
     // we need to add the specification without the name as the key.
     // In all other cases, though, the name is fine.
     if ($event->getParam('inputSpec')->count() > 1 || $annotations->hasAnnotation(Input::class)) {
         if ($name === 'type' || $name === 'filters' || $name === 'validators') {
             $filterSpec[] = $event->getParam('inputSpec');
         } else {
             $filterSpec[$name] = $event->getParam('inputSpec');
         }
     }
     $elementSpec = $event->getParam('elementSpec');
     $type = isset($elementSpec['spec']['type']) ? $elementSpec['spec']['type'] : Element::class;
     // Compose as a fieldset or an element, based on specification type.
     // If preserve defined order is true, all elements are composed as elements to keep their ordering
     if (!$this->preserveDefinedOrder() && is_subclass_of($type, FieldsetInterface::class)) {
         if (!isset($formSpec['fieldsets'])) {
             $formSpec['fieldsets'] = [];
         }
         if (isset($formSpec['fieldsets'][$name])) {
             $formSpec['fieldsets'][] = $elementSpec;
         } else {
             $formSpec['fieldsets'][$name] = $elementSpec;
         }
     } else {
         if (!isset($formSpec['elements'])) {
             $formSpec['elements'] = [];
         }
         if (isset($formSpec['elements'][$name])) {
             $formSpec['elements'][] = $elementSpec;
         } else {
             $formSpec['elements'][$name] = $elementSpec;
         }
     }
 }
开发者ID:coolms,项目名称:common,代码行数:63,代码来源:AnnotationBuilderTrait.php

示例8: checkModules

 /**
  * Check other modules and install profiles if available
  *
  * @param Event $e
  * @return void
  */
 public function checkModules(Event $e)
 {
     $module = $e->getParam('module');
     $modules = Pi::registry('module')->read();
     if (isset($modules['user'])) {
         unset($modules['user']);
     }
     $moduleList = array_keys($modules);
     foreach ($moduleList as $mod) {
         $options = Pi::service('module')->loadMeta($mod, 'user', true);
         if (empty($options)) {
             continue;
         }
         $resourceHandler = new UserResource($options);
         $e->setParam('module', $mod);
         $resourceHandler->setEvent($e);
         $resourceHandler->installAction();
     }
     $e->setParam('module', $module);
 }
开发者ID:Andyyang1981,项目名称:pi,代码行数:26,代码来源:Install.php

示例9: getSubscriptionList

 /**
  * @param Event $e
  */
 public function getSubscriptionList(Event $e)
 {
     /* @var $form \UthandoUser\Form\Register */
     $form = $e->getParam('form');
     $post = $e->getParam('post');
     if (!$form instanceof Register) {
         return;
     }
     /* @var \UthandoNewsletter\Form\Element\SubscriptionList $subscriptionList */
     $subscriptionList = $e->getTarget()->getServiceLocator()->get('FormElementManager')->get('UthandoNewsletterSubscriptionList');
     if (0 === count($subscriptionList->getValueOptions())) {
         return;
     }
     $subscriptionList->setOptions(['label' => 'Newsletter', 'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL, 'column-size' => 'sm-10', 'label_attributes' => ['class' => 'col-sm-2']]);
     if (isset($post['subscribe'])) {
         $subscriptionList->setValue($post['subscribe']);
     }
     $form->add($subscriptionList);
     $validationGroup = $form->getValidationGroup();
     $validationGroup[] = 'subscribe';
     $form->setValidationGroup($validationGroup);
     $e->setParam('form', $form);
 }
开发者ID:uthando-cms,项目名称:uthando-newsletter,代码行数:26,代码来源:UserListener.php

示例10: installTheme

 /**
  * Install default theme
  *
  * @param Event $e
  * @return bool
  */
 public function installTheme(Event $e)
 {
     $themeInstaller = new ThemeInstaller();
     $result = $themeInstaller->install('default');
     if (is_array($result)) {
         $status = $result['status'];
         if (!$status) {
             $ret = $e->getParam('result');
             $ret['theme'] = $result;
             $e->setParam('result', $ret);
         }
     } else {
         $status = (bool) $result;
     }
     return $status;
 }
开发者ID:Andyyang1981,项目名称:pi,代码行数:22,代码来源:Install.php

示例11: setParam

 /**
  * Set an individual event parameter
  *
  * @param  string $name
  * @param  mixed $value
  * @return $this
  */
 public function setParam($name, $value)
 {
     switch ($name) {
         case 'processor':
             $this->setProcessor($value);
             break;
         case 'message':
             $this->setMessage($value);
             break;
         case 'result':
             $this->setResult($value);
             break;
         default:
             parent::setParam($name, $value);
             break;
     }
     return $this;
 }
开发者ID:stakhanovist,项目名称:worker,代码行数:25,代码来源:ProcessEvent.php

示例12: loadConfig

 /**
  * Load theme meta
  * @param Event $e
  * @return void
  */
 public function loadConfig(Event $e)
 {
     $config = Pi::service('theme')->loadConfig($e->getParam('name'));
     $e->setParam('config', $config);
 }
开发者ID:Andyyang1981,项目名称:pi,代码行数:10,代码来源:Theme.php

示例13: loadConfig

 /**
  * Load module meta
  *
  * @param Event $e
  * @return void
  */
 public function loadConfig(Event $e)
 {
     $directory = $e->getParam('directory');
     $config = Pi::service('module')->loadMeta($directory, null, true);
     $e->setParam('config', $config);
     if (!$e->getParam('title')) {
         $e->setParam('title', $config['meta']['title']);
     }
 }
开发者ID:Andyyang1981,项目名称:pi,代码行数:15,代码来源:Module.php

示例14: preSave

 /**
  * Password pre saving checks
  *
  * @param Event $e
  * @throws UthandoUserException
  */
 public function preSave(Event $e)
 {
     $data = $e->getParam('data');
     if ($data instanceof UserModel) {
         $data = $this->getMapper()->extract($data);
     }
     if (array_key_exists('passwd', $data) && '' != $data['passwd']) {
         $data['passwd'] = $this->createPassword($data['passwd']);
     } else {
         unset($data['passwd']);
     }
     $e->setParam('data', $data);
 }
开发者ID:uthando-cms,项目名称:uthando-user,代码行数:19,代码来源:User.php

示例15: configureElement

 /**
  * Configure an element from annotations
  *
  * @param  AnnotationCollection $annotations
  * @param  \Zend\Code\Reflection\PropertyReflection $reflection
  * @param  ArrayObject $formSpec
  * @param  ArrayObject $filterSpec
  * @return void
  * @triggers checkForExclude
  * @triggers discoverName
  * @triggers configureElement
  */
 protected function configureElement($annotations, $reflection, $formSpec, $filterSpec)
 {
     // If the element is marked as exclude, return early
     if ($this->checkForExclude($annotations)) {
         return;
     }
     $events = $this->getEventManager();
     $name = $this->discoverName($annotations, $reflection);
     $elementSpec = new ArrayObject(array('flags' => array(), 'spec' => array('name' => $name)));
     $inputSpec = new ArrayObject(array('name' => $name));
     $event = new Event();
     $event->setParams(array('name' => $name, 'elementSpec' => $elementSpec, 'inputSpec' => $inputSpec, 'formSpec' => $formSpec, 'filterSpec' => $filterSpec));
     foreach ($annotations as $annotation) {
         $event->setParam('annotation', $annotation);
         $events->trigger(__FUNCTION__, $this, $event);
     }
     $filterSpec[$name] = $event->getParam('inputSpec');
     $elementSpec = $event->getParam('elementSpec');
     $type = isset($elementSpec['spec']['type']) ? $elementSpec['spec']['type'] : 'Zend\\Form\\Element';
     // Compose as a fieldset or an element, based on specification type
     if (self::isSubclassOf($type, 'Zend\\Form\\FieldsetInterface')) {
         if (!isset($formSpec['fieldsets'])) {
             $formSpec['fieldsets'] = array();
         }
         $formSpec['fieldsets'][] = $elementSpec;
     } else {
         if (!isset($formSpec['elements'])) {
             $formSpec['elements'] = array();
         }
         $formSpec['elements'][] = $elementSpec;
     }
 }
开发者ID:robertodormepoco,项目名称:zf2,代码行数:44,代码来源:AnnotationBuilder.php


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