/**
  * @return void
  */
 public function run()
 {
     try {
         $batch_size = 100;
         $init_time = time();
         $summit = null;
         if (isset($_GET['batch_size'])) {
             $batch_size = intval(trim(Convert::raw2sql($_GET['batch_size'])));
             echo sprintf('batch_size set to %s', $batch_size) . PHP_EOL;
         }
         if (isset($_GET['summit_id'])) {
             $summit = Summit::get()->byID(intval($_GET['summit_id']));
         }
         if (is_null($summit)) {
             throw new Exception('summit_id is not valid!');
         }
         $manager = Injector::inst()->get('SpeakerSecondBreakoutAnnouncementSenderManager');
         if (!$manager instanceof ISpeakerSecondBreakoutAnnouncementSenderManager) {
             return;
         }
         $processed = $manager->send($summit, $batch_size);
         $finish_time = time() - $init_time;
         echo 'processed records ' . $processed . ' - time elapsed : ' . $finish_time . ' seconds.';
     } catch (Exception $ex) {
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
     }
 }
 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);
     }
 }
 public function handleDeleteAllSummitEntityEventsAction($gridField, $request)
 {
     $summit_id = intval($request->param("ID"));
     $controller = $gridField->getForm()->Controller();
     $this->gridField = $gridField;
     $summit = Summit::get()->byID($summit_id);
     $status = 404;
     if (!is_null($summit)) {
         $status = 200;
         DB::query("DELETE FROM SummitEntityEvent WHERE SummitID = {$summit_id} ;");
     }
     $response = new SS_HTTPResponse();
     $response->setStatusCode($status);
     return $response;
 }
 /**
  * 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();
     }
 }
 /**
  * @return string[]
  */
 public function toSQL()
 {
     $primary_id = $this->primary_id;
     $dupe_id = $this->dupe_id;
     $primary = Member::get()->byID($primary_id);
     $dupe = Member::get()->byID($dupe_id);
     $queries = array();
     $summits = Summit::get();
     foreach ($summits as $summit) {
         if ($dupe->isAttendee($summit->ID) && !$primary->isAttendee($summit->ID)) {
             // move
             array_push($queries, "UPDATE SummitAttendee SET MemberID = {$primary_id} WHERE MemberID = {$dupe_id} AND SummitID = {$summit->ID};");
         }
     }
     return $queries;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $summits = Summit::get();
     $SummitDropDownField = new DropdownField("SummitID", "Summit", $summits->map("ID", "Name"));
     $fields->addFieldToTab('Root.Main', $SummitDropDownField);
     //google analitycs tracking params
     $fields->addFieldToTab("Root.GoogleAnalitycs", new TextField("GAConversionId", "Conversion Id", "994798451"));
     $fields->addFieldToTab("Root.GoogleAnalitycs", new TextField("GAConversionLanguage", "Conversion Language", "en"));
     $fields->addFieldToTab("Root.GoogleAnalitycs", new TextField("GAConversionFormat", "Conversion Format", "3"));
     $fields->addFieldToTab("Root.GoogleAnalitycs", new ColorField("GAConversionColor", "Conversion Color", "ffffff"));
     $fields->addFieldToTab("Root.GoogleAnalitycs", new TextField("GAConversionLabel", "Conversion Label", "IuM5CK3OzQYQ89at2gM"));
     $fields->addFieldToTab("Root.GoogleAnalitycs", new TextField("GAConversionValue", "Conversion Value", "0"));
     $fields->addFieldToTab("Root.GoogleAnalitycs", new CheckboxField("GARemarketingOnly", "Remarketing Only"));
     return $fields;
 }
