Skip to content

Commit

Permalink
Merge branch 'master' of dev.sourcefabric.org:airtime
Browse files Browse the repository at this point in the history
  • Loading branch information
martin authored and martin committed Jan 28, 2011
2 parents ef01583 + 548fb45 commit 9c56af6
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 123 deletions.
235 changes: 116 additions & 119 deletions application/controllers/ScheduleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,120 +60,120 @@ public function indexAction()
public function eventFeedAction()
{
$start = $this->_getParam('start', null);
$end = $this->_getParam('end', null);
$weekday = $this->_getParam('weekday', null);
if(!is_null($weekday)) {
$weekday = array($weekday);
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$show = new Show(new User($userInfo->id, $userInfo->type));
$this->view->events = $show->getFullCalendarEvents($start, $end, $weekday);
$end = $this->_getParam('end', null);
$weekday = $this->_getParam('weekday', null);

if(!is_null($weekday)) {
$weekday = array($weekday);
}

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$show = new Show(new User($userInfo->id, $userInfo->type));

$this->view->events = $show->getFullCalendarEvents($start, $end, $weekday);
}

public function addShowDialogAction()
{
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
$this->view->headScript()->appendFile('/js/colorpicker/js/colorpicker.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/add-show.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
$this->view->headLink()->appendStylesheet('/css/colorpicker/css/colorpicker.css');
$this->view->headLink()->appendStylesheet('/css/add-show.css');
$this->view->headLink()->appendStylesheet('/css/pro_dropdown_3.css');
$this->view->headLink()->appendStylesheet('/css/styles.css');
$request = $this->getRequest();
$formWhat = new Application_Form_AddShowWhat();
$formWhat->removeDecorator('DtDdWrapper');
$formWho = new Application_Form_AddShowWho();
$formWho->removeDecorator('DtDdWrapper');
$formWhen = new Application_Form_AddShowWhen();
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats = new Application_Form_AddShowRepeats();
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle = new Application_Form_AddShowStyle();
$formStyle->removeDecorator('DtDdWrapper');
if ($request->isPost()) {
$data = $request->getPost();
$what = $formWhat->isValid($data);
$when = $formWhen->isValid($data);
$repeats = $formRepeats->isValid($data);
$who = $formWho->isValid($data);
$style = $formStyle->isValid($data);
if ($what && $when && $repeats && $who && $style) {
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$show = new Show(new User($userInfo->id, $userInfo->type));
$overlap = $show->addShow($data);
if(isset($overlap)) {
$this->view->overlap = $overlap;
}
else {
$this->_redirect('Schedule');
}
}
}
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->headScript()->appendFile('/js/colorpicker/js/colorpicker.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/add-show.js','text/javascript');

$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
$this->view->headLink()->appendStylesheet('/css/colorpicker/css/colorpicker.css');
$this->view->headLink()->appendStylesheet('/css/add-show.css');
$this->view->headLink()->appendStylesheet('/css/pro_dropdown_3.css');
$this->view->headLink()->appendStylesheet('/css/styles.css');

$request = $this->getRequest();
$formWhat = new Application_Form_AddShowWhat();
$formWhat->removeDecorator('DtDdWrapper');
$formWho = new Application_Form_AddShowWho();
$formWho->removeDecorator('DtDdWrapper');
$formWhen = new Application_Form_AddShowWhen();
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats = new Application_Form_AddShowRepeats();
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle = new Application_Form_AddShowStyle();
$formStyle->removeDecorator('DtDdWrapper');

if ($request->isPost()) {

$data = $request->getPost();

$what = $formWhat->isValid($data);
$when = $formWhen->isValid($data);
$repeats = $formRepeats->isValid($data);
$who = $formWho->isValid($data);
$style = $formStyle->isValid($data);

if ($what && $when && $repeats && $who && $style) {

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$show = new Show(new User($userInfo->id, $userInfo->type));
$overlap = $show->addShow($data);

if(isset($overlap)) {
$this->view->overlap = $overlap;
}
else {
$this->_redirect('Schedule');
}
}
}

$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
}

public function moveShowAction()
{
$deltaDay = $this->_getParam('day');
$deltaMin = $this->_getParam('min');
$showId = $this->_getParam('showId');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$show = new Show(new User($userInfo->id, $userInfo->type));
$overlap = $show->moveShow($showId, $deltaDay, $deltaMin);
if(isset($overlap))
$this->view->overlap = $overlap;
$deltaMin = $this->_getParam('min');
$showId = $this->_getParam('showId');

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$show = new Show(new User($userInfo->id, $userInfo->type));

$overlap = $show->moveShow($showId, $deltaDay, $deltaMin);

if(isset($overlap))
$this->view->overlap = $overlap;
}

public function resizeShowAction()
{
$deltaDay = $this->_getParam('day');
$deltaMin = $this->_getParam('min');
$showId = $this->_getParam('showId');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$show = new Show(new User($userInfo->id, $userInfo->type));
$overlap = $show->resizeShow($showId, $deltaDay, $deltaMin);
if(isset($overlap))
$this->view->overlap = $overlap;
$deltaMin = $this->_getParam('min');
$showId = $this->_getParam('showId');

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$show = new Show(new User($userInfo->id, $userInfo->type));

$overlap = $show->resizeShow($showId, $deltaDay, $deltaMin);

if(isset($overlap))
$this->view->overlap = $overlap;
}

public function deleteShowAction()
{
$showId = $this->_getParam('showId');
$date = $this->_getParam('date');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id, $userInfo->type);
$show = new Show($user, $showId);
$show->deleteShow($date);
$date = $this->_getParam('date');

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$user = new User($userInfo->id, $userInfo->type);
$show = new Show($user, $showId);
$show->deleteShow($date);
}

public function makeContextMenuAction()
Expand Down Expand Up @@ -268,31 +268,28 @@ public function removeGroupAction()
public function scheduleShowDialogAction()
{
$start_timestamp = $this->_getParam('start');
$end_timestamp = $this->_getParam('end');
$showId = $this->_getParam('showId');

$this->sched_sess->showId = $showId;
$this->sched_sess->showStart = $start_timestamp;
$this->sched_sess->showEnd = $end_timestamp;

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$user = new User($userInfo->id, $userInfo->type);
$show = new Show($user, $showId);

$this->view->playlists = $show->searchPlaylistsForShow($start_timestamp);
$this->view->showContent = $show->getShowContent($start_timestamp);

$this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp);
$this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp);
$this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);

