示例#1
0
 public function init()
 {
     $this->setAttrib('class', 'horizontal-form')->setName('search');
     $elements = array();
     $dbDec = App_Model_DbTable_Factory::get('Dec');
     $rows = $dbDec->fetchAll(array(), array('name_dec'));
     $optCeop[''] = '';
     foreach ($rows as $row) {
         $optCeop[$row->id_dec] = $row->name_dec;
     }
     $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('CEOP')->addMultiOptions($optCeop)->setAttrib('class', 'm-wrap span12');
     $elements[] = $this->createElement('text', 'evidence')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 evidence_card')->setLabel('Kartaun Evidensia');
     // List Districts just from Timor
     $mapperDistrict = new Register_Model_Mapper_AddDistrict();
     $districts = $mapperDistrict->listAll(1);
     $optDistrict[''] = '';
     foreach ($districts as $district) {
         $optDistrict[$district->acronym] = $district->acronym;
     }
     $elements[] = $this->createElement('select', 'num_district')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->setRequired(true)->addMultiOptions($optDistrict)->setRegisterInArrayValidator(false);
     // List Sub Districts
     $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict();
     $subDistricts = $mapperSubDistrict->listAll();
     $optSubDistrict[''] = '';
     foreach ($subDistricts as $subDistrict) {
         $optSubDistrict[$subDistrict->acronym] = $subDistrict->acronym;
     }
     $elements[] = $this->createElement('select', 'num_subdistrict')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->addMultiOptions($optSubDistrict)->setRequired(true)->setRegisterInArrayValidator(false);
     $elements[] = $this->createElement('text', 'num_servicecode')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('readOnly', true)->setValue('BU')->setAttrib('class', 'm-wrap span2');
     $elements[] = $this->createElement('text', 'num_year')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('class', 'm-wrap span2 text-numeric4');
     $elements[] = $this->createElement('text', 'num_sequence')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 4)->setAttrib('class', 'm-wrap span2');
     $elements[] = $this->createElement('text', 'first_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setRequired(true)->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Primeru');
     $elements[] = $this->createElement('text', 'last_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Ultimu');
     $elements[] = $this->createElement('checkbox', 'active')->setDecorators($this->getDefaultElementDecorators())->setCheckedValue(1)->setUncheckedValue(0)->setValue(1)->setAttrib('class', 'toggle-check')->setLabel('Ativu?');
     $optHired[''] = '';
     $optHired['1'] = 'Sim';
     $optHired['0'] = 'Lae';
     $elements[] = $this->createElement('select', 'hired')->setDecorators($this->getDefaultElementDecorators())->addMultiOptions($optHired)->setAttrib('class', 'm-wrap span12')->setLabel('Iha serbisu?');
     $elements[] = $this->createElement('text', 'date_registration_ini')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Rejistu Inisiu');
     $elements[] = $this->createElement('text', 'date_registration_fim')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Data Rejistu Final');
     $this->addElements($elements);
 }
示例#2
0
 /**
  * 
  */
 public function init()
 {
     $elements = array();
     $elements[] = $this->createElement('hidden', 'fk_id_jobtraining')->setDecorators(array('ViewHelper'))->setAttrib('class', 'no-clear');
     $elements[] = $this->createElement('hidden', 'clients')->setIsArray(true)->setDecorators(array('ViewHelper'));
     $elements[] = $this->createElement('hidden', 'source')->setValue('D')->setDecorators(array('ViewHelper'));
     $dbDec = App_Model_DbTable_Factory::get('Dec');
     $rows = $dbDec->fetchAll(array(), array('name_dec'));
     $optCeop[''] = '';
     foreach ($rows as $row) {
         $optCeop[$row->id_dec] = $row->name_dec;
     }
     $elements[] = $this->createElement('select', 'fk_id_dec')->setDecorators($this->getDefaultElementDecorators())->setLabel('CEOP')->addMultiOptions($optCeop)->setRequired(true)->setAttrib('class', 'm-wrap span12');
     // List Districts just from Timor
     $mapperDistrict = new Register_Model_Mapper_AddDistrict();
     $districts = $mapperDistrict->listAll(1);
     $optDistrict[''] = '';
     foreach ($districts as $district) {
         $optDistrict[$district->acronym] = $district->acronym;
     }
     $elements[] = $this->createElement('select', 'num_district')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->setRequired(true)->addMultiOptions($optDistrict)->setRegisterInArrayValidator(false);
     // List Sub Districts
     $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict();
     $subDistricts = $mapperSubDistrict->listAll();
     $optSubDistrict[''] = '';
     foreach ($subDistricts as $subDistrict) {
         $optSubDistrict[$subDistrict->acronym] = $subDistrict->acronym;
     }
     $elements[] = $this->createElement('select', 'num_subdistrict')->setDecorators(array('ViewHelper'))->setAttrib('class', 'm-wrap span3')->addMultiOptions($optSubDistrict)->setRequired(true)->setRegisterInArrayValidator(false);
     $elements[] = $this->createElement('text', 'num_servicecode')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('readOnly', true)->setValue('BU')->setAttrib('class', 'm-wrap span2');
     $elements[] = $this->createElement('text', 'num_year')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 2)->setAttrib('class', 'm-wrap span2 text-numeric4');
     $elements[] = $this->createElement('text', 'num_sequence')->setDecorators(array('ViewHelper'))->setAttrib('maxlength', 4)->setAttrib('class', 'm-wrap span2');
     $elements[] = $this->createElement('text', 'first_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setRequired(true)->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Primeru');
     $elements[] = $this->createElement('text', 'last_name')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 80)->setAttrib('class', 'm-wrap span12')->setLabel('Naran Ultimu');
     $this->addElements($elements);
 }
 /**
  * 
  */
 public function searchSubDistrictAction()
 {
     $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict();
     $rows = $mapperSubDistrict->listAll($this->_getParam('id'));
     $opts = array(array('id' => '', 'name' => ''));
     foreach ($rows as $row) {
         $opts[] = array('id' => $row->id_addsubdistrict, 'name' => $row->sub_district);
     }
     $this->_helper->json($opts);
 }
 /**
  * 
  */
 public function listAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->view->rows = $this->_mapper->listAll();
 }
