Beispiel #1
0
 public function getAll($regionid)
 {
     $this->authenticate();
     if (empty($regionid)) {
         throw new Shineisp_Api_Exceptions(400002, ":: 'regionid' field");
         exit;
     }
     $provinces = Provinces::findAllByRegionID($regionid);
     if (empty($provinces)) {
         return false;
     }
     return $provinces;
 }
 /**
  * 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('region_id');
     $id = intval($id);
     if ($id == 0) {
         $result['message'] = 'RegionID not found';
         echo json_encode($result);
         exit;
     }
     $result['success'] = true;
     $provinces = Provinces::findAllByRegionID($id);
     $result['total'] = count($provinces);
     if ($result['total'] > 0) {
         array_unshift($provinces, array('province_id' => 0, 'name' => '-- Select Provinces --', 'code' => ''));
     }
     $result['rows'] = $provinces;
     echo json_encode($result);
     exit;
 }