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


PHP Kurogo::siteTimezone方法代码示例

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


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

示例1: getCurrentEvents

 public function getCurrentEvents($currentTime = null)
 {
     if (is_null($currentTime)) {
         $currentTime = time();
     }
     $start = new DateTime(date('Y-m-d H:i:s', $currentTime), Kurogo::siteTimezone());
     $end = clone $start;
     $this->setStartDate($start);
     $this->setEndDate($end);
     $calendar = $this->getCalendar();
     $startTimestamp = $this->startTimestamp() ? $this->startTimestamp() : CalendarDataModel::START_TIME_LIMIT;
     $endTimestamp = $this->endTimestamp() ? $this->endTimestamp() : CalendarDataModel::END_TIME_LIMIT;
     $range = new TimeRange($startTimestamp, $endTimestamp);
     $events = $calendar->getEventsInRange($range);
     return $events;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:16,代码来源:EventsDataModel.php

示例2: initialize

 protected function initialize()
 {
     $this->timezone = Kurogo::siteTimezone();
 }
开发者ID:narenv,项目名称:Kurogo-Mobile-Web,代码行数:4,代码来源:CalendarWebModule.php

示例3: initializeForCommand

 public function initializeForCommand()
 {
     $this->timezone = Kurogo::siteTimezone();
     $this->fieldConfig = $this->getAPIConfigData('detail');
     switch ($this->command) {
         case 'index':
         case 'groups':
             $response = $this->getFeedsByType();
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
         case 'events':
             $type = $this->getArg('type', 'static');
             // the calendar argument needs to be urlencoded
             $calendar = $this->getArg('calendar', $this->getDefaultFeed($type));
             // default to the full day that includes current time
             $current = $this->getArg('time', time());
             $start = $this->getStartArg($current);
             $end = $this->getEndArg($start->getTimestamp());
             $feed = $this->getFeed($calendar, $type);
             $feed->setStartDate($start);
             $feed->setEndDate($end);
             $iCalEvents = $feed->items();
             $events = array();
             $count = 0;
             foreach ($iCalEvents as $iCalEvent) {
                 $events[] = $this->apiArrayFromEvent($iCalEvent);
                 $count++;
             }
             $response = array('total' => $count, 'returned' => $count, 'displayField' => 'title', 'results' => $events);
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
         case 'detail':
             $eventID = $this->getArg('id', null);
             if (!$eventID) {
                 $error = new KurogoError(5, 'Invalid Request', 'Invalid id parameter supplied');
                 $this->throwError($error);
             }
             // default to the full day that includes current time
             $current = $this->getArg('time', time());
             $start = $this->getStartArg($current);
             $end = $this->getEndArg($start->getTimestamp());
             $type = $this->getArg('type', 'static');
             $calendar = $this->getArg('calendar', $this->getDefaultFeed($type));
             $feed = $this->getFeed($calendar, $type);
             $feed->setStartDate($start);
             $feed->setEndDate($end);
             if ($filter = $this->getArg('q')) {
                 $feed->addFilter('search', $filter);
             }
             if ($catid = $this->getArg('catid')) {
                 $feed->addFilter('category', $catid);
             }
             if ($event = $feed->getEvent($this->getArg('id'))) {
                 $eventArray = $this->apiArrayFromEvent($event);
                 $this->setResponse($eventArray);
                 $this->setResponseVersion(1);
             } else {
                 $error = new KurogoError(self::ERROR_NO_SUCH_EVENT, 'Invalid Request', "The event {$eventID} cannot be found");
                 $this->throwError($error);
             }
             break;
         case 'search':
             $filter = $this->getArg('q', null);
             if ($filter) {
                 $searchTerms = trim($filter);
                 $current = $this->getArg('time', time());
                 $start = $this->getStartArg($current);
                 $end = $this->getEndArg($start->getTimestamp());
                 $type = $this->getArg('type', 'static');
                 $calendar = $this->getArg('calendar', $this->getDefaultFeed($type));
                 $feed = $this->getFeed($calendar, $type);
                 $feed->setStartDate($start);
                 $feed->setEndDate($end);
                 $feed->addFilter('search', $searchTerms);
                 $iCalEvents = $feed->items();
                 $events = array();
                 $count = 0;
                 foreach ($iCalEvents as $iCalEvent) {
                     $events[] = $this->apiArrayFromEvent($iCalEvent);
                     $count++;
                 }
                 $titleField = 'summary';
                 if (isset($this->fieldConfig['summary'], $this->fieldConfig['summary']['label'])) {
                     $titleField = $this->fieldConfig['summary']['label'];
                 }
                 $response = array('total' => $count, 'returned' => $count, 'displayField' => $titleField, 'results' => $events);
                 $this->setResponse($response);
                 $this->setResponseVersion(1);
             } else {
                 $error = new KurogoError(5, 'Invalid Request', 'Invalid search parameter');
                 $this->throwError($error);
             }
             break;
         case 'calendars':
             $group = $this->getArg('group');
             $response = array();
             foreach ($this->getFeeds($group) as $feedID => $feedData) {
                 $response[] = array('id' => $feedID, 'title' => $feedData['TITLE']);
//.........这里部分代码省略.........
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:101,代码来源:CalendarAPIModule.php

示例4: parseEntry

 protected function parseEntry($entry)
 {
     static $eventNum;
     $eventNum++;
     $event = new CSTVAthleticEvent();
     if ($id = $entry->getAttrib('ID')) {
         $event->setID($id);
     } else {
         $event->setID($eventNum);
     }
     $event->setSport($entry->getProperty('SPORT'));
     $event->setSportName($entry->getProperty('SPORT_FULLNAME'));
     $event->setSchool($entry->getProperty('SCHOOL'));
     $event->setOpponent($entry->getProperty('OPPONENT'));
     $event->setHomeAway($entry->getProperty('HOME_VISITOR'));
     $event->setLocation($entry->getProperty('LOCATION'));
     $event->setScore($entry->getProperty('OUTCOME_SCORE'));
     $event->setLink($entry->getProperty('RECAP'));
     //set the gender
     if ($sportName = $entry->getProperty('SPORT')) {
         $prefix = strtoupper(substr($sportName, 0, 1));
         if ($prefix == 'W' || $prefix == 'M') {
             $event->setGender($prefix);
         }
     }
     //convert the sport datetime
     $sportDate = $entry->getProperty('EVENT_DATE');
     $time = $entry->getProperty('TIME');
     $curtimeZone = $entry->getProperty('TIME_ZONE');
     if ($sportDate) {
         //format the time data
         switch ($time) {
             case 'All Day':
                 $event->setAllDay(true);
                 $time = '';
                 break;
             case 'TBA':
                 $event->setNoTime(true);
                 $time = '';
                 break;
         }
         $strDate = $time ? $sportDate . ' ' . $time : $sportDate;
         if ($timeZoneData = $this->transformTimeZone($curtimeZone)) {
             $timeZone = new DateTimeZone($timeZoneData);
         } else {
             $timeZone = Kurogo::siteTimezone();
         }
         //save the event time to datetime object
         $event->setStartDate(new DateTime($strDate, $timeZone));
     }
     return $event;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:52,代码来源:CSTVDataRetriever.php

示例5: initializeForCommand

 public function initializeForCommand()
 {
     $this->timezone = Kurogo::siteTimezone();
     $this->fieldConfig = $this->getAPIConfigData('detail');
     $responseVersion = $this->requestedVersion < 2 ? 1 : 2;
     switch ($this->command) {
         case 'index':
         case 'groups':
             $response = $this->getFeedsByType();
             $this->setResponse($response);
             $this->setResponseVersion($responseVersion);
             break;
         case 'category':
             if (!$this->getArg('catid', false)) {
                 $error = new KurogoError(5, 'Invalid Request', 'Invalid catid parameter');
                 $this->throwError($error);
             }
             // very similar to events, fallthrough to share code
         // very similar to events, fallthrough to share code
         case 'events':
             $catid = $this->getArg('catid', '');
             $type = $this->getArg('type', 'static');
             // the calendar argument needs to be urlencoded
             $calendar = $this->getArg('calendar', $this->getDefaultFeed($type));
             // default to the full day that includes current time
             $current = $this->getArg('time', time());
             $start = $this->getStartArg($current);
             $feed = $this->getFeed($calendar, $type);
             $feed->setStartDate($start);
             if ($limit = $this->getArg('limit')) {
                 if (!$this->legacyController) {
                     $feed->setLimit($limit);
                 }
             } else {
                 $end = $this->getEndArg($start->format('U'));
                 $feed->setEndDate($end);
             }
             if ($limit && $this->legacyController) {
                 if ($catid) {
                     $feed->addFilter('category', $catid);
                 }
                 $iCalEvents = $feed->items(0, $limit);
             } else {
                 if ($catid) {
                     $iCalEvents = $feed->getEventsByCategory($catid);
                 } else {
                     $iCalEvents = $feed->items();
                 }
             }
             $events = array();
             $count = 0;
             foreach ($iCalEvents as $iCalEvent) {
                 $events[] = $this->apiArrayFromEvent($iCalEvent, $responseVersion);
                 $count++;
             }
             $response = array('total' => $count, 'returned' => $count, 'displayField' => 'title', 'results' => $events);
             $this->setResponse($response);
             $this->setResponseVersion($responseVersion);
             break;
         case 'detail':
             $eventID = $this->getArg('id', null);
             if (!$eventID) {
                 $error = new KurogoError(5, 'Invalid Request', 'Invalid id parameter supplied');
                 $this->throwError($error);
             }
             // default to the full day that includes current time
             $current = $this->getArg('time', time());
             $start = $this->getStartArg($current);
             $end = $this->getEndArg($start->format('U'));
             $type = $this->getArg('type', 'static');
             $calendar = $this->getArg('calendar', $this->getDefaultFeed($type));
             $feed = $this->getFeed($calendar, $type);
             $feed->setStartDate($start);
             if (!($limit = $this->getArg('limit'))) {
                 $feed->setEndDate($end);
             }
             if ($filter = $this->getArg('q')) {
                 $feed->addFilter('search', $filter);
             }
             if ($catid = $this->getArg('catid')) {
                 $feed->addFilter('category', $catid);
             }
             if ($event = $feed->getEvent($this->getArg('id'))) {
                 $eventArray = $this->apiArrayFromEvent($event, $responseVersion);
                 $this->setResponse($eventArray);
                 $this->setResponseVersion($responseVersion);
             } else {
                 $error = new KurogoError(self::ERROR_NO_SUCH_EVENT, 'Invalid Request', "The event {$eventID} cannot be found");
                 $this->throwError($error);
             }
             break;
         case 'search':
             $filter = $this->getArg('q', null);
             if ($filter) {
                 $searchTerms = trim($filter);
                 $current = $this->getArg('time', time());
                 $start = $this->getStartArg($current);
                 $end = $this->getEndArg($start->format('U'));
                 $type = $this->getArg('type', 'static');
                 $calendar = $this->getArg('calendar', $this->getDefaultFeed($type));
//.........这里部分代码省略.........
开发者ID:nncsang,项目名称:Kurogo,代码行数:101,代码来源:CalendarAPIModule.php

示例6: initialize

 protected function initialize()
 {
     $this->timezone = Kurogo::siteTimezone();
     $this->feeds = $this->getModuleSections('feeds');
     $this->SHOW_HOURS_STATUS = $this->getOptionalModuleVar('SHOW_HOURS_STATUS', true);
     $this->SHOW_EVENT_DETAILS = $this->getOptionalModuleVar('SHOW_EVENT_DETAILS', true);
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:7,代码来源:DiningWebModule.php


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