CC-2833: Use ClassLoaders for PHP Files

-Done for class User
This commit is contained in:
martin 2011-09-23 17:00:55 -04:00
parent 1e9a8a28fe
commit 5cc7de95ee
11 changed files with 34 additions and 34 deletions

View File

@ -18,7 +18,7 @@ require_once 'Soundcloud.php';
//require_once 'Schedule.php'; //require_once 'Schedule.php';
require_once 'Preference.php'; require_once 'Preference.php';
//require_once 'Shows.php'; //require_once 'Shows.php';
require_once 'Users.php'; //require_once 'User.php';
require_once 'RabbitMq.php'; require_once 'RabbitMq.php';
require_once 'DateHelper.php'; require_once 'DateHelper.php';
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';

View File

@ -67,7 +67,7 @@ class LibraryController extends Zend_Controller_Action
$paramsPop = str_replace('#type#', $type, $paramsPop); $paramsPop = str_replace('#type#', $type, $paramsPop);
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$pl_sess = $this->pl_sess; $pl_sess = $this->pl_sess;
@ -139,7 +139,7 @@ class LibraryController extends Zend_Controller_Action
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($user->isAdmin()) { if ($user->isAdmin()) {

View File

@ -23,7 +23,7 @@ class NowplayingController extends Zend_Controller_Action
$refer_sses = new Zend_Session_Namespace('referrer'); $refer_sses = new Zend_Session_Namespace('referrer');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($request->isPost()) { if ($request->isPost()) {
$form = new Application_Form_RegisterAirtime(); $form = new Application_Form_RegisterAirtime();

View File

@ -58,7 +58,7 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Schedule::createNewFormSections($this->view); Application_Model_Schedule::createNewFormSections($this->view);
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$this->view->isAdmin = $user->isAdmin(); $this->view->isAdmin = $user->isAdmin();
$this->view->isProgramManager = $user->isUserType('P'); $this->view->isProgramManager = $user->isUserType('P');
} }
@ -69,7 +69,7 @@ class ScheduleController extends Zend_Controller_Action
$end = $this->_getParam('end', null); $end = $this->_getParam('end', null);
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)))
$editable = true; $editable = true;
else else
@ -85,7 +85,7 @@ class ScheduleController extends Zend_Controller_Action
$showInstanceId = $this->_getParam('showInstanceId'); $showInstanceId = $this->_getParam('showInstanceId');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
@ -104,7 +104,7 @@ class ScheduleController extends Zend_Controller_Action
$showInstanceId = $this->_getParam('showInstanceId'); $showInstanceId = $this->_getParam('showInstanceId');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
@ -120,7 +120,7 @@ class ScheduleController extends Zend_Controller_Action
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
@ -147,7 +147,7 @@ class ScheduleController extends Zend_Controller_Action
$epochNow = time(); $epochNow = time();
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = new Application_Model_ShowInstance($id); $show = new Application_Model_ShowInstance($id);
$params = '/format/json/id/#id#'; $params = '/format/json/id/#id#';
@ -224,7 +224,7 @@ class ScheduleController extends Zend_Controller_Action
} }
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
@ -243,7 +243,7 @@ class ScheduleController extends Zend_Controller_Action
{ {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()))
@ -278,7 +278,7 @@ class ScheduleController extends Zend_Controller_Action
$search = $this->_getParam('search', null); $search = $this->_getParam('search', null);
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_ShowInstance($showInstanceId);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
@ -358,7 +358,7 @@ class ScheduleController extends Zend_Controller_Action
public function editShowAction() public function editShowAction()
{ {
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
return; return;
} }
@ -625,7 +625,7 @@ class ScheduleController extends Zend_Controller_Action
if(!$isSaas){ if(!$isSaas){
if($record && $rebroadAb && $rebroad){ if($record && $rebroadAb && $rebroad){
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Application_Model_Show::create($data); Application_Model_Show::create($data);
} }
@ -637,7 +637,7 @@ class ScheduleController extends Zend_Controller_Action
} }
}else{ }else{
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Application_Model_Show::create($data); Application_Model_Show::create($data);
} }
@ -677,7 +677,7 @@ class ScheduleController extends Zend_Controller_Action
public function cancelShowAction() public function cancelShowAction()
{ {
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
@ -692,7 +692,7 @@ class ScheduleController extends Zend_Controller_Action
public function cancelCurrentShowAction() public function cancelCurrentShowAction()
{ {
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');

View File

@ -34,7 +34,7 @@ class UserController extends Zend_Controller_Action
$formdata = $form->getValues(); $formdata = $form->getValues();
if ($form->validateLogin($formdata)){ if ($form->validateLogin($formdata)){
$user = new User($formdata['user_id']); $user = new Application_Model_User($formdata['user_id']);
$user->setFirstName($formdata['first_name']); $user->setFirstName($formdata['first_name']);
$user->setLastName($formdata['last_name']); $user->setLastName($formdata['last_name']);
$user->setLogin($formdata['login']); $user->setLogin($formdata['login']);
@ -63,13 +63,13 @@ class UserController extends Zend_Controller_Action
public function getHostsAction() public function getHostsAction()
{ {
$search = $this->_getParam('term'); $search = $this->_getParam('term');
$this->view->hosts = User::getHosts($search); $this->view->hosts = Application_Model_User::getHosts($search);
} }
public function getUserDataTableInfoAction() public function getUserDataTableInfoAction()
{ {
$post = $this->getRequest()->getPost(); $post = $this->getRequest()->getPost();
$users = User::getUsersDataTablesInfo($post); $users = Application_Model_User::getUsersDataTablesInfo($post);
die(json_encode($users)); die(json_encode($users));
} }
@ -77,7 +77,7 @@ class UserController extends Zend_Controller_Action
public function getUserDataAction() public function getUserDataAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$this->view->entries = User::GetUserData($id); $this->view->entries = Application_Model_User::GetUserData($id);
} }
public function removeUserAction() public function removeUserAction()
@ -89,7 +89,7 @@ class UserController extends Zend_Controller_Action
$userId = $userInfo->id; $userId = $userInfo->id;
if ($delId != $userId){ if ($delId != $userId){
$user = new User($delId); $user = new Application_Model_User($delId);
$this->view->entries = $user->delete(); $this->view->entries = $user->delete();
} }

View File

@ -13,7 +13,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
)); ));
$options = array(); $options = array();
$hosts = User::getHosts(); $hosts = Application_Model_User::getHosts();
foreach ($hosts as $host) { foreach ($hosts as $host) {
$options[$host['value']] = $host['label']; $options[$host['value']] = $host['label'];

View File

@ -333,7 +333,7 @@ class Application_Model_Preference
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0]; $outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
} }
$outputArray['NUM_OF_USERS'] = User::getUserCount(); $outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount(); $outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount(); $outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount(); $outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();

