<div class="row appendhere" style="margin-top:10px;"> <div class="col-xs-2"> <label>Notes</label> </div> <div class="col-xs-10"> <?php if (isset($model->id)) { ?> <table class="table"><thead> <tr> <th>File Name</th> <th>Description</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody> <?php $Criteria = new CDbCriteria(); $Criteria->condition = "session_id={$model->id}"; $fls = SessionNotes::model()->findAll($Criteria); foreach ($fls as $fl) { echo "<tr class='rmcla_{$fl->id}'> <td>{$fl->url}</td> <td>{$fl->description}</td> <td>{$fl->date}</td> <td><a href='javascript:void(0)' onclick='dofdelete({$fl->id});return false;' class='delete'> Delete</a></td> </tr>"; } ?> </tbody> </table> <?php } ?> </div>
//============================================================================================ // Session, configuration file, localization constructor //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('internal', true); if (!isset($SESSION->lang)) { $SESSION->lang = DEFAULT_LANGUAGE; } \Locale::setDefault($SESSION->lang); $l10n->setLanguage($SESSION->lang); //============================================================================================ // Model //============================================================================================ $profile = new Profile($dbo); $sessionnotes = new SessionNotes($dbo); $emp_profile = new \Ventus\Profile\MyProfile($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; $thisPage = 'case'; if (!empty($studentProfile)) { $emp_signature = nl2br($emp_profile->getEmpSignature($SESSION->user_name)); $result = $sessionnotes->listSessionNotes($_GET['student_num']); $next_interview_number = $sessionnotes->getLastInterviewNumber($_GET['student_num']); if (is_int($next_interview_number)) {
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Session'])) { $model->attributes = $_POST['Session']; if ($model->save()) { $cid = $model->id; foreach ($_FILES['afiles']['tmp_name'] as $key => $tmp_name) { $afilesdesc = $_POST['afilesdesc'][$key]; $file_name = $_FILES['afiles']['name'][$key]; $file_tmp = $_FILES['afiles']['tmp_name'][$key]; if (!empty($file_name)) { $nx = explode(".", $file_name); $pname = $nx[0] . rand(1000, 999999999) . "." . pathinfo($file_name, PATHINFO_EXTENSION); $file = Yii::app()->basePath . '/../uploads/images/' . $pname; move_uploaded_file($file_tmp, $file); $ca = new SessionNotes(); $ca->session_id = $cid; $ca->url = $pname; $ca->description = $afilesdesc; $ca->save(); } if (isset($_POST['comments'])) { foreach ($_POST['comments'] as $cmt) { $mcm = new SessionComment(); $mcm->comment = $cmt; $mcm->users_id = Yii::app()->user->id; $mcm->session_id = $cid; $mcm->save(); } } if (isset($_POST['thrapist'])) { foreach ($_POST['thrapist'] as $kx => $thid) { $sth = new SessionTherapist(); $sth->therapist_id = $thid; $sth->total_time = $_POST['thrapisttime'][$kx]; $sth->session_id = $cid; $sth->save(); } } } $this->redirect(array('index')); } } $this->render('update', array('model' => $model)); }
/** * 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 SessionNotes the loaded model * @throws CHttpException */ public function loadModel($id) { $model = SessionNotes::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }