public function getImages($fm_id)
 {
     $images = FaceImageMaster::model()->findAllByAttributes(array('fm_id' => $fm_id));
     $image = array();
     $count = 0;
     foreach ($images as $img) {
         //            $i.='http://' . $_SERVER['HTTP_HOST'] . $this->imgPath;
         //            $i.= $img->image;
         $image[$count] = '<a class="popup-img" href="' . self::model()->imgPath . $img->image . '" ><img src="' . self::model()->imgPath . $img->image . '" height="60"  width="80"/></a>';
         //           $i.= "<br>";
         $count++;
     }
     $i = implode('<br><br>', $image);
     //        echo '<pre>';print_r($i);die;
     return $i;
 }
 /**
  * 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 FaceImageMaster the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = FaceImageMaster::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
           * if $status =0 then user added with not images added and some problems with image 
           * 
           */
             $stauts = 2;
             if (!empty($image) && $image[0] !== "") {
                 foreach ($image as $i) {
                     $FaceImageMaster = new FaceImageMaster();
                     $FaceImageMaster->fm_id = $FaceMasterprimarykey;
                     $FaceImageMaster->tracer_id = $tracer_id;
                     $FaceImageMaster->image = $i;
                     $FaceImageMaster->created_on = date('Y-m-d H:i:s');
                     //                        print_r($FaceImageMaster);die;
                     if ($FaceImageMaster->save()) {
                         $status = 1;
                     } else {
                         //                                 print_r($FaceImageMaster->getErrors());
                         $status = 0;
                     }
                 }
                 //                    print_r($status);die;
                 if ($status == 1) {
                     $response = array("status" => '1', "message" => "User Added.");
                     echo json_encode(array("response" => $response));
                     die;
                 } else {
                     if ($status == 0) {
                         $response = array("status" => '3', "message" => "User added but image have problem.");
                         echo json_encode(array("response" => $response));
                         die;
                     }
                 }
             } else {
                 $response = array("status" => '2', "message" => "User is added but no images are added.");
                 echo json_encode(array("response" => $response));
                 die;
             }
         } else {
             //                echo "<pre>";
             //                print_r($FaceMaster->getErrors());die;
             $response = array("status" => '-1', "message" => "error in saving user.");
             echo json_encode(array("response" => $response));
             die;
         }
     }
 }
 /*
   * insert aimages
   * it using multi part
   * it will replace the InsertRecord function
   * parameters and output are as it is 
   * 
   */
 public function actionInsertRecord()
 {
     $post = $_POST;
     $require = array('user_name', 'tracer_id', 'result');
     $error = 0;
     $msg = array();
     foreach ($post as $key => $val) {
         if (in_array($key, $require)) {
             if ($post[$key] == '') {
                 $error++;
                 $msg[] = "{$key} is required!";
             }
         }
     }
     if ($error > 0) {
         /*
          * if empty require field
          * member_id
          * lat
          * lng
          */
         $response = array("status" => '-2', "message" => $msg);
         echo json_encode(array("response" => $response));
         die;
     } else {
         $face_master_table = "face_master";
         $user_name = $post['user_name'];
         $tracer_id = $post['tracer_id'];
         $post['created_on'] = date('Y-m-d H:i:s');
         $result = $post['result'];
         $response_addface = Yii::app()->JsonWebservice->addData($face_master_table, $post, $nfield = "", $uniqueField = "", $lastIdStatus = 0, $fieldEncode = " ", $dataobj = 'db');
         //       print_r($response_addface['status']==1);die;
         //            print_r($post);
         //            $FaceMaster = new FaceMaster();
         //            $FaceMaster->user_name = $user_name;
         //            $FaceMaster->tracer_id = $tracer_id;
         //            $FaceMaster->result = $result;
         //            $FaceMaster->created_on = date('Y-m-d H:i:s');
         //            print_r($FaceMaster);die;
         if ($response_addface['status'] == 1) {
             /*
              * get the new inserted records PK
              */
             //                $FaceMasterprimarykey = $FaceMaster->getPrimaryKey();
             $FaceMasterprimarykey = $response_addface['lastid'];
             /*
           * for giving proper response set flag $status=2
           * if $status =1 then user added with images