show hosts have option to schedule, (not implemented yet, just context menu)

This commit is contained in:
naomiaro 2010-12-13 11:49:45 -05:00
parent 4e2c791bd3
commit e8965fd30a
6 changed files with 56 additions and 27 deletions

View file

@ -2,13 +2,11 @@
class Show {
private $_userRole;
private $_userId;
private $_user;
public function __construct($userId, $userType='G')
public function __construct($user=NULL)
{
$this->_userRole = $userType;
$this->_userId = $userId;
$this->_user = $user;
}
//end dates are non inclusive.
@ -323,10 +321,14 @@ class Show {
$event[$key] = $value;
}
if($this->_userRole === "A") {
if($this->_user->isAdmin() === "A") {
$event["editable"] = true;
}
if($this->_user->isHost($show["show_id"])) {
$event["isHost"] = true;
}
return $event;
}
}

View file

@ -11,7 +11,23 @@ class User {
$this->_userId = $userId;
}
public function getUsers($type=NULL) {
public function getType(){
return $this->userRole;
}
public function getId(){
return $this->_userId;
}
public function isHost($showId) {
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($this->_userId)->count() > 0;
}
public function isAdmin() {
return $this->_userRole === 'A';
}
public static function getUsers($type=NULL) {
global $CC_DBC;
$sql;
@ -38,12 +54,8 @@ class User {
return $CC_DBC->GetAll($sql);
}
public function getHosts() {
return $this->getUsers(array('H', 'A'));
}
public function isHost($showId) {
$res = CCShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($this->_userId);
public static function getHosts() {
return User::getUsers(array('H', 'A'));
}
}