Пример #7
0
 /**
  * @param SS_HTTPRequest $r
  * @return SS_HTTPResponse|void
  * @throws SS_HTTPResponse_Exception
  */
 public function handleSummit(SS_HTTPRequest $r)
 {
     if ($r->param('ID') == "active") {
         $summit = Summit::get_active();
     } else {
         $summit = Summit::get()->byID($r->param('ID'));
     }
     if (!$summit) {
         return $this->httpError(404, "That summit could not be found.");
     }
     if (!$summit->exists()) {
         return $this->httpError(404, "There is no active summit.");
     }
     $data = $summit->toJSON();
     $data['status'] = $summit->getStatus();
     $data['on_voting_period'] = $summit->isVotingOpen();
     $data['on_selection_period'] = $summit->isSelectionOpen();
     $data['is_selection_period_over'] = $summit->isSelectionOver();
     $data['categories'] = [];
     $data['track_chair'] = $this->trackChairDetails();
     $chairlist = [];
     $categoriesIsChair = [];
     $categoriesNotChair = [];
     foreach ($summit->Categories()->filter('ChairVisible', true) as $c) {
         $isChair = $c->isTrackChair(Member::currentUserID()) === 1;
         $categoryDetials = ['id' => $c->ID, 'title' => $c->Title, 'description' => $c->Description, 'session_count' => $c->SessionCount, 'alternate_count' => $c->AlternateCount, 'summit_id' => $c->SummitID, 'user_is_chair' => $isChair];
         if ($isChair) {
             $categoriesIsChair[] = $categoryDetials;
         } else {
             $categoriesNotChair[] = $categoryDetials;
         }
         $chairs = $c->TrackChairs();
         foreach ($chairs as $chair) {
             $chairdata = [];
             $chairdata['chair_id'] = $chair->ID;
             $chairdata['first_name'] = $chair->Member()->FirstName;
             $chairdata['last_name'] = $chair->Member()->Surname;
             $chairdata['email'] = $chair->Member()->Email;
             $chairdata['category'] = $c->Title;
             $chairdata['category_id'] = $c->ID;
             $chairlist[] = $chairdata;
         }
     }
     $data['categories'] = array_merge($categoriesIsChair, $categoriesNotChair);
     $data['chair_list'] = $chairlist;
     return $this->ok($data);
 }
 protected function validate()
 {
     $valid = parent::validate();
     if (!$valid->valid()) {
         return $valid;
     }
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $summit = Summit::get()->byID($summit_id);
     if (!$summit) {
         return $valid->error('Invalid Summit!');
     }
     $count = intval(SummitTicketType::get()->filter(array('SummitID' => $summit->ID, 'Name' => trim($this->Name), 'ID:ExactMatch:not' => $this->ID))->count());
     if ($count > 0) {
         return $valid->error(sprintf('Summit Ticket Type "%s" already exists!. please set another one', $this->Name));
     }
     return $valid;
 }
Пример #9
0
 public function CountdownDigits($current_submit_id = 0)
 {
     $summit = $current_submit_id > 0 ? Summit::get()->byId($current_submit_id) : $this->Summit();
     if (is_null($summit)) {
         return null;
     }
     $date = $summit->obj('SummitBeginDate');
     if ($date->InPast()) {
         return;
     }
     $exploded_date = explode(' ', $date->TimeDiffIn('days'), 3);
     $days = str_pad($exploded_date[0], 3, '0', STR_PAD_LEFT);
     $html = '';
     foreach (str_split($days) as $digit) {
         $html .= sprintf('<span>%s</span>', $digit);
     }
     return $html;
 }
Пример #10
0
 public function handleSummit(SS_HTTPRequest $r)
 {
     if ($r->param('ID') == "active") {
         $summit = Summit::get_active();
     } else {
         $summit = Summit::get()->byID($r->param('ID'));
     }
     if (!$summit) {
         return $this->httpError(404, "That summit could not be found.");
     }
     if (!$summit->exists()) {
         return $this->httpError(404, "There is no active summit.");
     }
     $data = $summit->toJSON();
     $data['status'] = $summit->getStatus();
     $data['categories'] = array();
     $data['track_chair'] = $this->trackChairDetails();
     $chairlist = array();
     $categoriesIsChair = array();
     $categoriesNotChair = array();
     foreach ($summit->Categories()->filter('ChairVisible', TRUE) as $c) {
         $isChair = $c->isTrackChair(Member::currentUserID()) == 1;
         $categoryDetials = array('id' => $c->ID, 'title' => $c->Title, 'description' => $c->Description, 'session_count' => $c->SessionCount, 'alternate_count' => $c->AlternateCount, 'summit_id' => $c->SummitID, 'user_is_chair' => $isChair);
         if ($isChair) {
             $categoriesIsChair[] = $categoryDetials;
         } else {
             $categoriesNotChair[] = $categoryDetials;
         }
         $chairs = $c->TrackChairs();
         foreach ($chairs as $chair) {
             $chairdata = array();
             $chairdata['first_name'] = $chair->Member()->FirstName;
             $chairdata['last_name'] = $chair->Member()->Surname;
             $chairdata['email'] = $chair->Member()->Email;
             $chairdata['category'] = $c->Title;
             $chairlist[] = $chairdata;
         }
     }
     $data['categories'] = array_merge($categoriesIsChair, $categoriesNotChair);
     $data['chair_list'] = $chairlist;
     return (new SS_HTTPResponse(Convert::array2json($data), 200))->addHeader('Content-Type', 'application/json');
 }
