/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = EventsType::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Return events as JSON-string for AJAX call * @param <int> $start unix time * @param <int> $end unix time */ public function actionList($start = 0, $end = 0) { //echo $_REQUEST['type'];exit; if (Yii::app()->request->isAjaxRequest and Yii::app()->user->hasState('calUserId')) { if ($_GET['type']) { $criteria = new CDbCriteria(array('condition' => 'user_id=:user_id and type=:type', 'params' => array(':user_id' => Yii::app()->user->getState('calUserId'), ':type' => $_GET['type']))); } else { $criteria = new CDbCriteria(array('condition' => 'user_id=:user_id', 'params' => array(':user_id' => Yii::app()->user->getState('calUserId')))); } $criteria->addBetweenCondition('start', $start, $end); $events = Event::model()->findAll($criteria); foreach ($events as $k => $event) { //code $event_type = EventsType::model()->findByPk($event->type); $events[$k]['code'] = $event_type->colour_code; } echo CJSON::encode($events); Yii::app()->end(); } }
<div class="form" style="padding-left:50px;"> <?php echo CHtml::beginForm(); ?> <div class="row"> <?php echo CHtml::hiddenField("EventCal_id", 0); echo CHtml::label(Yii::t('CalModule.fullCal', 'Message '), "EventCal_title"); echo CHtml::textField("EventCal_title"); ?> </div> <div class="row"> <?php echo CHtml::label('Event Type', "EventCal_type"); $events_type = CHtml::listData(EventsType::model()->findAll(), 'id', 'name'); echo CHtml::dropDownList("EventCal_type", 0, $events_type, array('style' => 'width:185px;', 'prompt' => 'Select')); //echo CHtml::dropDownList("EventCal_type", 0, array('1' => 'Exams', '2' => 'Holidays', '3' => 'Notice', '4' => 'Meetings')); ?> </div> <div class="row"> <?php echo CHtml::label('Event Privacy', "EventCal_placeholder"); if (Yii::app()->user->isSuperuser) { $all_roles = new RAuthItemDataProvider('roles', array('type' => 2)); $data = $all_roles->fetchData(); $roles = CHtml::listData($data, 'name', 'name'); echo CHtml::dropDownList("EventCal_placeholder", '0', $roles, array('empty' => array('0' => 'Public'), 'style' => 'text-transform: capitalize;')); } ?> </div>
if($event->type == 1) echo '<div class="stripbx yellowstrip">'.date("d", $event->start).'<span>'.date("M", $event->start).'</span></div>'; if($event->type == 2) echo '<div class="stripbx redstrip">'.date("d", $event->start).'<span>'.date("M", $event->start).'</span></div>'; if($event->type == 3) echo '<div class="stripbx bluestrip">'.date("d", $event->start).'<span>'.date("M", $event->start).'</span></div>'; if($event->type == 4) echo '<div class="stripbx greenstrip">'.date("d", $event->start).'<span>'.date("M", $event->start).'</span></div>'; ?><?php */ ?> <!--<div class="stripbx yellowstrip">28<span>sep</span></div> <div class="stripbx redstrip">28<span>sep</span></div> <div class="stripbx bluestrip">28<span>sep</span></div> <div class="stripbx greenstrip">28<span>sep</span></div> --> <?php $event_type = EventsType::model()->findByPk($event->type); echo '<div class="stripbx" style="position:relative;"><div style="position:absolute; background-color:' . $event_type->colour_code . ';top:0px;left:0px; width:3px; height:47px;"></div>' . date("d", $event->start) . '<span>' . date("M", $event->start) . '</span></div>'; ?> </td> <td align="left"> <div class="hdng_events"><?php echo substr($event->title, 0, 25); ?> </div> <div style="width:580px;"> <?php echo CHtml::ajaxLink(substr($event->desc, 0, 50), $this->createUrl('default/view', array('event_id' => $event->id)), array('update' => '#jobDialog'), array('id' => 'showJobDialog1' . $event->id, 'class' => 'add')); ?> </div> <div id="jobDialog"></div>
return $message; } $this->widget('zii.widgets.CMenu', array('encodeLabel' => false, 'activateItems' => true, 'activeCssClass' => 'list_active', 'items' => array(array('label' => t('Mailbox<span>All Received Messages</span>'), 'url' => array('/mailbox'), 'active' => (Yii::app()->controller->module->id == 'mailbox' and Yii::app()->controller->id != 'news') ? true : false, 'linkOptions' => array('class' => 'inbox_ico')), array('label' => t('News<span>All Site News</span>'), 'url' => array('/mailbox/news'), 'active' => Yii::app()->controller->id == 'news' ? true : false, 'linkOptions' => array('class' => 'news_ico')), array('label' => t('Activity Feed<span>Track Activities</span>'), 'url' => array('/activityFeed/index'), 'active' => Yii::app()->controller->id == 'activityFeed' ? true : false, 'linkOptions' => array('class' => 'news_ico')), array('label' => '' . t('<h1>Events</h1>'), 'active' => Yii::app()->controller->module->id == 'cal' ? true : false), array('label' => Yii::t('dashboard', 'Events List<span>All Events</span>'), 'url' => array('/dashboard/default/events'), 'active' => Yii::app()->controller->module->id == 'dashboard' ? true : false, 'linkOptions' => array('class' => 'evntlist_ico')), array('label' => Yii::t('dashboard', 'Calendar<span>Schedule Events</span>'), 'url' => array('/cal'), 'active' => (Yii::app()->controller->module->id == 'cal' and Yii::app()->controller->id != 'eventsType') ? true : false, 'linkOptions' => array('class' => 'cal_ico')), array('label' => Yii::t('dashboard', 'Event Types<span>Manage Event Types</span>'), 'url' => array('/cal/eventsType'), 'active' => Yii::app()->controller->id == 'eventsType' ? true : false, 'linkOptions' => array('class' => 'evnttype_ico'))))); ?> </div> </td> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" width="75%"> <div class="cont_right formWrapper" style="padding-left:20px; position:relative;"> <h1>Calendar</h1> <div style="position:absolute; width:auto; z-index:10; top:127px; right:22px; font-size:14px;"> <?php echo Yii::t('CalModule.fullCal', 'Show'); $data = EventsType::model()->findAll(); $events_type = CHtml::listData($data, 'id', 'name'); foreach ($data as $datum) { $options["options"][$datum->id] = array("style" => "background-color:" . $datum->colour_code); } $options["prompt"] = 'All Events'; $options["style"] = 'margin:10px'; $options["onchange"] = 'getType();'; $options["id"] = 'eventid'; echo CHtml::dropDownList("Event_type", $_REQUEST['type'], $events_type, $options); ?> </div> <div id="calendar" style="width:100%; padding-top:5px"><?php echo $content; ?> </div>