public function actioncities()
 {
     if (isset($_GET['term']) && ($keyword = trim($_GET['term'])) !== '') {
         $tags = LookupDetails::model()->suggestLookup($keyword, Constants::$city_lookup_code);
         foreach ($tags as $i => $lookup) {
             // $items[$i]['vendor_id']=$vendor->vendor_id;
             $items[$i] = $lookup->lookup_value;
         }
         echo CJSON::encode($items);
     }
 }
 static function getLookupType($id)
 {
     return LookupDetails::model()->findAllByAttributes(array('lookup_type_id' => (int) $id));
 }
 /**
  * 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 LookupDetails the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = LookupDetails::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionDelete()
 {
     switch ($_GET['model']) {
         // Load the respective model
         case 'userDetails':
             $model = UserDetails::model()->findByPk($_GET['id']);
             break;
         case 'lookupDetails':
             $model = LookupDetails::model()->findByPk($_GET['id']);
             break;
         case 'donationRequest':
             $model = DonationRequest::model()->findByPk($_GET['id']);
             break;
         default:
             $this->_sendResponse(501, sprintf('Error: Mode <b>delete</b> is not implemented for model <b>%s</b>', $_GET['model']));
             Yii::app()->end();
     }
     // Was a model found? If not, raise an error
     if ($model === null) {
         $this->_sendResponse(400, sprintf("Error: Didn't find any model <b>%s</b> with ID <b>%s</b>.", $_GET['model'], $_GET['id']));
     }
     // Delete the model
     $num = $model->delete();
     if ($num > 0) {
         $this->_sendResponse(200, $num);
     } else {
         $this->_sendResponse(500, sprintf("Error: Couldn't delete model <b>%s</b> with ID <b>%s</b>.", $_GET['model'], $_GET['id']));
     }
 }