CC-4961: Show linking
Refactoring
This commit is contained in:
parent
7347be35b1
commit
c721b81a13
5 changed files with 32 additions and 19 deletions
|
@ -803,6 +803,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
if ($this->service_schedule->validateShowForms($forms, $data, $validateStartDate,
|
if ($this->service_schedule->validateShowForms($forms, $data, $validateStartDate,
|
||||||
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
|
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
|
||||||
|
|
||||||
|
$this->service_schedule->editShow($data);
|
||||||
|
|
||||||
$scheduler = new Application_Model_Scheduler();
|
$scheduler = new Application_Model_Scheduler();
|
||||||
$showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find();
|
$showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find();
|
||||||
foreach ($showInstances as $si) {
|
foreach ($showInstances as $si) {
|
||||||
|
|
|
@ -1147,11 +1147,12 @@ SQL;
|
||||||
//find repeat type or set to a non repeating show.
|
//find repeat type or set to a non repeating show.
|
||||||
/*$repeatType = ($data['add_show_repeats']) ? $data['add_show_repeat_type'] : -1;*/
|
/*$repeatType = ($data['add_show_repeats']) ? $data['add_show_repeat_type'] : -1;*/
|
||||||
|
|
||||||
if ($data['add_show_id'] == -1) {
|
/*if ($data['add_show_id'] == -1) {
|
||||||
/*$ccShow = new CcShow();*/
|
$ccShow = new CcShow();
|
||||||
} else {
|
} else {
|
||||||
$ccShow = CcShowQuery::create()->findPK($data['add_show_id']);
|
$ccShow = CcShowQuery::create()->findPK($data['add_show_id']);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*$ccShow->setDbName($data['add_show_name']);
|
/*$ccShow->setDbName($data['add_show_name']);
|
||||||
$ccShow->setDbDescription($data['add_show_description']);
|
$ccShow->setDbDescription($data['add_show_description']);
|
||||||
$ccShow->setDbUrl($data['add_show_url']);
|
$ccShow->setDbUrl($data['add_show_url']);
|
||||||
|
|
|
@ -190,30 +190,40 @@ class Application_Service_ScheduleService
|
||||||
|
|
||||||
if ($currentUser->isAdminOrPM()) {
|
if ($currentUser->isAdminOrPM()) {
|
||||||
//create ccShow
|
//create ccShow
|
||||||
$ccShow = new CcShow();
|
$ccShow = $this->service_show->setShow($showData, true);
|
||||||
$ccShow = $this->service_show->setShow($ccShow, $showData);
|
|
||||||
$showId = $ccShow->getDbId();
|
$showId = $ccShow->getDbId();
|
||||||
|
|
||||||
//create ccShowDays
|
//create ccShowDays
|
||||||
$this->service_showDays = new Application_Service_ShowDaysService($showId);
|
$this->service_showDays = new Application_Service_ShowDaysService($showId);
|
||||||
$this->service_showDays->createShowDays(
|
$this->service_showDays->setShowDays(
|
||||||
$showData, $currentUser->getDbId(), $repeatType, $isRecorded);
|
$showData, $currentUser->getDbId(), $repeatType, $isRecorded);
|
||||||
|
|
||||||
//create ccShowRebroadcasts
|
//create ccShowRebroadcasts
|
||||||
$this->service_show->createShowRebroadcasts($showData, $showId, $repeatType, $isRecorded);
|
$this->service_show->setShowRebroadcasts($showData, $showId, $repeatType, $isRecorded);
|
||||||
|
|
||||||
//create ccShowHosts
|
//create ccShowHosts
|
||||||
$this->service_show->createShowHosts($showData, $showId);
|
$this->service_show->setShowHosts($showData, $showId);
|
||||||
|
|
||||||
//create ccShowInstances
|
//create ccShowInstances
|
||||||
$this->service_showInstances->delegateShowInstanceCreation($showId, $isRebroadcast);
|
$this->service_showInstances->delegateShowInstanceCreation($showId, $isRebroadcast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editShow($formData)
|
public function editShow($showData)
|
||||||
{
|
{
|
||||||
//CcSubj object
|
//CcSubj object
|
||||||
$currentUser = $this->service_user->getCurrentUser();
|
$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);
|
return array($formData, $validateStartDate, $validateStartTime, $originalShowStartDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editShow($showData)
|
|
||||||
{
|
|
||||||
//CcSubj object
|
|
||||||
$currentUser = $this->service_user->getCurrentUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@ class Application_Service_ShowDaysService
|
||||||
* @param $repeatType
|
* @param $repeatType
|
||||||
* @param $isRecorded
|
* @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']);
|
$startDateTime = new DateTime($showData['add_show_start_date']." ".$showData['add_show_start_time']);
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,14 @@ class Application_Service_ShowService
|
||||||
* @param $ccShow
|
* @param $ccShow
|
||||||
* @param $showData
|
* @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->setDbName($showData['add_show_name']);
|
||||||
$ccShow->setDbDescription($showData['add_show_description']);
|
$ccShow->setDbDescription($showData['add_show_description']);
|
||||||
$ccShow->setDbUrl($showData['add_show_url']);
|
$ccShow->setDbUrl($showData['add_show_url']);
|
||||||
|
@ -35,7 +41,7 @@ class Application_Service_ShowService
|
||||||
* @param $repeatType
|
* @param $repeatType
|
||||||
* @param $isRecorded
|
* @param $isRecorded
|
||||||
*/
|
*/
|
||||||
public function createShowRebroadcasts($showData, $showId, $repeatType, $isRecorded)
|
public function setShowRebroadcasts($showData, $showId, $repeatType, $isRecorded)
|
||||||
{
|
{
|
||||||
if (($isRecorded && $showData['add_show_rebroadcast']) && ($repeatType != -1)) {
|
if (($isRecorded && $showData['add_show_rebroadcast']) && ($repeatType != -1)) {
|
||||||
for ($i=1; $i<=self::MAX_REBROADCAST_DATES; $i++) {
|
for ($i=1; $i<=self::MAX_REBROADCAST_DATES; $i++) {
|
||||||
|
@ -70,7 +76,7 @@ class Application_Service_ShowService
|
||||||
* @param $showData
|
* @param $showData
|
||||||
* @param $showId
|
* @param $showId
|
||||||
*/
|
*/
|
||||||
public function createShowHosts($showData, $showId)
|
public function setShowHosts($showData, $showId)
|
||||||
{
|
{
|
||||||
if (is_array($showData['add_show_hosts'])) {
|
if (is_array($showData['add_show_hosts'])) {
|
||||||
foreach ($showData['add_show_hosts'] as $host) {
|
foreach ($showData['add_show_hosts'] as $host) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue