CC-4961: Show linking
-initial schedule service experimentation
This commit is contained in:
parent
cc69418215
commit
d08f6cf3e1
|
@ -5,6 +5,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
protected $sched_sess = null;
|
protected $sched_sess = null;
|
||||||
|
|
||||||
|
private $service_schedule;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
|
@ -38,6 +40,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
->initContext();
|
->initContext();
|
||||||
|
|
||||||
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
||||||
|
|
||||||
|
$this->service_schedule = new Application_Service_ScheduleService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
|
@ -90,13 +94,27 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||||
//End Show builder JS/CSS requirements
|
//End Show builder JS/CSS requirements
|
||||||
|
|
||||||
|
$forms = $this->service_schedule->createShowForms();
|
||||||
|
// populate forms with default values
|
||||||
|
$this->service_schedule->populateNewShowForms(
|
||||||
|
$forms["what"], $forms["when"], $forms["repeats"]);
|
||||||
|
|
||||||
|
$this->view->what = $forms["what"];
|
||||||
|
$this->view->when = $forms["when"];
|
||||||
|
$this->view->repeats = $forms["repeats"];
|
||||||
|
$this->view->live = $forms["live"];
|
||||||
|
$this->view->rr = $forms["record"];
|
||||||
|
$this->view->absoluteRebroadcast = $forms["abs_record"];
|
||||||
|
$this->view->rebroadcast = $forms["rebroadcast"];
|
||||||
|
$this->view->who = $forms["who"];
|
||||||
|
$this->view->style = $forms["style"];
|
||||||
|
|
||||||
Application_Model_Schedule::createNewFormSections($this->view);
|
|
||||||
$user = Application_Model_User::getCurrentUser();
|
$user = Application_Model_User::getCurrentUser();
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$this->view->preloadShowForm = true;
|
$this->view->preloadShowForm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->view->addNewShow = true;
|
||||||
$this->view->headScript()->appendScript(
|
$this->view->headScript()->appendScript(
|
||||||
"var calendarPref = {};\n".
|
"var calendarPref = {};\n".
|
||||||
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -960,7 +960,7 @@ SQL;
|
||||||
Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createNewFormSections($p_view)
|
/*public static function createNewFormSections($p_view)
|
||||||
{
|
{
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
|
@ -1005,7 +1005,7 @@ SQL;
|
||||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
$p_view->rebroadcast = $formRebroadcast;
|
$p_view->rebroadcast = $formRebroadcast;
|
||||||
$p_view->addNewShow = true;
|
$p_view->addNewShow = true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* This function is responsible for handling the case where an individual
|
/* This function is responsible for handling the case where an individual
|
||||||
* show instance in a repeating show was edited (via the context menu in the Calendar).
|
* show instance in a repeating show was edited (via the context menu in the Calendar).
|
||||||
|
@ -1140,13 +1140,13 @@ SQL;
|
||||||
|
|
||||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||||
|
|
||||||
$formRecord->removeDecorator('DtDdWrapper');
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
|
||||||
$record = $formRecord->isValid($data);
|
$record = $formRecord->isValid($data);
|
||||||
|
@ -1156,18 +1156,18 @@ SQL;
|
||||||
if ($repeats) {
|
if ($repeats) {
|
||||||
$repeats = $formRepeats->checkReliantFields($data);
|
$repeats = $formRepeats->checkReliantFields($data);
|
||||||
}
|
}
|
||||||
$formAbsoluteRebroadcast->reset();
|
$formAbsoluteRebroadcast->reset();
|
||||||
//make it valid, results don't matter anyways.
|
//make it valid, results don't matter anyways.
|
||||||
$rebroadAb = 1;
|
$rebroadAb = 1;
|
||||||
|
|
||||||
if ($data["add_show_rebroadcast"]) {
|
if ($data["add_show_rebroadcast"]) {
|
||||||
$rebroad = $formRebroadcast->isValid($data);
|
$rebroad = $formRebroadcast->isValid($data);
|
||||||
if ($rebroad) {
|
if ($rebroad) {
|
||||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$rebroad = 1;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$rebroad = 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$repeats = 1;
|
$repeats = 1;
|
||||||
$formRebroadcast->reset();
|
$formRebroadcast->reset();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Service_ScheduleService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return array of schedule forms
|
||||||
|
*/
|
||||||
|
public function createShowForms()
|
||||||
|
{
|
||||||
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
|
$formWho = new Application_Form_AddShowWho();
|
||||||
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
|
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||||
|
|
||||||
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
$forms = array();
|
||||||
|
$forms["what"] = $formWhat;
|
||||||
|
$forms["who"] = $formWho;
|
||||||
|
$forms["when"] = $formWhen;
|
||||||
|
$forms["repeats"] = $formRepeats;
|
||||||
|
$forms["style"] = $formStyle;
|
||||||
|
$forms["live"] = $formLive;
|
||||||
|
$forms["record"] = $formRecord;
|
||||||
|
$forms["abs_record"] = $formAbsoluteRebroadcast;
|
||||||
|
$forms["rebroadcast"] = $formRebroadcast;
|
||||||
|
|
||||||
|
return $forms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Popluates the what, when, and repeat forms
|
||||||
|
* with default values
|
||||||
|
*/
|
||||||
|
public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
|
||||||
|
{
|
||||||
|
$formWhat->populate(
|
||||||
|
array('add_show_id' => '-1',
|
||||||
|
'add_show_instance_id' => '-1'));
|
||||||
|
|
||||||
|
$formWhen->populate(
|
||||||
|
array('add_show_start_date' => date("Y-m-d"),
|
||||||
|
'add_show_start_time' => '00:00',
|
||||||
|
'add_show_end_date_no_repeate' => date("Y-m-d"),
|
||||||
|
'add_show_end_time' => '01:00',
|
||||||
|
'add_show_duration' => '01h 00m'));
|
||||||
|
|
||||||
|
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function populateForm($form, $values)
|
||||||
|
{
|
||||||
|
$form->populate($values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Validates show forms
|
||||||
|
*
|
||||||
|
* @return array of booleans
|
||||||
|
*/
|
||||||
|
public function validateShowForms($forms)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Creates a new show if form data is valid
|
||||||
|
*/
|
||||||
|
public function createShow()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue