當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。