Example #1
0
 /**
  * indexAction
  * Create the User object and get all the records.
  * @return unknown_type
  */
 public function getallAction()
 {
     $result = array();
     $result['success'] = false;
     $id = $this->getRequest()->getParam('country_id');
     $id = intval($id);
     if ($id == 0) {
         $result['message'] = 'CoutryId not found';
         echo json_encode($result);
         exit;
     }
     $result['success'] = true;
     $regions = Regions::findAll($id);
     $result['total'] = count($regions);
     if ($result['total'] > 0) {
         array_unshift($regions, array('region_id' => 0, 'name' => '-- Select Regions --'));
     }
     $result['rows'] = $regions;
     echo json_encode($result);
     exit;
 }