/**
  * 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);
     $modelPhoto = new ImportForm();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['MastersEmployees'])) {
         $model->attributes = $_POST['MastersEmployees'];
         if ($model->save()) {
             if (isset($_POST['ImportForm'])) {
                 $modelPhoto->attributes = $_POST['ImportForm'];
                 $imgFile = CUploadedFile::getInstance($modelPhoto, 'file');
                 if (isset($imgFile)) {
                     $imgFile->saveAs(profilePaths() . $model->code . '.jpg');
                 }
             }
             $this->redirect(array('update', 'id' => $model->id));
         }
     }
     if (isset($_GET['tab'])) {
         $select_tab = $_GET['tab'];
     } else {
         $select_tab = 0;
     }
     $this->render('update', array('model' => $model, 'modelPhoto' => $modelPhoto, 'select_tab' => $select_tab));
 }
 public function getPhoto()
 {
     if (file_exists(profilePaths() . $this->code . '.jpg')) {
         return profileUrl() . $this->code . '.jpg';
     } else {
         return profileUrl() . 'default.png';
     }
 }