コード例 #1
0
 protected function valueForType($type, $value)
 {
     $valueForType = $value;
     switch ($type) {
         case 'datetime':
             $valueForType = DateFormatter::formatDateRange($value, DateFormatter::LONG_STYLE, DateFormatter::NO_STYLE);
             if ($value instanceof TimeRange) {
                 $timeString = DateFormatter::formatDateRange($value, DateFormatter::NO_STYLE, DateFormatter::MEDIUM_STYLE);
                 $valueForType .= "<br />\n" . $timeString;
             }
             break;
         case 'url':
             $valueForType = str_replace("http://*****:*****@', '@&shy;', $value);
             break;
         case 'category':
             $valueForType = $this->ucname($value);
             break;
     }
     return $valueForType;
 }
コード例 #2
0
 public static function timeText($event, $timeOnly = false)
 {
     if ($timeOnly) {
         if ($event->getEnd() - $event->getStart() == -1) {
             return DateFormatter::formatDate($event->getStart(), DateFormatter::NO_STYLE, DateFormatter::SHORT_STYLE);
         } else {
             return DateFormatter::formatDateRange($event->getRange(), DateFormatter::NO_STYLE, DateFormatter::SHORT_STYLE);
         }
     } else {
         return DateFormatter::formatDateRange($event->getRange(), DateFormatter::SHORT_STYLE, DateFormatter::SHORT_STYLE);
     }
 }
コード例 #3
0
ファイル: AthleticsAPIModule.php プロジェクト: nncsang/Kurogo
 protected function timeText(AthleticEvent $event, $timeOnly = false)
 {
     return DateFormatter::formatDateRange($event->getRange(), DateFormatter::SHORT_STYLE, DateFormatter::SHORT_STYLE);
 }
コード例 #4
0
ファイル: DayRange.php プロジェクト: nncsang/Kurogo
 public function __toString()
 {
     return DateFormatter::formatDateRange($this, DateFormatter::MEDIUM_STYLE, DateFormatter::NO_STYLE);
 }
コード例 #5
0
 public function getScheduleLinks($timeRange, $data = null)
 {
     $events = $this->getEvents($timeRange);
     $scheduleLinks = array();
     foreach ($events as $event) {
         $subtitle = DateFormatter::formatDateRange($event, DateFormatter::NO_STYLE, DateFormatter::SHORT_STYLE);
         $options = array('id' => $this->getID(), 'time' => $event->get_start());
         if (isset($data['section'])) {
             $options['section'] = $data['section'];
         }
         if (isset($data['groupID'])) {
             $options['groupID'] = $data['groupID'];
         }
         $class = '';
         if ($data['showDetail']) {
             $url = $this->buildBreadcrumbURL('schedule', $options, true);
         } else {
             $url = false;
         }
         if ($event->contains(new TimeRange(time()))) {
             $class = 'open';
         } else {
             $class = 'closed';
         }
         $scheduleLinks[] = array('title' => $class, 'subtitle' => $subtitle, 'url' => $url, 'listclass' => $class);
     }
     return $scheduleLinks;
 }