CC-2833: Use ClassLoaders for PHP Files

-shows.php
This commit is contained in:
martin 2011-09-23 10:54:20 -04:00
parent 5d7b51dafc
commit 9bb901945e
12 changed files with 68 additions and 68 deletions

View File

@ -17,7 +17,7 @@ require_once 'Soundcloud.php';
//require_once 'StoredFile.php';
require_once 'Schedule.php';
require_once 'Preference.php';
require_once 'Shows.php';
//require_once 'Shows.php';
require_once 'Users.php';
require_once 'RabbitMq.php';
require_once 'DateHelper.php';

View File

@ -306,7 +306,7 @@ class ApiController extends Zend_Controller_Action
$now = new DateTime($today_timestamp);
$end_timestamp = $now->add(new DateInterval("PT2H"));
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
$this->view->shows = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
$this->view->shows = Application_Model_Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
$this->view->is_recording = false;
@ -361,7 +361,7 @@ class ApiController extends Zend_Controller_Action
$show_name = null;
try {
$show_inst = new ShowInstance($show_instance_id);
$show_inst = new Application_Model_ShowInstance($show_instance_id);
$show_inst->setRecordedFile($file_id);
$show_name = $show_inst->getName();
@ -393,7 +393,7 @@ class ApiController extends Zend_Controller_Action
{
for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
$show = new Show($show_inst->getShowId());
$show = new Application_Model_Show($show_inst->getShowId());
$description = $show->getDescription();
$hosts = $show->getHosts();

View File

@ -253,7 +253,7 @@ class LibraryController extends Zend_Controller_Action
$id = $this->_getParam('id');
$type = $this->_getParam('type');
if($type == "show"){
$show_instance = new ShowInstance($id);
$show_instance = new Application_Model_ShowInstance($id);
$this->view->sc_id = $show_instance->getSoundCloudFileId();
$file = $show_instance->getRecordedFile();
$this->view->error_code = $file->getSoundCloudErrorCode();

View File

@ -75,7 +75,7 @@ class ScheduleController extends Zend_Controller_Action
else
$editable = false;
$this->view->events = Show::getFullCalendarEvents($start, $end, $editable);
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
}
public function moveShowAction()
@ -88,7 +88,7 @@ class ScheduleController extends Zend_Controller_Action
$user = new User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstance = new ShowInstance($showInstanceId);
$showInstance = new Application_Model_ShowInstance($showInstanceId);
$error = $showInstance->moveShow($deltaDay, $deltaMin);
}
@ -107,7 +107,7 @@ class ScheduleController extends Zend_Controller_Action
$user = new User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
$error = $show->resizeShow($deltaDay, $deltaMin);
}
@ -123,7 +123,7 @@ class ScheduleController extends Zend_Controller_Action
$user = new User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
$show->deleteShow();
}
}
@ -132,7 +132,7 @@ class ScheduleController extends Zend_Controller_Action
{
global $CC_CONFIG;
$show_instance = $this->_getParam('id');
$show_inst = new ShowInstance($show_instance);
$show_inst = new Application_Model_ShowInstance($show_instance);
$file = $show_inst->getRecordedFile();
$id = $file->getId();
@ -148,7 +148,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
$show = new ShowInstance($id);
$show = new Application_Model_ShowInstance($id);
$params = '/format/json/id/#id#';
@ -225,7 +225,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
$show->scheduleShow(array($plId));
@ -244,7 +244,7 @@ class ScheduleController extends Zend_Controller_Action
$showInstanceId = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()))
$show->clearShow();
@ -259,7 +259,7 @@ class ScheduleController extends Zend_Controller_Action
{
$post = $this->getRequest()->getPost();
$show = new ShowInstance($this->sched_sess->showInstanceId);
$show = new Application_Model_ShowInstance($this->sched_sess->showInstanceId);
$playlists = $show->searchPlaylistsForShow($post);
foreach( $playlists['aaData'] as &$data){
// calling two functions to format time to 1 decimal place
@ -279,7 +279,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
$show->removeGroupFromShow($group_id);
@ -297,12 +297,12 @@ class ScheduleController extends Zend_Controller_Action
$showInstanceId = $this->_getParam('id');
$this->sched_sess->showInstanceId = $showInstanceId;
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
$start_timestamp = $show->getShowStart();
$end_timestamp = $show->getShowEnd();
//check to make sure show doesn't overlap.
if(Show::getShows($start_timestamp, $end_timestamp, array($showInstanceId))) {
if(Application_Model_Show::getShows($start_timestamp, $end_timestamp, array($showInstanceId))) {
$this->view->error = "cannot schedule an overlapping show.";
return;
}
@ -337,11 +337,11 @@ class ScheduleController extends Zend_Controller_Action
public function showContentDialogAction()
{
$showInstanceId = $this->_getParam('id');
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
$originalShowId = $show->isRebroadcast();
if (!is_null($originalShowId)){
$originalShow = new ShowInstance($originalShowId);
$originalShow = new Application_Model_ShowInstance($originalShowId);
$originalShowName = $originalShow->getName();
$originalShowStart = $originalShow->getShowStart();
@ -386,8 +386,8 @@ class ScheduleController extends Zend_Controller_Action
$this->view->style = $formStyle;
$this->view->addNewShow = false;
$showInstance = new ShowInstance($showInstanceId);
$show = new Show($showInstance->getShowId());
$showInstance = new Application_Model_ShowInstance($showInstanceId);
$show = new Application_Model_Show($showInstance->getShowId());
$formWhat->populate(array('add_show_id' => $show->getId(),
'add_show_name' => $show->getName(),
@ -496,7 +496,7 @@ class ScheduleController extends Zend_Controller_Action
$data[$j["name"]] = $j["value"];
}
$show = new Show($data['add_show_id']);
$show = new Application_Model_Show($data['add_show_id']);
$startDateModified = true;
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
@ -627,7 +627,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Show::create($data);
Application_Model_Show::create($data);
}
//send back a new form for the user.
@ -639,7 +639,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Show::create($data);
Application_Model_Show::create($data);
}
//send back a new form for the user.
@ -682,8 +682,8 @@ class ScheduleController extends Zend_Controller_Action
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id');
$showInstance = new ShowInstance($showInstanceId);
$show = new Show($showInstance->getShowId());
$showInstance = new Application_Model_ShowInstance($showInstanceId);
$show = new Application_Model_Show($showInstance->getShowId());
$show->cancelShow($showInstance->getShowStart());
}
@ -696,7 +696,7 @@ class ScheduleController extends Zend_Controller_Action
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id');
$show = new ShowInstance($showInstanceId);
$show = new Application_Model_ShowInstance($showInstanceId);
$show->clearShow();
$show->deleteShow();
// send 'cancel-current-show' command to pypo

View File

@ -9,7 +9,7 @@ class Application_Model_Dashboard
//after the last item in the schedule table, then return the show's
//name. Else return the last item from the schedule.
$showInstance = ShowInstance::GetLastShowInstance($p_timeNow);
$showInstance = Application_Model_ShowInstance::GetLastShowInstance($p_timeNow);
$row = Schedule::GetLastScheduleItem($p_timeNow);
if (is_null($showInstance)){
@ -53,7 +53,7 @@ class Application_Model_Dashboard
//name. Else return the last item from the schedule.
$row = array();
$showInstance = ShowInstance::GetCurrentShowInstance($p_timeNow);
$showInstance = Application_Model_ShowInstance::GetCurrentShowInstance($p_timeNow);
if (!is_null($showInstance)){
$instanceId = $showInstance->getShowInstanceId();
$row = Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId);
@ -98,7 +98,7 @@ class Application_Model_Dashboard
//after the last item in the schedule table, then return the show's
//name. Else return the last item from the schedule.
$showInstance = ShowInstance::GetNextShowInstance($p_timeNow);
$showInstance = Application_Model_ShowInstance::GetNextShowInstance($p_timeNow);
$row = Schedule::GetNextScheduleItem($p_timeNow);
if (is_null($showInstance)){

View File

@ -54,7 +54,7 @@ class Application_Model_MusicDir {
$this->_dir->delete();
foreach ($show_instances as $show_instance_row) {
$temp_show = new ShowInstance($show_instance_row["instance_id"]);
$temp_show = new Application_Model_ShowInstance($show_instance_row["instance_id"]);
$temp_show->updateScheduledTime();
}

View File

@ -72,14 +72,14 @@ class Application_Model_Nowplaying
$data = array();
$showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
$showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
foreach ($showIds as $showId){
$instanceId = $showId['id'];
$si = new ShowInstance($instanceId);
$si = new Application_Model_ShowInstance($instanceId);
$showId = $si->getShowId();
$show = new Show($showId);
$show = new Application_Model_Show($showId);
$showStartDateTime = DateHelper::ConvertToLocalDateTime($si->getShowStart());
$showEndDateTime = DateHelper::ConvertToLocalDateTime($si->getShowEnd());

View File

@ -337,7 +337,7 @@ class Application_Model_Preference
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Schedule::getSchduledPlaylistCount();
$outputArray['NUM_OF_PAST_SHOWS'] = ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
$outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
$outputArray = array_merge($systemInfoArray, $outputArray);

View File

@ -79,7 +79,7 @@ class RabbitMq
$temp['event_type'] = $event_type;
if($event_type = "update_schedule"){
$temp['shows'] = Show::getShows($now->format("Y-m-d H:i:s"), $end_timestamp->format("Y-m-d H:i:s"), $excludeInstance=NULL, $onlyRecord=TRUE);
$temp['shows'] = Application_Model_Show::getShows($now->format("Y-m-d H:i:s"), $end_timestamp->format("Y-m-d H:i:s"), $excludeInstance=NULL, $onlyRecord=TRUE);
}
$data = json_encode($temp);
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));

View File

@ -1,6 +1,6 @@
<?php
class Show {
class Application_Model_Show {
private $_showId;
@ -773,7 +773,7 @@ class Show {
$isRecorded = (isset($data['add_show_record']) && $data['add_show_record']) ? 1 : 0;
if ($data['add_show_id'] != -1){
$show = new Show($showId);
$show = new Application_Model_Show($showId);
$show->deletePossiblyInvalidInstances($data, $endDate, $isRecorded, $repeatType);
}
@ -870,7 +870,7 @@ class Show {
}
}
Show::populateShowUntil($showId);
Application_Model_Show::populateShowUntil($showId);
RabbitMq::PushSchedule();
return $showId;
}
@ -894,7 +894,7 @@ class Show {
//if application is requesting shows past our previous populated until date, generate shows up until this point.
if ($showsPopUntil == "" || strtotime($showsPopUntil) < strtotime($end_timestamp)) {
Show::populateAllShowsInRange($showsPopUntil, $end_timestamp);
Application_Model_Show::populateAllShowsInRange($showsPopUntil, $end_timestamp);
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
}
@ -958,7 +958,7 @@ class Show {
$date = new DateHelper();
$currentTimestamp = $date->getTimestamp();
$show = new Show($show_id);
$show = new Application_Model_Show($show_id);
if ($show->hasInstance()){
$ccShowInstance = $show->getInstance();
$newInstance = false;
@ -977,7 +977,7 @@ class Show {
}
$show_instance_id = $ccShowInstance->getDbId();
$showInstance = new ShowInstance($show_instance_id);
$showInstance = new Application_Model_ShowInstance($show_instance_id);
if (!$newInstance){
$showInstance->correctScheduleStartTimes();
@ -1026,7 +1026,7 @@ class Show {
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id={$show_id}";
$rebroadcasts = $CC_DBC->GetAll($sql);
$show = new Show($show_id);
$show = new Application_Model_Show($show_id);
$date = new DateHelper();
$currentTimestamp = $date->getTimestamp();
@ -1058,7 +1058,7 @@ class Show {
}
$show_instance_id = $ccShowInstance->getDbId();
$showInstance = new ShowInstance($show_instance_id);
$showInstance = new Application_Model_ShowInstance($show_instance_id);
if (!$newInstance){
$showInstance->correctScheduleStartTimes();
@ -1090,7 +1090,7 @@ class Show {
$next_date = $CC_DBC->GetOne($sql);
}
Show::setNextPop($next_date, $show_id, $day);
Application_Model_Show::setNextPop($next_date, $show_id, $day);
RabbitMq::PushSchedule();
}
@ -1098,18 +1098,18 @@ class Show {
$first_show, $last_show, $start_time, $duration, $day, $record, $end_timestamp) {
if($repeatType == -1) {
Show::populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $record, $end_timestamp);
Application_Model_Show::populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $record, $end_timestamp);
}
else if($repeatType == 0) {
Show::populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show,
Application_Model_Show::populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show,
$start_time, $duration, $day, $record, $end_timestamp, '7 days');
}
else if($repeatType == 1) {
Show::populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show,
Application_Model_Show::populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show,
$start_time, $duration, $day, $record, $end_timestamp, '14 days');
}
else if($repeatType == 2) {
Show::populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show,
Application_Model_Show::populateRepeatingShow($show_id, $next_pop_date, $first_show, $last_show,
$start_time, $duration, $day, $record, $end_timestamp, '1 month');
}
}
@ -1141,7 +1141,7 @@ class Show {
$res = $CC_DBC->GetAll($sql);
foreach ($res as $row) {
Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
Application_Model_Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
$row["last_show"], $row["start_time"], $row["duration"], $row["day"], $row["record"], $p_date);
}
}
@ -1173,7 +1173,7 @@ class Show {
$res = $CC_DBC->GetAll($sql);
foreach ($res as $row) {
Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
Application_Model_Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
$row["last_show"], $row["start_time"], $row["duration"], $row["day"], $row["record"], $p_endTimestamp);
}
}
@ -1195,7 +1195,7 @@ class Show {
$interval = $start_range->diff($end_range);
$days = $interval->format('%a');
$shows = Show::getShows($start, $end);
$shows = Application_Model_Show::getShows($start, $end);
$today_timestamp = date("Y-m-d H:i:s");
foreach ($shows as $show) {
@ -1203,16 +1203,16 @@ class Show {
//only bother calculating percent for week or day view.
if(intval($days) <= 7) {
$show_instance = new ShowInstance($show["instance_id"]);
$show_instance = new Application_Model_ShowInstance($show["instance_id"]);
$options["percent"] = $show_instance->getPercentScheduled();
}
if ($editable && (strtotime($today_timestamp) < strtotime($show["starts"]))) {
$options["editable"] = true;
$events[] = Show::makeFullCalendarEvent($show, $options);
$events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
}
else {
$events[] = Show::makeFullCalendarEvent($show, $options);
$events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
}
}
@ -1286,7 +1286,7 @@ class Show {
}
}
class ShowInstance {
class Application_Model_ShowInstance {
private $_instanceId;
private $_showInstance;
@ -1312,7 +1312,7 @@ class ShowInstance {
}
public function getShow(){
return new Show($this->getShowId());
return new Application_Model_Show($this->getShowId());
}
public function isRebroadcast()
@ -1479,7 +1479,7 @@ class ShowInstance {
return "Can't move show into past";
}
$overlap = Show::getShows($new_starts, $new_ends, array($this->_instanceId));
$overlap = Application_Model_Show::getShows($new_starts, $new_ends, array($this->_instanceId));
if(count($overlap) > 0) {
return "Should not overlap shows";
@ -1499,7 +1499,7 @@ class ShowInstance {
$this->setShowEnd($new_ends);
$this->correctScheduleStartTimes();
$show = new Show($this->getShowId());
$show = new Application_Model_Show($this->getShowId());
if(!$show->isRepeating()){
$show->setShowFirstShow($new_starts);
$show->setShowLastShow($new_ends);
@ -1533,7 +1533,7 @@ class ShowInstance {
//only need to check overlap if show increased in size.
if(strtotime($new_ends) > strtotime($ends)) {
$overlap = Show::getShows($ends, $new_ends);
$overlap = Application_Model_Show::getShows($ends, $new_ends);
if(count($overlap) > 0) {
return "Should not overlap shows";
@ -1678,7 +1678,7 @@ class ShowInstance {
foreach ($rebroadcasts as $rebroadcast) {
$rebroad = new ShowInstance($rebroadcast->getDbId());
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
$rebroad->addFileToShow($file_id);
}
}
@ -1877,7 +1877,7 @@ class ShowInstance {
if (is_null($id)){
return null;
} else {
return new ShowInstance($id);
return new Application_Model_ShowInstance($id);
}
}
@ -1894,7 +1894,7 @@ class ShowInstance {
if (is_null($id)){
return null;
} else {
return new ShowInstance($id);
return new Application_Model_ShowInstance($id);
}
}
@ -1911,7 +1911,7 @@ class ShowInstance {
if (is_null($id)){
return null;
} else {
return new ShowInstance($id);
return new Application_Model_ShowInstance($id);
}
}

View File

@ -62,13 +62,13 @@ function createTestShow($showNumber, $showTime, $duration = "1:00")
$data['add_show_background_color'] = "";
$data['add_show_record'] = 0;
$data['add_show_hosts'] ="";
$showId = Show::create($data);
$showId = Application_Model_Show::create($data);
//echo "show created, ID: $showId\n";
// populating the show with a playlist
$instances = Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
$instances = Application_Model_Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
$instance = array_pop($instances);
$show = new ShowInstance($instance["instance_id"]);
$show = new Application_Model_ShowInstance($instance["instance_id"]);
//echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n";
$show->scheduleShow(array(1));
//echo "done\n";

View File

@ -110,7 +110,7 @@ $playTime = date("Y-m-d H:i:s", time()+($secondsFromNow));
//$scheduleGroup = new ScheduleGroup();
//$scheduleGroup->add($playTime, null, $pl->getId());
//$show = new ShowInstance($showInstanceId);
//$show = new Application_Model_ShowInstance($showInstanceId);
//$show->scheduleShow(array($pl->getId()));
//$show->setShowStart();