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


PHP Summit::seedBasicEventTypes方法代码示例

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


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

示例1: handleAddDefaultEventTypes

 public function handleAddDefaultEventTypes($grid, $request, $data = null)
 {
     $summit_id = intval($request->param('ID'));
     if ($summit_id > 0 && ($summit = Summit::get()->byID($summit_id))) {
         Summit::seedBasicEventTypes($summit_id);
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:7,代码来源:GridFieldAddDefaultEventTypes.php

示例2: assignEventType

 private function assignEventType()
 {
     $summit_id = intval($this->SummitID);
     if ($summit_id > 0 && intval($this->TypeID) === 0) {
         Summit::seedBasicEventTypes($summit_id);
         $event_type = SummitEventType::get()->filter(array('Type' => 'Presentation', 'SummitID' => $summit_id))->first();
         $this->TypeID = $event_type->ID;
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:9,代码来源:Presentation.php

示例3: run

 /**
  * Implement this method in the task subclass to
  * execute via the TaskRunner
  */
 public function run($request)
 {
     set_time_limit(0);
     $summit_id = intval($request->getVar('summit_id'));
     if (empty($summit_id)) {
         throw new InvalidArgumentException('missing summit_id param!');
     }
     $summit_external_id = intval($request->getVar('summit_external_id'));
     if (empty($summit_external_id)) {
         throw new InvalidArgumentException('missing summit_external_id param!');
     }
     // get ticket types ...
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         throw new InvalidArgumentException("non existent summit!");
     }
     $summit->ExternalEventId = $summit_external_id;
     $summit->write();
     Summit::seedBasicEventTypes($summit_id);
     Summit::seedSummitTypes($summit_id);
     $client = new GuzzleHttp\Client();
     $query = array('token' => EVENTBRITE_PERSONAL_OAUTH2_TOKEN);
     $response = $client->get(sprintf("https://www.eventbriteapi.com/v3/events/%s/ticket_classes/", $summit_external_id), array('query' => $query));
     if ($response->getStatusCode() !== 200) {
         throw new Exception('invalid status code!');
     }
     $content_type = $response->getHeader('content-type');
     if (empty($content_type)) {
         throw new Exception('invalid content type!');
     }
     if ($content_type !== 'application/json') {
         throw new Exception('invalid content type!');
     }
     $json = $response->getBody()->getContents();
     $ticket_types = json_decode($json, true);
     $ticket_types = $ticket_types['ticket_classes'];
     foreach ($ticket_types as $t) {
         $new_ticket = new SummitTicketType();
         $new_ticket->ExternalId = $t["id"];
         if (SummitTicketType::get()->filter(array('SummitID' => $summit_id, 'ExternalId' => $new_ticket->ExternalId))->count() > 0) {
             continue;
         }
         $new_ticket->Name = $t["name"];
         $new_ticket->Description = $t["description"];
         $new_ticket->SummitID = $summit_id;
         $new_ticket->write();
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:52,代码来源:InitializeSummitDataTask.php

示例4: run

 public function run($request)
 {
     $summit_id = intval($request->requestVar('SummitID'));
     if ($summit_id <= 0) {
         throw new RuntimeException("invalid summit id");
     }
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         throw new RuntimeException("invalid summit");
     }
     $count = 0;
     $presentations = Presentation::get()->filter(array('SummitID' => $summit_id, 'TypeID' => 0))->where(" Title IS NOT NULL AND Title <>'' ");
     Summit::seedBasicEventTypes($summit_id);
     $type = SummitEventType::get()->filter(array('Type' => 'Presentation', 'SummitID' => $summit_id))->first();
     if (is_null($type)) {
         throw new RuntimeException("invalid event type");
     }
     foreach ($presentations as $p) {
         $p->TypeID = $type->ID;
         $p->write();
         ++$count;
     }
     echo "Fixed {$count} presentations.";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:24,代码来源:PresentationEventTypeFixTask.php


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