getStart() 공개 메소드

Returns the timestamp of the start of the time period this free busy information covers.
public getStart ( ) : integer
리턴 integer A timestamp.
예제 #1
0
파일: FreeBusy.php 프로젝트: horde/horde
 /**
  * Converts free/busy data to a simple object suitable to be transferred
  * as json.
  *
  * @param Horde_Icalendar_Vfreebusy $fb  A Free/busy component.
  *
  * @return object  A simple object representation.
  */
 public static function toJson(Horde_Icalendar_Vfreebusy $fb)
 {
     $json = new stdClass();
     $start = $fb->getStart();
     if ($start) {
         $start = new Horde_Date($start);
         $json->s = $start->dateString();
     }
     $end = $fb->getEnd();
     if ($end) {
         $end = new Horde_Date($end);
         $json->e = $end->dateString();
     }
     $b = $fb->getBusyPeriods();
     if (empty($b)) {
         $b = new StdClass();
     }
     $new = new StdClass();
     foreach ($b as $from => $to) {
         $from = new Horde_Date($from);
         $to = new Horde_Date($to);
         $new->{$from->toJson()} = $to->toJson();
     }
     $json->b = $new;
     return $json;
 }
예제 #2
0
파일: View.php 프로젝트: horde/horde
 /**
  * Render the blocks
  *
  * @param Horde_Icalendar_Vfreebusy $member  Member's freebusy info
  * @param array $periods                     Free periods
  * @param string $blockfile                  Template file to use for blocks
  * @param string $label                      Label to use
  *
  * @return string  The block html
  */
 protected function _getBlocks($member, $periods, $blockfile, $label)
 {
     $template = $GLOBALS['injector']->createInstance('Horde_Template');
     $template->set('label', $label);
     reset($periods);
     list($periodStart, $periodEnd) = each($periods);
     $blocks = '';
     foreach ($this->_timeBlocks as $span) {
         /* Horde_Icalendar_Vfreebusy only supports timestamps at the
          * moment. */
         $start = $span[0]->timestamp();
         $end = $span[1]->timestamp();
         if ($member->getStart() > $start || $member->getEnd() < $end) {
             $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/unknownblock.html');
             continue;
         }
         while ($start > $periodEnd && (list($periodStart, $periodEnd) = each($periods))) {
         }
         if ($periodStart <= $start && $periodEnd >= $start || $periodStart <= $end && $periodEnd >= $end || $periodStart <= $start && $periodEnd >= $end || $periodStart >= $start && $periodEnd <= $end) {
             $l_start = $periodStart < $start ? $start : $periodStart;
             $l_end = $periodEnd > $end ? $end : $periodEnd;
             $plen = ($end - $start) / 100.0;
             $left = ($l_start - $start) / $plen;
             $width = ($l_end - $l_start) / $plen;
             $template->set('left', $left . '%');
             $template->set('width', $width . '%');
             $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/' . $blockfile);
         } else {
             $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/emptyblock.html');
         }
     }
     return $blocks;
 }
예제 #3
0
파일: FreeBusy.php 프로젝트: DSNS-LAB/Dmail
 /**
  * Converts free/busy data to a simple object suitable to be transferred
  * as json.
  *
  * @param Horde_Icalendar_Vfreebusy $fb  A Free/busy component.
  *
  * @return object  A simple object representation.
  */
 public static function toJson(Horde_Icalendar_Vfreebusy $fb)
 {
     $json = new stdClass();
     $start = $fb->getStart();
     if ($start) {
         $start = new Horde_Date($start);
         $json->s = $start->dateString();
     }
     $end = $fb->getEnd();
     if ($end) {
         $end = new Horde_Date($end);
         $json->e = $end->dateString();
     }
     $b = $fb->getBusyPeriods();
     if (empty($b)) {
         $b = new StdClass();
     }
     $json->b = $b;
     return $json;
 }