예제 #1
0
 public function subofficeAction()
 {
     //disable layout
     $this->_helper->layout()->disableLayout();
     //view instance for office type
     $officetype_id = $this->view->officetypeid = $this->_request->getParam('officetype_id');
     $subOffice = new Officedefault_Model_officedefault();
     $path = $this->view->baseUrl();
     $officeForm = new Officedefault_Form_officedefault($path, $this->view->createdby);
     $this->view->form = $officeForm;
     $hierarchylevel2 = $subOffice->hierarchylevel($officetype_id);
     $maxid = $subOffice->findlastlevel();
     foreach ($maxid as $maxid1) {
         $lastid = $maxid1->lastid;
     }
     if ($lastid == $officetype_id) {
         $this->view->subform = $lastid;
         $district = $this->view->adm->viewRecord("ourbank_master_districtlist", "id", "DESC");
         foreach ($district as $district1) {
             $officeForm->district->addMultiOption($district1['id'], $district1['name']);
         }
         $taluque = $this->view->adm->viewRecord("ourbank_master_taluklist", "id", "DESC");
         foreach ($taluque as $taluque1) {
             $officeForm->taluque->addMultiOption($taluque1['id'], $taluque1['name']);
         }
     }
     //list hierarchy level
     foreach ($hierarchylevel2 as $hierarchylevel1) {
         $hierarchylevel = $hierarchylevel1->hierarchylevel;
         //level
     }
     $officetypeIds = $subOffice->officetypeid($hierarchylevel);
     foreach ($officetypeIds as $officetypeIds1) {
         $officetypeId = $officetypeIds1->id;
     }
     if ($officetypeId == 1) {
         $this->view->selectedSuboffice = $subOffice->subofficeFromUrl($officetypeId);
         $this->view->officetypename = $subOffice->officetypename($officetypeId);
     } else {
         $this->view->selectedSuboffice = $subOffice->subofficeFromUrl($officetypeId);
         $this->view->officetypename = $subOffice->officetypename($officetypeId);
     }
     //fetch selected sub office and id
     if ($this->view->selectedSuboffice) {
         foreach ($this->view->selectedSuboffice as $eacharraysent) {
             $officeForm->parentoffice_id->addMultiOption($eacharraysent->id, $eacharraysent->name);
         }
     } else {
         foreach ($this->view->officetypename as $officetype) {
             $officeForm->parentoffice_id->addMultiOption($officetype->id, $officetype->type);
         }
     }
 }