示例#5
0
 /**
  * 
  */
 public function businessPlanAction()
 {
     $id = $this->_getParam('id');
     if (empty($id)) {
         $this->_helper->redirector->goToSimple('index', 'index', 'external');
     }
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->layout()->disableLayout();
     }
     $formBusinessPlan = new External_Form_BusinessPlan();
     $formBusinessPlan->setAction($this->_helper->url('save-business-plan'));
     $businessPlan = $this->_mapper->fetchBusinessPlan($id);
     // Prepare Subdistrict SELECT Option
     $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict();
     $rowsSubdistrict = $mapperSubDistrict->listAll($businessPlan->fk_id_adddistrict);
     $rows = array('' => '');
     foreach ($rowsSubdistrict as $subDistrict) {
         $rows[$subDistrict->id_addsubdistrict] = $subDistrict->sub_district;
     }
     $formBusinessPlan->getElement('fk_id_addsubdistrict')->addMultiOptions($rows);
     // Prepare Business Plan Owner Select
     $rowOwner = array($businessPlan->fk_id_perdata => Client_Model_Mapper_Client::buildNameById($businessPlan->fk_id_perdata));
     $clientsBusinessPlan = $this->_mapper->listClientBusinessPlan($id);
     foreach ($clientsBusinessPlan as $client) {
         $rowOwner[$client->id_perdata] = Client_Model_Mapper_Client::buildName($client);
     }
     $formBusinessPlan->getElement('bussines_plan_developer')->addMultiOptions($rowOwner);
     $data = $businessPlan->toArray();
     $formBusinessPlan->populate($data);
     $this->view->formBusiness = $formBusinessPlan;
     $this->view->businessPlan = $businessPlan;
     $mapperBudgetCategory = new Fefop_Model_Mapper_Expense();
     $expenses = $mapperBudgetCategory->expensesInModule($businessPlan->fk_id_fefop_modules);
     $initial_expense = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_INITIAL);
     $annual_expense = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
     $revenue_expense = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     $this->view->expenses = $this->_mapper->aggregateExpenses($expenses, $businessPlan, $mapperBudgetCategory->getModuleToItem($businessPlan->fk_id_fefop_modules));
     $this->view->initial_expense = $this->_mapper->aggregateExpenses($initial_expense, $businessPlan, Fefop_Model_Mapper_Expense::CONFIG_PCE_INITIAL);
     $this->view->annual_expense = $this->_mapper->aggregateExpenses($annual_expense, $businessPlan, Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
     $this->view->revenue_expense = $this->_mapper->aggregateExpenses($revenue_expense, $businessPlan, Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     // Populate form
     $this->_populateFormBusinessPlan($formBusinessPlan, $businessPlan);
     if (!empty($data['submitted']) || !empty($businessPlan->business_group)) {
         foreach ($formBusinessPlan->getElements() as $element) {
             $element->setAttrib('disabled', true);
         }
         $this->view->no_edit = true;
     }
     $can_create = $this->_mapper->canCreateBusinessPlan($data['fk_id_perdata'], $data['fk_id_fefop_modules']);
     if (!$can_create) {
         foreach ($formBusinessPlan->getElements() as $element) {
             $element->setAttrib('disabled', true);
         }
     }
     $this->view->can_create = $can_create;
 }