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


PHP DateHelper::getTimestamp方法代码示例

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


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

示例1: GetDataGridData

 public static function GetDataGridData($viewType, $dateString)
 {
     if ($viewType == "now") {
         $date = new DateHelper();
         $timeNow = $date->getTimestamp();
         $startCutoff = 60;
         $endCutoff = 86400;
         //60*60*24 - seconds in a day
     } else {
         $date = new DateHelper();
         $time = $date->getTime();
         $date->setDate($dateString . " " . $time);
         $timeNow = $date->getTimestamp();
         $startCutoff = $date->getNowDayStartDiff();
         $endCutoff = $date->getNowDayEndDiff();
     }
     $data = array();
     $showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
     foreach ($showIds as $showId) {
         $instanceId = $showId['id'];
         $si = new ShowInstance($instanceId);
         $showId = $si->getShowId();
         $show = new Show($showId);
         //append show header row
         $data[] = Application_Model_Nowplaying::CreateHeaderRow($show->getName(), $si->getShowStart(), $si->getShowEnd());
         $scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
         $dataTablesRows = Application_Model_Nowplaying::CreateDatatableRows($scheduledItems);
         //append show audio item rows
         $data = array_merge($data, $dataTablesRows);
         //append show gap time row
         $gapTime = Application_Model_Nowplaying::FormatDuration($si->getShowEndGapTime(), true);
         if ($si->isRecorded()) {
             $data[] = Application_Model_Nowplaying::CreateRecordingRow($si);
         } else {
             if ($gapTime > 0) {
                 $data[] = Application_Model_Nowplaying::CreateGapRow($gapTime);
             }
         }
     }
     return array("currentShow" => Show_DAL::GetCurrentShow($timeNow), "rows" => $data);
 }
开发者ID:romansavrulin,项目名称:Airtime,代码行数:41,代码来源:Nowplaying.php

示例2: populateRepeatingShow

 private static function populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $record, $end_timestamp, $interval)
 {
     global $CC_DBC;
     if (isset($next_pop_date)) {
         $next_date = $next_pop_date . " " . $start_time;
     } else {
         $next_date = $first_show . " " . $start_time;
     }
     $sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id={$show_id}";
     $rebroadcasts = $CC_DBC->GetAll($sql);
     $show = new Show($show_id);
     $date = new DateHelper();
     $currentTimestamp = $date->getTimestamp();
     while (strtotime($next_date) <= strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) {
         $start = $next_date;
         $sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
         $end = $CC_DBC->GetOne($sql);
         if ($show->hasInstanceOnDate($start)) {
             $ccShowInstance = $show->getInstanceOnDate($start);
             $newInstance = false;
         } else {
             $ccShowInstance = new CcShowInstances();
             $newInstance = true;
         }
         /* When editing the start/end time of a repeating show, we don't want to
          * change shows that started in the past. So check the start time.
          */
         if ($newInstance || $ccShowInstance->getDbStarts() > $currentTimestamp) {
             $ccShowInstance->setDbShowId($show_id);
             $ccShowInstance->setDbStarts($start);
             $ccShowInstance->setDbEnds($end);
             $ccShowInstance->setDbRecord($record);
             $ccShowInstance->save();
         }
         $show_instance_id = $ccShowInstance->getDbId();
         $showInstance = new ShowInstance($show_instance_id);
         if (!$newInstance) {
             $showInstance->correctScheduleStartTimes();
         }
         foreach ($rebroadcasts as $rebroadcast) {
             $timeinfo = explode(" ", $next_date);
             $sql = "SELECT timestamp '{$timeinfo[0]}' + interval '{$rebroadcast["day_offset"]}' + interval '{$rebroadcast["start_time"]}'";
             $rebroadcast_start_time = $CC_DBC->GetOne($sql);
             $sql = "SELECT timestamp '{$rebroadcast_start_time}' + interval '{$duration}'";
             $rebroadcast_end_time = $CC_DBC->GetOne($sql);
             if ($rebroadcast_start_time > $currentTimestamp) {
                 $newRebroadcastInstance = new CcShowInstances();
                 $newRebroadcastInstance->setDbShowId($show_id);
                 $newRebroadcastInstance->setDbStarts($rebroadcast_start_time);
                 $newRebroadcastInstance->setDbEnds($rebroadcast_end_time);
                 $newRebroadcastInstance->setDbRecord(0);
                 $newRebroadcastInstance->setDbRebroadcast(1);
                 $newRebroadcastInstance->setDbOriginalShow($show_instance_id);
                 $newRebroadcastInstance->save();
             }
         }
         $sql = "SELECT timestamp '{$start}' + interval '{$interval}'";
         $next_date = $CC_DBC->GetOne($sql);
     }
     Show::setNextPop($next_date, $show_id, $day);
     RabbitMq::PushSchedule();
 }
开发者ID:romansavrulin,项目名称:Airtime,代码行数:62,代码来源:Shows.php

示例3: GetPlayOrderRange

 /**
  * Returns data related to the scheduled items.
  *
  * @param int $prev
  * @param int $next
  * @return date
  */
 public static function GetPlayOrderRange($prev = 1, $next = 1)
 {
     if (!is_int($prev) || !is_int($next)) {
         //must enter integers to specify ranges
         return array();
     }
     global $CC_CONFIG;
     $date = new DateHelper();
     $timeNow = $date->getTimestamp();
     return array("env" => APPLICATION_ENV, "schedulerTime" => gmdate("Y-m-d H:i:s"), "previous" => Application_Model_Dashboard::GetPreviousItem($timeNow), "current" => Application_Model_Dashboard::GetCurrentItem($timeNow), "next" => Application_Model_Dashboard::GetNextItem($timeNow), "currentShow" => Show_DAL::GetCurrentShow($timeNow), "nextShow" => Show_DAL::GetNextShows($timeNow, 1), "timezone" => date("T"), "timezoneOffset" => date("Z"));
 }
开发者ID:romansavrulin,项目名称:Airtime,代码行数:18,代码来源:Schedule.php

示例4: liveInfoAction

 public function liveInfoAction()
 {
     if (Application_Model_Preference::GetAllow3rdPartyApi()) {
         // disable the view and the layout
         $this->view->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         $date = new DateHelper();
         $timeNow = $date->getTimestamp();
         $result = array("env" => APPLICATION_ENV, "schedulerTime" => gmdate("Y-m-d H:i:s"), "currentShow" => Show_DAL::GetCurrentShow($timeNow), "nextShow" => Show_DAL::GetNextShows($timeNow, 5), "timezone" => date("T"), "timezoneOffset" => date("Z"));
         //echo json_encode($result);
         header("Content-type: text/javascript");
         echo $_GET['callback'] . '(' . json_encode($result) . ')';
     } else {
         header('HTTP/1.0 401 Unauthorized');
         print 'You are not allowed to access this resource. ';
         exit;
     }
 }
开发者ID:romansavrulin,项目名称:Airtime,代码行数:18,代码来源:ApiController.php


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