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


PHP ExtensionManager::getExtensionById方法代码示例

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


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

示例1: fetchAll

 public function fetchAll()
 {
     $this->buildStart();
     $this->build();
     $this->buildStat();
     $results = array();
     while ($data = $this->stat->fetch()) {
         $extension = $this->extensionManager->getExtensionById($data['from_extension_id']);
         if ($extension) {
             $type = $extension->getUserNotificationType($data['from_user_notification_type']);
             if ($type) {
                 $site = new SiteModel();
                 $site->setId($data['site_id']);
                 $site->setSlug($data['site_slug']);
                 $site->setTitle($data['site_title']);
                 $notification = $type->getNotificationFromData($data, null, $site);
                 if ($notification->isValid()) {
                     $results[] = $notification;
                 }
             }
         }
     }
     return $results;
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:24,代码来源:UserNotificationRepositoryBuilder.php

示例2: getPermissionsForAnyVerifiedUserInSite

 public function getPermissionsForAnyVerifiedUserInSite(SiteModel $siteModel, $removeEditorPermissions = false, $includeChildrenPermissions = false)
 {
     global $DB, $CONFIG;
     $stat = $DB->prepare("SELECT permission_in_user_group.* FROM permission_in_user_group " . " JOIN user_group_information ON user_group_information.id = permission_in_user_group.user_group_id AND user_group_information.is_deleted = '0' AND user_group_information.is_in_index = '0' " . " JOIN user_group_in_site ON user_group_in_site.user_group_id = user_group_information.id AND user_group_in_site.site_id = :site_id AND user_group_in_site.removed_at IS NULL " . " WHERE permission_in_user_group.removed_at IS NULL AND (user_group_information.is_includes_verified_users = '1' OR user_group_information.is_includes_users = '1' OR user_group_information.is_includes_anonymous = '1' )");
     $stat->execute(array('site_id' => $siteModel->getId()));
     $permissions = array();
     while ($data = $stat->fetch()) {
         $ext = $this->extensionsManager->getExtensionById($data['extension_id']);
         if ($ext) {
             $per = $ext->getUserPermission($data['permission_key']);
             if ($per) {
                 $permissions[] = $per;
             }
         }
     }
     $user = new UserAccountModel();
     $user->setIsEditor(true);
     return new \UserPermissionsList($this->extensionsManager, $permissions, $user, $CONFIG->siteReadOnly || $removeEditorPermissions, $includeChildrenPermissions);
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:19,代码来源:UserPermissionsRepository.php

示例3: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('summary', 'text', array('label' => 'Summary', 'required' => true, 'max_length' => VARCHAR_COLUMN_LENGTH_USED, 'attr' => array('autofocus' => 'autofocus'), 'data' => $this->eventDraft->getDetailsValue('event.summary')));
     $builder->add('description', 'textarea', array('label' => 'Description', 'required' => false, 'data' => $this->eventDraft->getDetailsValue('event.description')));
     $builder->add('url', new \symfony\form\MagicUrlType(), array('label' => 'Information Web Page URL', 'required' => false, 'data' => $this->eventDraft->getDetailsValue('event.url')));
     $builder->add('ticket_url', new \symfony\form\MagicUrlType(), array('label' => 'Tickets Web Page URL', 'required' => false, 'data' => $this->eventDraft->getDetailsValue('event.ticket_url')));
     $this->customFields = array();
     foreach ($this->site->getCachedEventCustomFieldDefinitionsAsModels() as $customField) {
         if ($customField->getIsActive()) {
             $extension = $this->extensionManager->getExtensionById($customField->getExtensionId());
             if ($extension) {
                 $fieldType = $extension->getEventCustomFieldByType($customField->getType());
                 if ($fieldType) {
                     $this->customFields[] = $customField;
                     $options = $fieldType->getSymfonyFormOptions($customField);
                     $options['data'] = $this->eventDraft->getDetailsValue('event.custom.' . $customField->getKey());
                     $builder->add('custom_' . $customField->getKey(), $fieldType->getSymfonyFormType($customField), $options);
                 }
             }
         }
     }
     if ($this->site->getIsFeatureVirtualEvents()) {
         //  if both are an option, user must check which one.
         if ($this->site->getIsFeaturePhysicalEvents()) {
             $builder->add("is_virtual", "checkbox", array('required' => false, 'label' => 'Is event accessible online?', 'data' => $this->eventDraft->hasDetailsValue('event.is_virtual') ? $this->eventDraft->getDetailsValue('event.is_virtual') : $this->fieldIsVirtualDefault));
         } else {
             $builder->add('is_virtual', 'hidden', array('data' => true));
         }
     } else {
         $builder->add('is_virtual', 'hidden', array('data' => false));
     }
     if ($this->site->getIsFeaturePhysicalEvents()) {
         //  if both are an option, user must check which one.
         if ($this->site->getIsFeatureVirtualEvents()) {
             $builder->add("is_physical", "checkbox", array('required' => false, 'label' => 'Does the event happen at a place?', 'data' => $this->eventDraft->hasDetailsValue('event.is_physical') ? $this->eventDraft->getDetailsValue('event.is_physical') : $this->fieldIsPhysicalDefault));
         } else {
             $builder->add('is_physical', 'hidden', array('data' => true));
         }
     } else {
         $builder->add('is_physical', 'hidden', array('data' => false));
     }
     /** @var \closure $myExtraFieldValidator **/
     $myExtraFieldValidator = function (FormEvent $event) {
         global $CONFIG;
         $form = $event->getForm();
         // URL validation. We really can't do much except verify ppl haven't put a space in, which they might do if they just type in Google search terms (seen it done)
         if (strpos($form->get("url")->getData(), " ") !== false) {
             $form['url']->addError(new FormError("Please enter a URL"));
         }
         if (strpos($form->get("ticket_url")->getData(), " ") !== false) {
             $form['ticket_url']->addError(new FormError("Please enter a URL"));
         }
         // Title
         if (!trim($form->get('summary')->getData())) {
             $form->get('summary')->addError(new FormError("Please enter a summary"));
         }
         // TODO it has to be at least one or the other of physical or virtual
     };
     // adding the validator to the FormBuilderInterface
     $builder->addEventListener(FormEvents::POST_BIND, $myExtraFieldValidator);
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:61,代码来源:EventNewWhatDetailsForm.php

示例4: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('summary', 'text', array('label' => 'Summary', 'required' => true, 'max_length' => VARCHAR_COLUMN_LENGTH_USED, 'attr' => array('autofocus' => 'autofocus')));
     $builder->add('description', 'textarea', array('label' => 'Description', 'required' => false));
     $builder->add('url', new \symfony\form\MagicUrlType(), array('label' => 'Information Web Page URL', 'required' => false));
     $builder->add('ticket_url', new \symfony\form\MagicUrlType(), array('label' => 'Tickets Web Page URL', 'required' => false));
     $crb = new CountryRepositoryBuilder();
     $crb->setSiteIn($this->site);
     $countries = array();
     $defaultCountry = null;
     foreach ($crb->fetchAll() as $country) {
         $countries[$country->getId()] = $country->getTitle();
         if ($defaultCountry == null && in_array($this->timeZoneName, $country->getTimezonesAsList())) {
             $defaultCountry = $country->getId();
         }
     }
     if (count($countries) != 1) {
         $builder->add('country_id', 'choice', array('label' => 'Country', 'choices' => $countries, 'required' => true, 'data' => $defaultCountry));
     } else {
         $countryID = array_shift(array_keys($countries));
         $builder->add('country_id', 'hidden', array('data' => $countryID));
     }
     $timezones = array();
     // Must explicetly set name as key otherwise Symfony forms puts an ID in, and that's no good for processing outside form
     foreach ($this->site->getCachedTimezonesAsList() as $timezone) {
         $timezones[$timezone] = $timezone;
     }
     if (count($timezones) != 1) {
         $builder->add('timezone', 'choice', array('label' => 'Time Zone', 'choices' => $timezones, 'required' => true));
     } else {
         $timezone = array_pop($timezones);
         $builder->add('timezone', 'hidden', array('data' => $timezone));
     }
     if ($this->site->getIsFeatureVirtualEvents()) {
         //  if both are an option, user must check which one.
         if ($this->site->getIsFeaturePhysicalEvents()) {
             $builder->add("is_virtual", "checkbox", array('required' => false, 'label' => 'Is event accessible online?'));
         }
     }
     if ($this->site->getIsFeaturePhysicalEvents()) {
         //  if both are an option, user must check which one.
         if ($this->site->getIsFeatureVirtualEvents()) {
             $builder->add("is_physical", "checkbox", array('required' => false, 'label' => 'Does the event happen at a place?'));
         }
     }
     $years = array(date('Y'), date('Y') + 1);
     $startOptions = array('label' => 'Start', 'date_widget' => 'single_text', 'date_format' => 'd/M/y', 'model_timezone' => 'UTC', 'view_timezone' => $this->timeZoneName, 'years' => $years, 'attr' => array('class' => 'dateInput'), 'required' => true);
     if ($this->formWidgetTimeMinutesMultiples > 1) {
         $startOptions['minutes'] = array();
         for ($i = 0; $i <= 59; $i = $i + $this->formWidgetTimeMinutesMultiples) {
             $startOptions['minutes'][] = $i;
         }
     }
     $builder->add('start_at', 'datetime', $startOptions);
     $endOptions = array('label' => 'End', 'date_widget' => 'single_text', 'date_format' => 'd/M/y', 'model_timezone' => 'UTC', 'view_timezone' => $this->timeZoneName, 'years' => $years, 'attr' => array('class' => 'dateInput'), 'required' => true);
     if ($this->formWidgetTimeMinutesMultiples > 1) {
         $endOptions['minutes'] = array();
         for ($i = 0; $i <= 59; $i = $i + $this->formWidgetTimeMinutesMultiples) {
             $endOptions['minutes'][] = $i;
         }
     }
     $builder->add('end_at', 'datetime', $endOptions);
     $this->customFields = array();
     foreach ($this->site->getCachedEventCustomFieldDefinitionsAsModels() as $customField) {
         if ($customField->getIsActive()) {
             $extension = $this->extensionManager->getExtensionById($customField->getExtensionId());
             if ($extension) {
                 $fieldType = $extension->getEventCustomFieldByType($customField->getType());
                 if ($fieldType) {
                     $this->customFields[] = $customField;
                     $options = $fieldType->getSymfonyFormOptions($customField);
                     $options['mapped'] = false;
                     $options['data'] = $builder->getData()->getCustomField($customField);
                     $builder->add('custom_' . $customField->getKey(), $fieldType->getSymfonyFormType($customField), $options);
                 }
             }
         }
     }
     /** @var \closure $myExtraFieldValidator **/
     $myExtraFieldValidator = function (FormEvent $event) {
         global $CONFIG;
         $form = $event->getForm();
         $myExtraFieldStart = $form->get('start_at')->getData();
         $myExtraFieldEnd = $form->get('end_at')->getData();
         // Validate end is after start?
         if ($myExtraFieldStart > $myExtraFieldEnd) {
             $form['start_at']->addError(new FormError("The start can not be after the end!"));
         }
         // validate not to far in future
         $max = \TimeSource::getDateTime();
         $max->add(new \DateInterval("P" . $CONFIG->eventsCantBeMoreThanYearsInFuture . "Y"));
         if ($myExtraFieldStart > $max) {
             $form['start_at']->addError(new FormError("The event can not be more than " . ($CONFIG->eventsCantBeMoreThanYearsInFuture > 1 ? $CONFIG->eventsCantBeMoreThanYearsInFuture . " years" : "a year") . " in the future."));
         }
         if ($myExtraFieldEnd > $max) {
             $form['end_at']->addError(new FormError("The event can not be more than " . ($CONFIG->eventsCantBeMoreThanYearsInFuture > 1 ? $CONFIG->eventsCantBeMoreThanYearsInFuture . " years" : "a year") . " in the future."));
         }
         // validate not to far in past
         $min = \TimeSource::getDateTime();
//.........这里部分代码省略.........
开发者ID:schlos,项目名称:MeetYourNextMP-Web-Core,代码行数:101,代码来源:EventNewForm.php


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