View File

@ -5,7 +5,7 @@ define('UTYPE_ADMIN', 'A');
define('UTYPE_GUEST', 'G'); define('UTYPE_GUEST', 'G');
define('UTYPE_PROGRAM_MANAGER', 'P'); define('UTYPE_PROGRAM_MANAGER', 'P');
class User { class Application_Model_User {
private $_userInstance; private $_userInstance;
@ -217,7 +217,7 @@ class User {
} }
public static function getHosts($search=NULL) { public static function getHosts($search=NULL) {
return User::getUsers(array('H'), $search); return Application_Model_User::getUsers(array('H'), $search);
} }
public static function getUsersDataTablesInfo($datatables_post) { public static function getUsersDataTablesInfo($datatables_post) {

View File

@ -26,7 +26,7 @@ require_once 'Playlist.php';
require_once 'StoredFile.php'; require_once 'StoredFile.php';
require_once 'Schedule.php'; require_once 'Schedule.php';
require_once 'Shows.php'; require_once 'Shows.php';
require_once 'Users.php'; require_once 'User.php';
require_once 'RabbitMq.php'; require_once 'RabbitMq.php';
require_once 'Preference.php'; require_once 'Preference.php';
//require_once APPLICATION_PATH.'/controllers/plugins/RabbitMqPlugin.php'; //require_once APPLICATION_PATH.'/controllers/plugins/RabbitMqPlugin.php';

View File

@ -10,7 +10,7 @@ require_once("$airtime_base_dir/library/propel/runtime/lib/Propel.php");
Propel::init("$airtime_base_dir/application/configs/airtime-conf.php"); Propel::init("$airtime_base_dir/application/configs/airtime-conf.php");
require_once("$airtime_base_dir/application/configs/conf.php"); require_once("$airtime_base_dir/application/configs/conf.php");
require_once("$airtime_base_dir/application/models/Users.php"); require_once("$airtime_base_dir/application/models/User.php");
require_once('DB.php'); require_once('DB.php');
require_once('Console/Getopt.php'); require_once('Console/Getopt.php');
@ -84,17 +84,17 @@ $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
// Check if the user exists // Check if the user exists
$id = User::GetUserID($username); $id = Application_Model_User::GetUserID($username);
if ($action == "addupdate") { if ($action == "addupdate") {
if ($id < 0) { if ($id < 0) {
echo "Creating user\n"; echo "Creating user\n";
$user = new User(""); $user = new Application_Model_User("");
$user->setLogin($username); $user->setLogin($username);
} else { } else {
echo "Updating user\n"; echo "Updating user\n";
$user = new User($id); $user = new Application_Model_User($id);
} }
do{ do{
@ -130,7 +130,7 @@ if ($action == "addupdate") {
exit; exit;
} else { } else {
echo "Deleting user\n"; echo "Deleting user\n";
$user = new User($id); $user = new Application_Model_User($id);
$user->delete(); $user->delete();
} }
} }

View File

@ -29,7 +29,7 @@ require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir']; $CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
require_once($CC_CONFIG['phpDir'].'/application/models/Users.php'); require_once($CC_CONFIG['phpDir'].'/application/models/User.php');
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php'); require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php');