| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/app/Controller/ |
Upload File : |
<?php
App::uses('AppController', 'Controller');
/**
* Districts Controller
*
* @property District $District
* @property PaginatorComponent $Paginator
*/
class DistrictsController extends AppController {
/**
* Get `district` list.
* use province's id to get all district the belong to province.
*
* @param integer $id id of province
* @return json list of `district`
* @author 3Musketeers <3musketeersteam@gmail.com>
* @since 4 October 2013
*/
public function get( $id = null ) {
$this->autoRender = false;
$districts = $this->District->find('list', array(
'conditions' => array('District.province_id' => $id),
'recursive' => -1,
'order' => 'District.name'
));
if ( !empty($districts) ) {
return json_encode($districts);
}
return json_encode(false);
}
// public function edit() {
// $id = 28;
// if ( $this->request->is( 'post' ) || $this->request->is('put') ) {
// // $this->District->id = $this->request->data['District']['id'];
// }
// $districts = $this->District->findAllByProvinceId( $id );
// $this->set(compact('districts'));
// }
}