Пример #11
0
 public function handleSummit(SS_HTTPRequest $r)
 {
     if ($r->param('ID') == "active") {
         $summit = Summit::get_active();
     } else {
         $summit = Summit::get()->byID($r->param('ID'));
     }
     if (!$summit) {
         return $this->httpError(404, "That summit could not be found.");
     }
     if (!$summit->exists()) {
         return $this->httpError(404, "There is no active summit.");
     }
     $data = $summit->toJSON();
     $data['status'] = $summit->getStatus();
     $data['categories'] = array();
     foreach ($summit->getCategories() as $c) {
         $data['categories'][] = $c->toJSON();
     }
     return (new SS_HTTPResponse(Convert::array2json($data), 200))->addHeader('Content-Type', 'application/json');
 }
 public function handleUpdateDefaultCategoryTags($grid, $request, $data = null)
 {
     $summit_id = intval($request->param('ID'));
     if ($summit_id > 0 && ($summit = Summit::get()->byID($summit_id))) {
         $default_tags = $summit->CategoryDefaultTags();
         foreach ($summit->Categories() as $category) {
             $category_tags = $category->AllowedTags()->filter('IsDefault', 0);
             $category->AllowedTags()->filter('IsDefault', 1)->removeAll();
             foreach ($default_tags as $dtag) {
                 $found_tag = $category_tags->find('TagID', $dtag->TagID);
                 if ($found_tag && $found_tag->Group == $dtag->Group) {
                     continue;
                 }
                 if (!$found_tag) {
                     $found_tag = $dtag;
                 }
                 $category->AllowedTags()->remove($found_tag);
                 $category->AllowedTags()->add($dtag, array('Group' => $dtag->Group, 'IsDefault' => 1));
             }
         }
     }
 }
Пример #13
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('HeaderArea', 'Page Header Area'), 'Content');
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('Sidebar', 'Right Sidebar Content'));
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('HeadlineSponsors', 'Headline Sponsors'));
     $summits = Summit::get();
     $SummitDropDownField = new DropdownField("SummitID", "Summit", $summits->map("ID", "Name"));
     $fields->addFieldToTab('Root.Main', $SummitDropDownField);
     //Google Conversion Tracking params
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionId", "Conversion Id", "994798451"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionLanguage", "Conversion Language", "en"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionFormat", "Conversion Format", "3"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new ColorField("GAConversionColor", "Conversion Color", "ffffff"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionLabel", "Conversion Label", "IuM5CK3OzQYQ89at2gM"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionValue", "Conversion Value", "0"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new CheckboxField("GARemarketingOnly", "Remarketing Only"));
     //Facebook Conversion Params
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBPixelId", "Pixel Id", "6013247449963"));
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBValue", "Value", "0.00"));
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBCurrency", "Currency", "USD"));
     return $fields;
 }
 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.";
 }
