public function getTradingOfficeTree($lang = 'vi') { $listoffice = $this->getList(0, $lang); $array = array(); $count = TradingDistrict::model()->count(); $count = intval($count['count']); for ($i = 1; $i <= $count; $i++) { $array[$i] = array(); } foreach ($listoffice as $key => $val) { $index = $val['id_district']; unset($val['id_district']); reset($val); $array[$index][count($array[$index])] = $val; } return $array; }
public function actionTrash() { $lang = Yii::app()->language; $errorArray = NULL; $listTradingDistrict = TradingDistrict::model()->getArray(); $tradingdistrict_id = Yii::app()->request->getParam('id'); //lây phan tu dau tien if (empty($tradingdistrict_id)) { //nếu không tồn tại thì lấy phần tử đầu tiên trong TradingDistrict $tradingdistrict_id = 1; } $listTradingOffice = TradingOffice::model()->getList($tradingdistrict_id, $lang, 0); $this->render(strtolower($this->action->Id), array('tradingdistrict_id' => $tradingdistrict_id, 'listTradingDistrict' => $listTradingDistrict, 'listTradingOffice' => $listTradingOffice)); }