$this->view->choice = $this->view->render('schedule/find-playlists.phtml');
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
$this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml');

unset($this->view->showContent);
unset($this->view->playlists);
$end_timestamp = $this->_getParam('end');
$showId = $this->_getParam('showId');

$this->sched_sess->showId = $showId;
$this->sched_sess->showStart = $start_timestamp;
$this->sched_sess->showEnd = $end_timestamp;

$userInfo = Zend_Auth::getInstance()->getStorage()->read();

$user = new User($userInfo->id, $userInfo->type);
$show = new Show($user, $showId);

$this->view->showContent = $show->getShowContent($start_timestamp);

$this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp);
$this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp);
$this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);

$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
$this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml');

unset($this->view->showContent);
}

public function showListAction()
Expand Down
4 changes: 0 additions & 4 deletions application/models/StoredFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,6 @@ private static function searchFiles($fromTable, $data)
$totalRows = $CC_DBC->getOne($sql);

// Where clause

if(isset($data["optWhere"])) {

$where[] = join(" AND ", $data["optWhere"]);
Expand Down Expand Up @@ -1845,18 +1844,15 @@ private static function searchFiles($fromTable, $data)
}
$where[] = "(".join(" AND ", $outerCond).")";
}

// End Where clause

// Order By clause

$orderby = array();
for($i=0; $i<$data["iSortingCols"]; $i++){
$orderby[] = $columnsDisplayed[$data["iSortCol_".$i]]." ".$data["sSortDir_".$i];
}
$orderby[] = "id";
$orderby = join("," , $orderby);

// End Order By clause

//ordered by integer as expected by datatables.
Expand Down
Binary file added public/favicon.ico
Binary file not shown.

0 comments on commit 9c56af6

Please sign in to comment.