Пример #15
0
 public function getAllowedSchedule()
 {
     $summit = $this->Summit();
     if (is_null($summit)) {
         $summit = Summit::get()->byID(intval($_REQUEST['SummitID']));
     }
     return SummitEvent::get()->filter(array('Published' => true, 'SummitID' => $summit->ID));
 }
 public function scheduleView(SS_HTTPRequest $request)
 {
     Requirements::css('summit/css/simple-sidebar.css');
     // Requirements::css('summit/css/summit-admin-schedule.css');
     Requirements::css('themes/openstack/bower_assets/jquery-ui/themes/smoothness/jquery-ui.min.css');
     Requirements::css('themes/openstack/bower_assets/sweetalert/dist/sweetalert.css');
     Requirements::javascript('summit/javascript/simple-sidebar.js');
     Requirements::javascript('themes/openstack/javascript/bootstrap-paginator/src/bootstrap-paginator.js');
     Requirements::javascript('themes/openstack/bower_assets/sweetalert/dist/sweetalert.min.js');
     Requirements::javascript('themes/openstack/javascript/jquery-ajax-loader.js');
     $summit_id = intval($this->request->param('SummitID'));
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit) || $summit->ID <= 0) {
         return $this->httpError(404);
     }
     return $this->getViewer('scheduleView')->process($this, array('Summit' => $summit));
 }
 /**
  * @param int $summit_id
  * @return array
  */
 public function getCurrentPublished($summit_id)
 {
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         throw new InvalidArgumentException('summit not found!');
     }
     $current_date = gmdate('d/m/Y H:i:s');
     $list = SummitEvent::get()->filter(array('SummitID' => $summit_id, 'Published' => 1))->where("StartDate < '{$current_date}' AND EndDate > '{$current_date}'");
     return $list;
 }
 /**
  * @param array $params
  * @return array
  */
 public function getSummits($params = [])
 {
     $summits = Summit::get()->filter('SummitBeginDate:LessThan', SS_DateTime::now()->Rfc2822())->sort('SummitBeginDate DESC');
     $response = ['results' => []];
     foreach ($summits as $s) {
         $response['results'][] = $this->createSummitJSON($s);
     }
     return $response;
 }
