CC-2289:Differentiate between time and duration
- End date and time is added - duration field is readonly now and is autocalculated - now playing duration field format is changed( 0h 0m 0s ) - removed millisecond from start and end time in now playing
This commit is contained in:
parent
143e68bd56
commit
1dabbacca2
7 changed files with 207 additions and 32 deletions
|
@ -21,8 +21,17 @@ class Application_Model_Nowplaying
|
|||
$type = "a";
|
||||
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
|
||||
|
||||
$dataTablesRows[] = array($type, $dbRow['show_starts'], $dbRow['item_starts'], $dbRow['item_ends'],
|
||||
$dbRow['clip_length'], $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
||||
// remove millisecond from the time format
|
||||
$itemStart = explode('.', $dbRow['item_starts']);
|
||||
$itemEnd = explode('.', $dbRow['item_ends']);
|
||||
|
||||
//format duration
|
||||
$duration = explode('.', $dbRow['clip_length']);
|
||||
$duration = explode(':', $duration[0]);
|
||||
$duration = $duration[0].'h'.$duration[1].'m'.$duration[2].'s';
|
||||
|
||||
$dataTablesRows[] = array($type, $dbRow['show_starts'], $itemStart[0], $itemEnd[0],
|
||||
$duration, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
||||
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
||||
}
|
||||
|
||||
|
|
|
@ -433,6 +433,45 @@ class Show {
|
|||
return $startTime;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end date of the current show.
|
||||
* Note that this is not the end date of repeated show
|
||||
*
|
||||
* @return string
|
||||
* The end date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getEndDate(){
|
||||
$startDate = $this->getStartDate();
|
||||
$startTime = $this->getStartTime();
|
||||
$duration = $this->getDuration();
|
||||
|
||||
$startDateTime = new DateTime($startDate.' '.$startTime);
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||
|
||||
return $endDate->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time of the current show.
|
||||
*
|
||||
* @return string
|
||||
* The start time in the format HH:MM:SS
|
||||
*/
|
||||
public function getEndTime(){
|
||||
$startDate = $this->getStartDate();
|
||||
$startTime = $this->getStartTime();
|
||||
$duration = $this->getDuration();
|
||||
|
||||
$startDateTime = new DateTime($startDate.' '.$startTime);
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||
|
||||
return $endDate->format('H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate whether the starting point of the show is in the
|
||||
|
@ -535,9 +574,14 @@ class Show {
|
|||
}
|
||||
}
|
||||
|
||||
public function getDuration(){
|
||||
public function getDuration($format=false){
|
||||
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
||||
return $showDay->getDbDuration();
|
||||
if(!$format){
|
||||
return $showDay->getDbDuration();
|
||||
}else{
|
||||
$info = explode(':',$showDay->getDbDuration());
|
||||
return ($info[0] != 0 ? intval($info[0]).'h'.' ' : '').($info[1] != 0 ? intval($info[1]).'m' : '');
|
||||
}
|
||||
}
|
||||
|
||||
public function getShowDays(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue