can add a playlist to the schedule table in a show. basic, need to make better.
This commit is contained in:
parent
1b3186af50
commit
1d9aa778a6
17 changed files with 974 additions and 178 deletions
|
@ -45,14 +45,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
{
|
||||
$view = $this->getResource('view');
|
||||
|
||||
$view->headLink()->appendStylesheet('/css/excite-bike/excite_bike.css');
|
||||
$view->headLink()->appendStylesheet('/css/excite-bike/jquery-ui-1.8.7.custom.css');
|
||||
}
|
||||
|
||||
protected function _initHeadScript()
|
||||
{
|
||||
$view = $this->getResource('view');
|
||||
$view->headScript()->appendFile('/js/libs/jquery-1.4.4.min.js','text/javascript');
|
||||
$view->headScript()->appendFile('/js/libs/jquery-ui-1.8.5.min.js','text/javascript');
|
||||
$view->headScript()->appendFile('/js/libs/jquery-ui-1.8.7.custom.min.js','text/javascript');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
->addActionContext('add-show', 'json')
|
||||
->addActionContext('move-show', 'json')
|
||||
->addActionContext('resize-show', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('schedule-show', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->eventDefaultMenu = $eventDefaultMenu;
|
||||
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Schedule');
|
||||
$eventHostMenu[] = array('action' => '/Schedule/schedule-show', 'text' => 'Schedule');
|
||||
|
||||
$this->view->eventHostMenu = $eventHostMenu;
|
||||
}
|
||||
|
@ -120,7 +121,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function deleteShowAction()
|
||||
{
|
||||
$showId = $this->_getParam('showId');
|
||||
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
@ -132,6 +133,25 @@ class ScheduleController extends Zend_Controller_Action
|
|||
// action body
|
||||
}
|
||||
|
||||
public function scheduleShowAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
if($request->isPost()) {
|
||||
$plId = $this->_getParam('plId');
|
||||
$start = $this->_getParam('start');
|
||||
|
||||
$sched = new ScheduleGroup();
|
||||
$this->view->res = $sched->add($start, null, $plId);
|
||||
}
|
||||
else {
|
||||
$showId = $this->_getParam('showId');
|
||||
$length = $this->_getParam('length');
|
||||
|
||||
$this->view->playlists = Playlist::findPlaylistMaxLength($length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -149,3 +169,5 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
13
application/forms/ScheduleShow.php
Normal file
13
application/forms/ScheduleShow.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_ScheduleShow extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/* Form Elements & Other Definitions Here ... */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ class Playlist {
|
|||
*/
|
||||
public static function DeleteFileFromAllPlaylists($p_fileId)
|
||||
{
|
||||
CcPlaylistcontentsQuery::create()->filterByDbFileId($p_fileId)->delete();
|
||||
CcPlaylistcontentsQuery::create()->filterByDbFileId($p_fileId)->delete();
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,6 +108,17 @@ class Playlist {
|
|||
return $res;
|
||||
}
|
||||
|
||||
public static function findPlaylistMaxLength($p_length)
|
||||
{
|
||||
$con = Propel::getConnection("campcaster");
|
||||
|
||||
$sql = "SELECT * FROM cc_playlist LEFT JOIN cc_playlisttimes USING(id) WHERE length <= '{$p_length}' ";
|
||||
//AND state != 'edited'
|
||||
|
||||
$r = $con->query($sql);
|
||||
return $r->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch instance of Playlist object.<br>
|
||||
|
@ -750,50 +761,6 @@ class Playlist {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert playlist time value to float seconds
|
||||
*
|
||||
* @param string $plt
|
||||
* playlist time value (HH:mm:ss.dddddd)
|
||||
* @return int
|
||||
* seconds
|
||||
*/
|
||||
public static function playlistTimeToSeconds($plt)
|
||||
{
|
||||
$arr = preg_split('/:/', $plt);
|
||||
if (isset($arr[2])) {
|
||||
return (intval($arr[0])*60 + intval($arr[1]))*60 + floatval($arr[2]);
|
||||
}
|
||||
if (isset($arr[1])) {
|
||||
return intval($arr[0])*60 + floatval($arr[1]);
|
||||
}
|
||||
return floatval($arr[0]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert float seconds value to playlist time format
|
||||
*
|
||||
* @param float $seconds
|
||||
* @return string
|
||||
* time in playlist time format (HH:mm:ss.dddddd)
|
||||
*/
|
||||
public static function secondsToPlaylistTime($p_seconds)
|
||||
{
|
||||
$seconds = $p_seconds;
|
||||
$milliseconds = intval(($seconds - intval($seconds)) * 1000);
|
||||
$milliStr = str_pad($milliseconds, 6, '0');
|
||||
$hours = floor($seconds / 3600);
|
||||
$seconds -= $hours * 3600;
|
||||
$minutes = floor($seconds / 60);
|
||||
$seconds -= $minutes * 60;
|
||||
|
||||
$res = sprintf("%02d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export playlist as simplified SMIL XML file.
|
||||
*
|
||||
|
@ -896,110 +863,8 @@ class Playlist {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set playlist length - dcterm:extent
|
||||
*
|
||||
* @param string $newPlLen
|
||||
* new length in extent format
|
||||
* @param int $parid
|
||||
* playlist container record id
|
||||
* @param int $metaParid
|
||||
* metadata container record id
|
||||
* @return boolean
|
||||
*/
|
||||
private function setPlaylistLength($newPlLen, $parid, $metaParid)
|
||||
{
|
||||
$mid = $this->_getMidOrInsert('playlength', $parid, $newPlLen, 'A');
|
||||
if (PEAR::isError($mid)) {
|
||||
return $mid;
|
||||
}
|
||||
$r = $this->_setValueOrInsert(
|
||||
$mid, $newPlLen, $parid, 'playlength', 'A');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$mid = $this->_getMidOrInsert('dcterms:extent', $metaParid, $newPlLen);
|
||||
if (PEAR::isError($mid)) {
|
||||
return $mid;
|
||||
}
|
||||
$r = $this->_setValueOrInsert(
|
||||
$mid, $newPlLen, $metaParid, 'dcterms:extent');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
} // class Playlist
|
||||
|
||||
|
||||
/**
|
||||
* Auxiliary class for GB playlist editing methods
|
||||
*
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class PlaylistElement {
|
||||
private $pl = NULL;
|
||||
private $plEl = NULL;
|
||||
|
||||
public function PlaylistElement($pl, $plEl)
|
||||
{
|
||||
$this->pl = $pl;
|
||||
$this->plEl = $plEl;
|
||||
}
|
||||
|
||||
|
||||
public function analyze()
|
||||
{
|
||||
$plInfo = array(
|
||||
'acLen' => '00:00:00.000000',
|
||||
'acLenS' => 0,
|
||||
'fadeIn' => '00:00:00.000000',
|
||||
'fadeInS' => 0,
|
||||
'fadeOut' => '00:00:00.000000',
|
||||
'fadeOutS' => 0,
|
||||
'clipStart' => '00:00:00.000000',
|
||||
'clipStartS' => 0,
|
||||
'clipEnd' => '00:00:00.000000',
|
||||
'clipEndS' => 0
|
||||
);
|
||||
$plInfo['elOffset'] = $this->plEl['attrs']['relativeOffset'];
|
||||
$plInfo['elOffsetS'] = Playlist::playlistTimeToSeconds($plInfo['elOffset']);
|
||||
// cycle over tags inside playlistElement
|
||||
foreach ($this->plEl['children'] as $j => $acFi) {
|
||||
switch ($acFi['elementname']) {
|
||||
case "playlist":
|
||||
$plInfo['type'] = 'playlist';
|
||||
break;
|
||||
case "audioClip":
|
||||
$plInfo['type'] = 'audioClip';
|
||||
break;
|
||||
}
|
||||
switch ($acFi['elementname']) {
|
||||
case "playlist":
|
||||
case "audioClip":
|
||||
$plInfo['acLen'] = $acFi['attrs']['playlength'];
|
||||
$plInfo['acLenS'] = Playlist::playlistTimeToSeconds($plInfo['acLen']);
|
||||
$plInfo['acGunid'] = $acFi['attrs']['id'];
|
||||
break;
|
||||
case "fadeInfo":
|
||||
$plInfo['fadeIn'] = $acFi['attrs']['fadeIn'];
|
||||
$plInfo['fadeInS'] = Playlist::playlistTimeToSeconds($plInfo['fadeIn']);
|
||||
$plInfo['fadeOut'] = $acFi['attrs']['fadeOut'];
|
||||
$plInfo['fadeOutS'] = Playlist::playlistTimeToSeconds($plInfo['fadeOut']);
|
||||
break;
|
||||
}
|
||||
$plInfo['clipStart'] = $this->plEl['attrs']['clipStart'];
|
||||
$plInfo['clipStartS'] = Playlist::playlistTimeToSeconds($this->plEl['attrs']['clipStart']);
|
||||
$plInfo['clipEnd'] = $this->plEl['attrs']['clipEnd'];
|
||||
$plInfo['clipEndS'] = Playlist::playlistTimeToSeconds($this->plEl['attrs']['clipEnd']);
|
||||
}
|
||||
return $plInfo;
|
||||
}
|
||||
} // class PlaylistElement
|
||||
|
||||
|
||||
/**
|
||||
* @package Campcaster
|
||||
* @subpackage StorageServer
|
||||
|
|
|
@ -577,4 +577,4 @@ class Schedule {
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -48,10 +48,10 @@ class Show {
|
|||
}
|
||||
|
||||
$show = new CcShow();
|
||||
$show->setDbName($data['name']);
|
||||
$show->setDbRepeats($data['repeats']);
|
||||
$show->setDbDescription($data['description']);
|
||||
$show->save();
|
||||
$show->setDbName($data['name']);
|
||||
$show->setDbRepeats($data['repeats']);
|
||||
$show->setDbDescription($data['description']);
|
||||
$show->save();
|
||||
|
||||
$showId = $show->getDbId();
|
||||
|
||||
|
@ -127,9 +127,18 @@ class Show {
|
|||
}
|
||||
|
||||
foreach($res as $row) {
|
||||
|
||||
$sql = "SELECT date '{$show["first_show"]}' + interval '{$deltaDay} day'";
|
||||
$f_show = $CC_DBC->GetOne($sql);
|
||||
//get a timestamp back only need a date.
|
||||
$tmp = spliti(" ", $f_show);
|
||||
$f_show = $tmp[0];
|
||||
|
||||
$show = CcShowDaysQuery::create()->findPK($row["id"]);
|
||||
$show->setDbStartTime($s_time);
|
||||
$show->setDbEndTime($e_time);
|
||||
$show->setDbFirstShow($f_show);
|
||||
$show->setDbDay($row['day'] + $deltaDay);
|
||||
$show->save();
|
||||
}
|
||||
}
|
||||
|
|
1
application/views/scripts/schedule/schedule-show.phtml
Normal file
1
application/views/scripts/schedule/schedule-show.phtml
Normal file
|
@ -0,0 +1 @@
|
|||
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>scheduleShow</b></center>
|
Loading…
Add table
Add a link
Reference in a new issue