Пример #19
0
 public function AlternatePresentations($summit_id = null)
 {
     $AlternatePresentations = new ArrayList();
     $summit = is_null($summit_id) ? Summit::get_active() : Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         return false;
     }
     $Presentations = $this->Presentations('`SummitID` = ' . $summit->ID);
     foreach ($Presentations as $Presentation) {
         if ($Presentation->SelectionStatus() == "alternate") {
             $AlternatePresentations->push($Presentation);
         }
     }
     return $AlternatePresentations;
 }
 function ExportSpeakersData()
 {
     $this->Title = 'Export Speakers Data';
     if ($_SERVER['REQUEST_METHOD'] === 'GET') {
         $summits = Summit::get();
         return $this->owner->getViewer('ExportSpeakersData')->process($this->owner->Customise(array("Summits" => $summits)));
     } else {
         if ($_SERVER['REQUEST_METHOD'] === 'POST') {
             $summits = Summit::get();
             $selectedSummits = array();
             foreach ($summits as $summit) {
                 if (isset($_POST["summit_" . $summit->ID])) {
                     $selectedSummits[] = $summit->ID;
                 }
             }
             $onlyApprovedSpeakers = isset($_POST["onlyApprovedSpeakers"]);
             $affiliation = $_POST["affiliation"];
             $speakersExportQuerySpecification = new SpeakersExportQuerySpecification($selectedSummits, $onlyApprovedSpeakers, $affiliation);
             $speakersExportQuery = new SpeakersExportQuery();
             $res = $speakersExportQuery->handle($speakersExportQuerySpecification);
             $ext = $_POST['ext'];
             $filename = "PresentationSpeakers_" . date('Ymd') . "." . $ext;
             $delimiter = ",";
             return CSVExporter::getInstance()->export($filename, $res->getResult()[0], $delimiter);
         }
     }
 }
 /**
  * @param int $summit_id
  * @param $start_date
  * @param $end_date
  * @return array
  */
 public function getPublishedByTimeFrame($summit_id, $start_date, $end_date)
 {
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         throw new InvalidArgumentException('summit not found!');
     }
     $start_date = $summit->convertDateFromTimeZone2UTC($start_date);
     $end_date = $summit->convertDateFromTimeZone2UTC($end_date);
     $list = SummitEvent::get()->filter(array('SummitID' => $summit_id, 'Published' => 1))->where("StartDate < '{$end_date}' AND EndDate > '{$start_date}'");
     return $list->toArray();
 }
 /**
  * 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!');
     }
     $client = new GuzzleHttp\Client();
     $query = array('api_key' => SCHED_API_KEY, 'format' => 'json');
     $response = $client->get("http://openstacksummitoctober2015tokyo.sched.org/api/session/list", 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!');
     }
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         throw new InvalidArgumentException('missing summit_id param!');
     }
     $json = $response->getBody()->getContents();
     $events = json_decode($json, true);
     foreach ($events as $sched_event) {
         try {
             if ($sched_event["active"] !== "Y") {
                 continue;
             }
             $title = $sched_event["name"];
             $start_date = $sched_event["event_start"];
             $end_date = $sched_event["event_end"];
             $event_type = isset($sched_event["event_type"]) ? $sched_event["event_type"] : $title;
             $venue = $sched_event["venue"];
             $event = SummitEvent::get()->filter(array("SummitID" => $summit_id, "Title" => trim($title), "StartDate" => $summit->convertDateFromTimeZone2UTC($start_date), "EndDate" => $summit->convertDateFromTimeZone2UTC($end_date)))->first();
             if (is_null($event)) {
                 $event = SummitEvent::get()->filter(array("SummitID" => $summit_id, "Title" => trim($title)))->first();
             }
             $location = SummitVenueRoom::get()->filter(array("SummitID" => $summit_id, "Name" => trim($venue)))->first();
             if (is_null($location) && $venue !== 'TBA') {
                 // create location
                 $main_venue = SummitVenue::get()->filter(array("SummitID" => $summit_id))->first();
                 $location = new SummitVenueRoom();
                 $location->SummitID = $summit_id;
                 $location->Name = trim($venue);
                 $location->VenueID = $main_venue->ID;
                 $location->write();
             }
             if (is_null($event)) {
                 // create event and event type ...
                 if (isset($sched_event['speakers'])) {
                     continue;
                 }
                 $type = SummitEventType::get()->filter(array("SummitID" => $summit_id, "Type" => trim($event_type)))->first();
                 if (is_null($type)) {
                     $type = new SummitEventType();
                     $type->SummitID = $summit_id;
                     $type->Type = trim($event_type);
                     $type->write();
                 }
                 $event = new SummitEvent();
                 $event->TypeID = $type->ID;
                 $event->SummitID = $summit_id;
                 $event->Title = trim($title);
                 $event->write();
             }
             $event->StartDate = $start_date;
             $event->EndDate = $end_date;
             if (!is_null($location)) {
                 $event->LocationID = $location->ID;
             }
             $event->write();
             if ($event->isPublished()) {
                 continue;
             }
             $event_id = $event->ID;
             if (intval($event->AllowedSummitTypes()->count()) === 0) {
                 DB::query("INSERT INTO SummitEvent_AllowedSummitTypes\n(SummitEventID, SummitTypeID)\nSELECT SummitEvent.ID, SummitType.ID FROM SummitEvent, SummitType WHERE SummitEvent.ID = {$event_id} ;\n");
             }
             $event->publish();
             $event->write();
         } catch (ValidationException $ex) {
             SS_Log::log($ex->getMessage(), SS_Log::ERR);
         }
     }
 }
 /**
  * @param null $summit_id
  * @param string $role
  * @return ArrayList|bool
  */
 public function AlternatePresentations($summit_id = null, $role = IPresentationSpeaker::RoleSpeaker)
 {
     $alternatePresentations = new ArrayList();
     $summit = is_null($summit_id) ? Summit::get_active() : Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         return false;
     }
     $presentations = $role == IPresentationSpeaker::RoleSpeaker ? $this->Presentations()->filter('SummitEvent.SummitID', $summit->ID) : Presentation::get()->filter(['SummitEvent.SummitID' => $summit->ID, 'ModeratorID' => $this->ID]);
     foreach ($presentations as $p) {
         if ($p->SelectionStatus() == IPresentation::SelectionStatus_Alternate && !$p->isPublished()) {
             $alternatePresentations->push($p);
         }
     }
     return $alternatePresentations;
 }
 public function room_metrics(SS_HTTPRequest $request)
 {
     $summit_id = intval($request->param('SummitID'));
     $summit = Summit::get()->byID($summit_id);
     Requirements::css('summit/css/simple-sidebar.css');
     Requirements::css('summit/css/summit-admin-room-metrics.css');
     Requirements::css('themes/openstack/bower_assets/sweetalert/dist/sweetalert.css');
     Requirements::css('themes/openstack/bower_assets/jquery-ui/themes/smoothness/jquery-ui.css');
     Requirements::css("themes/openstack/bower_assets/jqplot-bower/dist/jquery.jqplot.min.css");
     Requirements::javascript("themes/openstack/bower_assets/jqplot-bower/dist/jquery.jqplot.min.js");
     Requirements::javascript("themes/openstack/bower_assets/jqplot-bower/dist/plugins/jqplot.canvasTextRenderer.min.js");
     Requirements::javascript("themes/openstack/bower_assets/jqplot-bower/dist/plugins/jqplot.canvasAxisLabelRenderer.min.js");
     Requirements::javascript("themes/openstack/bower_assets/jqplot-bower/dist/plugins/jqplot.dateAxisRenderer.min.js");
     Requirements::javascript("themes/openstack/bower_assets/jqplot-bower/dist/plugins/jqplot.highlighter.min.js");
     Requirements::javascript("themes/openstack/bower_assets/jqplot-bower/dist/plugins/jqplot.cursor.min.js");
     Requirements::javascript('themes/openstack/bower_assets/sweetalert/dist/sweetalert.min.js');
     Requirements::javascript('summit/javascript/simple-sidebar.js');
     Requirements::javascript('themes/openstack/javascript/jquery-ajax-loader.js');
     $current_events = $this->event_repository->getCurrentPublished($summit_id);
     $current_events = SummitEvent::get()->where("ID = 14960");
     return $this->getViewer('room_metrics')->process($this->customise(array('Summit' => $summit, 'Events' => $current_events)));
 }
