public function newNotification() { $model = new sNotification(); // $this->performAjaxValidation($model); if (isset($_POST['sNotification'])) { $model->attributes = $_POST['sNotification']; $model->sender_id = Yii::app()->user->id; $model->type_id = 2; $model->read_id = 1; $model->category_id = 12; if ($model->save()) { Yii::app()->user->setFlash('success', 'Message has been sent...'); $this->refresh(); } } return $model; }
public function newNotification() { $model = new sNotification(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['sNotification'])) { $model->attributes = $_POST['sNotification']; $model->sender_id = Yii::app()->user->id; $model->type_id = 2; $model->read_id = 1; $model->category_id = 12; if ($model->save()) { Yii::app()->user->setFlash('success', 'data has been saved successfully'); $this->refresh(); } } return $model; }
protected function renderContent() { /* 1 = Admin Message 2 = User Message 3 = Allocation Custom Message */ $model = $this->newNotification(); $model3 = $this->newNotification3(); $dataProvider = sNotification::model()->searchFilter(); $dataProvider3 = sNotification3::model()->searchFilter3(); $this->render('message', array('dataProvider' => $dataProvider, 'model' => $model, 'dataProvider3' => $dataProvider3, 'model3' => $model3)); }
<ul class="nav nav-list"> <li class="nav-header"> Personalization </li> </ul> <?php $this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => array(array('label' => 'Inbox (' . sNotification::model()->getUnreadNotification() . ')', 'url' => Yii::app()->createUrl('sNotification')), array('label' => 'Profile', 'url' => '#'), array('label' => 'Theme', 'url' => '#'), array('label' => 'Bookmark', 'url' => '#')))); ?> <br/> <?php //$this->widget('bootstrap.widgets.BootBadge', array( // 'type'=>'success', // '', 'success', 'warning', 'error', 'info' or 'inverse' // 'label'=>sNotification::model()->getUnreadNotification(), //));
<?php $this->breadcrumbs = array('Notification' => array('index'), $model->id); $this->menu = array(array('label' => 'Home', 'url' => array('index'))); $this->menu1 = sNotification::getTopUpdated(); $this->menu2 = sNotification::getTopCreated(); ?> <div class="page-header"> <h1> <?php echo CHtml::image(Yii::app()->request->baseUrl . '/images/icon/preferences_desktop_notification.png'); ?> <?php echo $model->sender_ref; ?> </h1> </div> <div class="row-fluid"> <div class="span12"> <div class="well"> <h4><span class="icon fam-note"></span> <?php echo sUser::model()->findName($model->sender_id) . ' to ' . sUser::model()->findName($model->receiver_id); ?> | <?php echo sParameter::item("cCategory", $model->category_id); ?> </h4>
public function actionMarkHide($id) { $model = sNotification::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } $model->read_id = 6; $model->archive_date = time(); $model->save(); $this->redirect(array('admin')); }