/** * 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 $id the ID of the model to be loaded * @return ForumQuestion the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ForumQuestion::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<body style="background-image:url('images/bg2.png'); background-size: cover; background-size:100%; background-repeat:no-repeat; background-attachment:fixed;"> <div id="header"> <div id="logo"><img src="images/banner.png" style="width: 100vw;"/></div> </div><!-- header --> <div class="container" id="page" > <?php $countNotif = count(ForumQuestion::model()->findAll(array('condition' => 'confirmation=0'))); $notif = $this->widget('bootstrap.widgets.TbBadge', array('type' => $countNotif == 0 ? 'info' : 'important', 'label' => $countNotif), true); $receiving = count(Communication::model()->findAll(array('condition' => 'type_comm = 2 and now() >= date_agenda '))); $notifRC = $this->widget('bootstrap.widgets.TbBadge', array('type' => $receiving == 0 ? 'info' : 'important', 'label' => $receiving), true); $referralCount = count(Communication::model()->findAll(array('condition' => 'archive=0 and comm_stat=0 and type_comm<>2'))); $referralduedateCount = count(Referral::model()->findAll(array('condition' => 'referral_stat = 0 and now() > duedate'))); $meetingResoCount = count(Referral::model()->countCommMeetingReso()); $meetingOrdiCount = count(Referral::model()->countCommMeetingOrdi()); $rfTotal = 0; $rfTotal = $referralCount + $meetingOrdiCount + $meetingResoCount + $referralduedateCount; $notifRFTotal = $this->widget('bootstrap.widgets.TbBadge', array('type' => $rfTotal == 0 ? 'info' : 'important', 'label' => $rfTotal), true); $notifRFrefduedate = $this->widget('bootstrap.widgets.TbBadge', array('type' => $referralduedateCount == 0 ? 'info' : 'important', 'label' => $referralduedateCount), true); $notifRFref = $this->widget('bootstrap.widgets.TbBadge', array('type' => $referralCount == 0 ? 'info' : 'important', 'label' => $referralCount), true); $notifRFreso = $this->widget('bootstrap.widgets.TbBadge', array('type' => $meetingResoCount == 0 ? 'info' : 'important', 'label' => $meetingResoCount), true); $notifRFordi = $this->widget('bootstrap.widgets.TbBadge', array('type' => $meetingOrdiCount == 0 ? 'info' : 'important', 'label' => $meetingOrdiCount), true); $resoCount = count(Status::model()->countResolution());
public function actionview_topic($id) { $modelAnswer = new ForumAnswer(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ForumAnswer'])) { $modelAnswer->attributes = $_POST['ForumAnswer']; $modelAnswer->a_id = $id; $modelAnswer->a_datetime = date('Y-m-d h:i:sa'); $x = ForumQuestion::model()->findByPK($id); $x->reply = $x->reply + 1; $x->save(); if ($modelAnswer->save()) { $this->redirect(array('view_topic', 'id' => $id)); } } $this->render('view_topic', array('modelAnswer' => $modelAnswer, 'model' => ForumQuestion::model()->findByPK($id))); }