Пример #25
0
    /**
     * @return ValidationResult
     */
    protected function validate()
    {
        if (!$this->TypeID) {
            $this->assignEventType();
        }
        $valid = parent::validate();
        if (!$valid->valid()) {
            return $valid;
        }
        $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
        $summit = Summit::get()->byID($summit_id);
        // validate that each speakers is assigned one time at one location
        $start_date = $summit->convertDateFromTimeZone2UTC($this->getStartDate());
        $end_date = $summit->convertDateFromTimeZone2UTC($this->getEndDate());
        $presentation_id = $this->getIdentifier();
        $location_id = $this->LocationID;
        $speakers_id = array();
        $speakers = $this->Speakers();
        foreach ($speakers as $speaker) {
            array_push($speakers_id, $speaker->ID);
        }
        $speakers_id = implode(', ', $speakers_id);
        if (empty($start_date) || empty($end_date) || empty($speakers_id)) {
            return $valid;
        }
        $query = <<<SQL
SELECT COUNT(P.ID) FROM Presentation P
INNER JOIN SummitEvent E ON E.ID = P.ID
WHERE
E.Published = 1              AND
E.StartDate <= '{$end_date}'  AND
'{$start_date}' <= E.EndDate AND
E.ID <> {$presentation_id}     AND
E.LocationID = {$location_id}  AND
E.LocationID <> 0            AND
EXISTS
(
\tSELECT PS.ID FROM Presentation_Speakers PS WHERE PresentationSpeakerID IN ({$speakers_id}) AND
\tPresentationID = P.ID
);
SQL;
        $qty = intval(DB::query($query)->value());
        if ($qty > 0) {
            return $valid->error('There is a speaker assigned to another presentation on that date/time range !');
        }
        return $valid;
    }
Пример #26
0
 /**
  * @return string
  */
 public function getEndDate()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $summit = Summit::get()->byID($summit_id);
     if (is_null($summit)) {
         throw new InvalidArgumentException('summit not found!');
     }
     $value = $this->getField('EndDate');
     return $summit->convertDateFromUTC2TimeZone($value);
 }
