show hosts have option to schedule, (not implemented yet, just context menu)
This commit is contained in:
parent
4e2c791bd3
commit
e8965fd30a
|
@ -32,9 +32,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet('/css/schedule.css');
|
||||
|
||||
|
||||
$eventMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
$eventDefaultMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
|
||||
$this->view->eventMenu = $eventMenu;
|
||||
$this->view->eventDefaultMenu = $eventDefaultMenu;
|
||||
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Schedule');
|
||||
|
||||
$this->view->eventHostMenu = $eventHostMenu;
|
||||
}
|
||||
|
||||
public function eventFeedAction()
|
||||
|
@ -49,7 +54,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$this->view->events = $show->getFullCalendarEvents($start, $end, $weekday);
|
||||
}
|
||||
|
||||
|
@ -63,7 +69,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
$overlap = $show->addShow($form->getValues());
|
||||
|
||||
if(isset($overlap)) {
|
||||
|
@ -85,7 +91,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$overlap = $show->moveShow($showId, $deltaDay, $deltaMin);
|
||||
|
||||
|
@ -101,7 +107,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$overlap = $show->resizeShow($showId, $deltaDay, $deltaMin);
|
||||
|
||||
|
@ -115,7 +121,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$show->deleteShow($showId);
|
||||
}
|
||||
|
|
|
@ -91,9 +91,8 @@ class Application_Form_AddShow extends Zend_Form
|
|||
'required' => false,
|
||||
));
|
||||
|
||||
$user = new User();
|
||||
$options = array();
|
||||
$hosts = $user->getHosts();
|
||||
$hosts = User::getHosts();
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['id']] = $host['login'];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<div><span id='schedule_add_show'>Add Show</span></div>
|
||||
<div id='schedule_calendar'></div>
|
||||
|
||||
<ul id="schedule_event_menu" class="contextMenu">
|
||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventMenu) ?>
|
||||
<ul id="schedule_event_default_menu" class="contextMenu">
|
||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventDefaultMenu) ?>
|
||||
</ul>
|
||||
<ul id="schedule_event_host_menu" class="contextMenu">
|
||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventHostMenu) ?>
|
||||
</ul>
|
||||
|
|
|
@ -142,9 +142,16 @@ function eventRender(event, element, view) {
|
|||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_menu'}, eventMenu
|
||||
);
|
||||
if(event.isHost === true) {
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_host_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
else{
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_default_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
|
||||
$(element).data({'event': event});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue