CC-4961: Show linking

Refactoring
This commit is contained in:
denise 2013-03-12 10:30:31 -04:00
parent 7347be35b1
commit c721b81a13
5 changed files with 32 additions and 19 deletions

View File

@ -803,6 +803,8 @@ class ScheduleController extends Zend_Controller_Action
if ($this->service_schedule->validateShowForms($forms, $data, $validateStartDate,
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
$this->service_schedule->editShow($data);
$scheduler = new Application_Model_Scheduler();
$showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find();
foreach ($showInstances as $si) {

View File

@ -1147,11 +1147,12 @@ SQL;
//find repeat type or set to a non repeating show.
/*$repeatType = ($data['add_show_repeats']) ? $data['add_show_repeat_type'] : -1;*/
if ($data['add_show_id'] == -1) {
/*$ccShow = new CcShow();*/
/*if ($data['add_show_id'] == -1) {
$ccShow = new CcShow();
} else {
$ccShow = CcShowQuery::create()->findPK($data['add_show_id']);
}
}*/
/*$ccShow->setDbName($data['add_show_name']);
$ccShow->setDbDescription($data['add_show_description']);
$ccShow->setDbUrl($data['add_show_url']);

View File

@ -190,30 +190,40 @@ class Application_Service_ScheduleService
if ($currentUser->isAdminOrPM()) {
//create ccShow
$ccShow = new CcShow();
$ccShow = $this->service_show->setShow($ccShow, $showData);
$ccShow = $this->service_show->setShow($showData, true);
$showId = $ccShow->getDbId();
//create ccShowDays
$this->service_showDays = new Application_Service_ShowDaysService($showId);
$this->service_showDays->createShowDays(
$this->service_showDays->setShowDays(
$showData, $currentUser->getDbId(), $repeatType, $isRecorded);
//create ccShowRebroadcasts
$this->service_show->createShowRebroadcasts($showData, $showId, $repeatType, $isRecorded);
$this->service_show->setShowRebroadcasts($showData, $showId, $repeatType, $isRecorded);
//create ccShowHosts
$this->service_show->createShowHosts($showData, $showId);
$this->service_show->setShowHosts($showData, $showId);
//create ccShowInstances
$this->service_showInstances->delegateShowInstanceCreation($showId, $isRebroadcast);
}
}
public function editShow($formData)
public function editShow($showData)
{
//CcSubj object
$currentUser = $this->service_user->getCurrentUser();
$repeatType = ($showData['add_show_repeats']) ? $showData['add_show_repeat_type'] : -1;
$isRecorded = (isset($showData['add_show_record']) && $showData['add_show_record']) ? 1 : 0;
$isRebroadcast = (isset($showData['add_show_rebroadcast']) && $showData['add_show_rebroadcast']) ? 1 : 0;
$showData["add_show_duration"] = $this->formatShowDuration(
$showData["add_show_duration"]);
if ($currentUser->isAdminOrPM()) {
$ccShow = $this->service_show->setShow($showData, false);
}
}
/**
@ -261,10 +271,4 @@ class Application_Service_ScheduleService
return array($formData, $validateStartDate, $validateStartTime, $originalShowStartDateTime);
}
public function editShow($showData)
{
//CcSubj object
$currentUser = $this->service_user->getCurrentUser();
}
}

View File

@ -17,7 +17,7 @@ class Application_Service_ShowDaysService
* @param $repeatType
* @param $isRecorded
*/
public function createShowDays($showData, $userId, $repeatType, $isRecorded)
public function setShowDays($showData, $userId, $repeatType, $isRecorded)
{
$startDateTime = new DateTime($showData['add_show_start_date']." ".$showData['add_show_start_time']);

View File

@ -10,8 +10,14 @@ class Application_Service_ShowService
* @param $ccShow
* @param $showData
*/
public function setShow($ccShow, $showData)
public function setShow($showData, $isNewShow)
{
if ($isNewShow) {
$ccShow = new CcShow();
} else {
$ccShow = CcShowQuery::create()->findPk($showData["add_show_id"]);
}
$ccShow->setDbName($showData['add_show_name']);
$ccShow->setDbDescription($showData['add_show_description']);
$ccShow->setDbUrl($showData['add_show_url']);
@ -35,7 +41,7 @@ class Application_Service_ShowService
* @param $repeatType
* @param $isRecorded
*/
public function createShowRebroadcasts($showData, $showId, $repeatType, $isRecorded)
public function setShowRebroadcasts($showData, $showId, $repeatType, $isRecorded)
{
if (($isRecorded && $showData['add_show_rebroadcast']) && ($repeatType != -1)) {
for ($i=1; $i<=self::MAX_REBROADCAST_DATES; $i++) {
@ -70,7 +76,7 @@ class Application_Service_ShowService
* @param $showData
* @param $showId
*/
public function createShowHosts($showData, $showId)
public function setShowHosts($showData, $showId)
{
if (is_array($showData['add_show_hosts'])) {
foreach ($showData['add_show_hosts'] as $host) {