Пример #27
0
 /**
  * @param int $summit_id
  * @throws ValidationException
  * @throws null
  */
 public static function seedSummitTypes($summit_id)
 {
     $summit = Summit::get()->byID($summit_id);
     if (!SummitType::get()->filter(array('Title' => 'Main Conference', 'SummitID' => $summit_id))->first()) {
         $main_type = new SummitType();
         $main_type->Title = 'Main Conference';
         $main_type->Description = 'This Schedule is for general attendees. Its includes breakout tracks, hand-ons labs, keynotes and sponsored sessions';
         $main_type->Audience = 'General Attendees';
         $main_type->SummitID = $summit_id;
         $main_type->StartDate = $summit->BeginDate;
         $main_type->EndDate = $summit->EndDate;
         $main_type->Type = 'MAIN';
         $main_type->write();
     }
     if (!SummitType::get()->filter(array('Title' => 'Design Summit', 'SummitID' => $summit_id))->first()) {
         $design_type = new SummitType();
         $design_type->Title = 'Design Summit';
         $design_type->Description = 'This Schedule is specifically for developers and operators who contribute to the roadmap for the N release cycle. The Design Summit is not a classic track with speakers and presentations and its not the right place to get started or learn the basics of OpenStack. This schedule also Includes the Main Conference Sessions';
         $design_type->Audience = 'Developers And Operators';
         $design_type->SummitID = $summit_id;
         $design_type->StartDate = $summit->BeginDate;
         $design_type->EndDate = $summit->EndDate;
         $design_type->Type = 'DESIGN';
         $design_type->write();
     }
 }
 /**
  * Reverses the migration
  */
 public function doDown()
 {
     foreach (Presentation::get()->filter('Legacy', true) as $p) {
         $p->Speakers()->setByIdList(array());
         foreach ($p->Materials()->filter('ClassName', 'PresentationVideo') as $material) {
             echo "Deleted video # " . $material->ID . $this->br();
             $material->delete();
         }
         echo "Deleted presentation # " . $p->ID . $this->br();
         $p->delete();
     }
     if (!Presentation::get()->filter('Legacy', true)->exists()) {
         echo "Deleted all legacy presentations" . $this->br();
     } else {
         echo "*** FAIL: Did not delete all legacy presentations" . $this->br();
     }
     foreach (PresentationSpeaker::get()->filter('Notes', '[LEGACY]') as $speaker) {
         $speaker->delete();
     }
     if (!PresentationSpeaker::get()->filter('Notes', '[LEGACY]')->exists()) {
         echo "Deleted all legacy speakers" . $this->br();
     } else {
         echo "*** FAIL: Did not delete all legacy speakers" . $this->br();
     }
     Summit::get()->filter('Title', ['San Diego', 'Portland', 'Atlanta'])->removeAll();
     if (!Summit::get()->filter('Title', ['San Diego', 'Portland', 'Atlanta'])->exists()) {
         echo "Deleted legacy summits" . $this->br();
     } else {
         echo "*** FAIL: Did not delete legacy summits" . $this->br();
     }
 }
Пример #29
0
 protected function validate()
 {
     $valid = parent::validate();
     if (!$valid->valid()) {
         return $valid;
     }
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $summit = Summit::get()->byID($summit_id);
     if (!$summit) {
         return $valid->error('Invalid Summit!');
     }
     $start_date = $this->getStartDate();
     $end_date = $this->getEndDate();
     if (empty($start_date) || empty($end_date)) {
         return $valid->error('You must define a start/end datetime!');
     }
     if (!empty($start_date) && !empty($end_date)) {
         $start_date = new DateTime($start_date);
         $end_date = new DateTime($end_date);
         if ($end_date < $start_date) {
             return $valid->error('start datetime must be greather or equal than end datetime!');
         }
         if (!$summit->isEventInsideSummitDuration($this)) {
             return $valid->error(sprintf('start/end datetime must be between summit start/end datetime! (%s - %s)', $summit->getBeginDate(), $summit->getEndDate()));
         }
     }
     return $valid;
 }
 /**
  * @param string $external_event_id
  * @return ISummit
  */
 public function getByExternalEventId($external_event_id)
 {
     return Summit::get()->filter('ExternalEventId', $external_event_id)->first();
 }