public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $elements[] = $this->createElement('text', 'title')->setDecorators($this->getDefaultElementDecorators())->addFilter('StringTrim')->addFilter('StringToUpper')->setAttrib('maxlength', 200)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Titulu'); $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'); $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $rows = $mapperJobTraining->listEnterprises(); $optEnterprise[''] = ''; foreach ($rows as $row) { $optEnterprise[$row->fk_id_fefpenterprise] = $row->entity; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setLabel('Empreza')->addMultiOptions($optEnterprise)->setAttrib('class', 'm-wrap span12 chosen'); $rows = $mapperJobTraining->listInstitutes(); $optInstitute[''] = ''; foreach ($rows as $row) { $optInstitute[$row->fk_id_fefpeduinstitution] = $row->entity; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setLabel('Inst. Ensinu')->addMultiOptions($optInstitute)->setAttrib('class', 'm-wrap span12 chosen'); $optTransport['1'] = 'Loke'; $optTransport['0'] = 'Taka'; $elements[] = $this->createElement('select', 'status')->setDecorators($this->getDefaultElementDecorators())->setLabel('Status')->setAttrib('class', 'span12')->addMultiOptions($optTransport)->setValue(1)->setRequired(true); $elements[] = $this->createElement('text', 'date_start')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Inisiu'); $elements[] = $this->createElement('text', 'date_finish')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Planu Remata'); $filters = array('type' => Register_Model_Mapper_PerTypeScholarity::NON_FORMAL); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $optScholarity = $mapperScholarity->getOptionsScholarity($filters); $elements[] = $this->createElement('select', 'fk_id_perscholarity')->setDecorators($this->getDefaultElementDecorators())->setRegisterInArrayValidator(false)->addMultiOptions($optScholarity)->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Kursu'); $this->addElements($elements); }
/** * * @param type $idJobTraining * @return \App_View_Helper_JobTrainingActive */ public function setJobTraining($idJobTraining) { $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $this->_jobTraining = $mapperJobTraining->fetchRow($idJobTraining); return $this; }
/** * * @param int $client * @param int $idJobTraining * @return string */ public function getJobTrainingExpired($job) { $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $jobTraining = $mapperJobTraining->detailJobTraining($job); $view = Zend_Layout::getMvcInstance()->getView(); $link = '<a href="%s" target="_blank">%s</a>'; $jobTrainingName = str_pad($jobTraining->id_jobtraining, 5, '0', STR_PAD_LEFT) . ' - ' . $jobTraining->title; $aJobTraining = sprintf($link, $view->baseUrl('/student-class/job-training/edit/id/' . $jobTraining->id_jobtraining), $jobTraining->name_dec . ' - ' . $jobTrainingName); return sprintf(self::JOB_TRAINING_EXPIRED, $aJobTraining); }
/** * */ public function jobTrainingClientAction() { $this->_helper->layout()->disableLayout(); $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $jobTraining = $mapperJobTraining->detailJobTraining($this->_getParam('job-training')); $this->view->jobTraining = $jobTraining; }
/** * */ public function searchJobTrainingTraineeAction() { $this->_helper->layout()->disableLayout(); $this->view->rows = $this->_mapper->listTraineeByFilters($this->_getAllParams()); $this->view->listAjax = $this->_getParam('list-ajax'); }
/** * * @param int $barrier * @return Zend_Db_Table_Rowset */ public function listJobTrainingIntervention($intervention, $case) { $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $selectJobTraining = $mapperJobTraining->getSelectJobTraining(); $dbActionPlanBarrier = App_Model_DbTable_Factory::get('Action_Plan_Barrier'); $dbActionPlanReferences = App_Model_DbTable_Factory::get('Action_Plan_References'); $dbActionpPlanHasGroup = App_Model_DbTable_Factory::get('Action_Plan_has_Group'); $selectJobTraining->join(array('apr' => $dbActionPlanReferences), 'apr.fk_id_jobtraining = jt.id_jobtraining', array())->join(array('apb' => $dbActionPlanBarrier), 'apb.id_action_barrier = apr.fk_id_action_barrier', array())->join(array('apg' => $dbActionpPlanHasGroup), 'apg.fk_id_action_plan = apb.fk_id_action_plan', array())->where('apg.fk_id_action_plan_group = ?', $case)->where('apb.fk_id_barrier_intervention = ?', $intervention)->group(array('id_jobtraining')); return $dbActionPlanReferences->fetchAll($selectJobTraining); }
/** * */ public function fetchTraineeAction() { $id = $this->_getParam('id'); $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $trainee = $mapperJobTraining->fetchTrainee($id); $data = array(); $mapperClient = new Client_Model_Mapper_Client(); $client = $mapperClient->detailClient($trainee->fk_id_perdata); $contract = $this->_mapper->getContractByTrainee($id); if (!empty($contract)) { $data['valid'] = false; } else { $data['valid'] = true; $data['fk_id_trainee'] = $trainee->id_trainee; $data['fk_id_fefpenterprise'] = $trainee->fk_id_fefpenterprise; $data['fk_id_fefpeduinstitution'] = $trainee->fk_id_fefpeduinstitution; $data['entity'] = $trainee->entity; $data['fk_id_scholarity_area'] = $trainee->fk_id_scholarity_area; $data['beneficiary'] = Client_Model_Mapper_Client::buildName($client); $data['fk_id_perdata'] = $trainee->fk_id_perdata; $data['date_start'] = $trainee->date_start_formated; $data['date_finish'] = $trainee->date_finish_formated; $data['duration_month'] = $trainee->duration; } $this->_helper->json($data); }
/** * */ public function notifyJobTrainingExpired() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { // Search all the expired job vacancy $jobTrainingMapper = new StudentClass_Model_Mapper_JobTraining(); $selectJob = $jobTrainingMapper->getSelectJobTraining(); $selectJob->where('jt.status = ?', 1)->where('jt.date_finish < ?', Zend_Date::now()->toString('yyyy-MM-dd')); $dbJobTraining = App_Model_DbTable_Factory::get('JOBTraining'); $rows = $dbJobTraining->fetchAll($selectJob); // Search the user who must receive notes when job training are expired $noteTypeMapper = new Admin_Model_Mapper_NoteType(); $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::JOB_TRAINING_EXPIRED); $noteModelMapper = new Default_Model_Mapper_NoteModel(); $noteMapper = new Default_Model_Mapper_Note(); foreach ($rows as $row) { $dataNote = array('title' => 'VAGA ESTAJIU LORON TAKA LIU TIHA ONA', 'level' => 0, 'message' => $noteModelMapper->getJobTrainingExpired($row->id_jobtraining), 'users' => $users); $noteMapper->setData($dataNote)->saveNote(); } $dbAdapter->commit(); return true; } catch (Exception $e) { $dbAdapter->rollBack(); echo "Error sending job training expired notifications: " . $e->getMessage() . "\n"; return false; } }
/** * * @return int|bool */ public function clientJobTraining() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $dbJobTrainingCandidates = App_Model_DbTable_Factory::get('JOBTraining_Candidates'); $dbPersonHistory = App_Model_DbTable_Factory::get('Person_History'); $dbActionPlanReferences = App_Model_DbTable_Factory::get('Action_Plan_References'); // Fetch the case $case = $this->fetchRow($this->_data['id']); // Fetch the job training $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining(); $jobTraining = $mapperJobTraining->fetchRow($this->_data['idJobTraining']); if ($jobTraining->status != 1) { $this->_message->addMessage('Job Training ida ne\'e taka tiha ona, la bele tau kliente iha lista kandidatu.', App_Message::ERROR); return false; } $where = array('fk_id_jobtraining = ?' => $this->_data['idJobTraining'], 'fk_id_perdata = ?' => $case->fk_id_perdata); $hasCandidateList = $dbJobTrainingCandidates->fetchRow($where); // If the candidate is already in candidate list if (!empty($hasCandidateList)) { $this->_message->addMessage('Kliente iha Lista Kandidatu tiha ona ba job training ida ne\'e.', App_Message::ERROR); return false; } // Add the client to the list candidates $row = $dbJobTrainingCandidates->createRow(); $row->fk_id_jobtraining = $this->_data['idJobTraining']; $row->fk_id_perdata = $case->fk_id_perdata; $row->fk_id_sysuser = Zend_Auth::getInstance()->getIdentity()->id_sysuser; $row->selected = 0; $row->save(); // Save history to client $rowHistory = $dbPersonHistory->createRow(); $rowHistory->fk_id_perdata = $case->fk_id_perdata; $rowHistory->fk_id_sysuser = Zend_Auth::getInstance()->getIdentity()->id_sysuser; $rowHistory->fk_id_dec = Zend_Auth::getInstance()->getIdentity()->fk_id_dec; $rowHistory->date_time = Zend_Date::now()->toString('yyyy-MM-dd HH:mm'); $rowHistory->action = sprintf('KLIENTE SELECIONADO BA LISTA KANDIDATU JOB TRAINING NUMERO: %s ', $this->_data['idJobTraining']); $rowHistory->description = 'KLIENTE SELECIONADO BA LISTA KANDIDATU JOB TRAINING NUMERO'; $rowHistory->save(); // Save the auditing $history = sprintf('KLIENTE BA LISTA KANDIDATU: %s - BA JOB TRAINING NUMERU: %s ', $case->fk_id_perdata, $this->_data['idJobTraining']); $this->_sysAudit($history); // Insert the reference to the action barrier $rowReference = $dbActionPlanReferences->createRow(); $rowReference->fk_id_perdata = $case->fk_id_perdata; $rowReference->fk_id_action_plan = $this->_data['id']; $rowReference->fk_id_action_barrier = $this->_data['barrier']; $rowReference->fk_id_sysuser = Zend_Auth::getInstance()->getIdentity()->id_sysuser; $rowReference->fk_id_jobtraining = $this->_data['idJobTraining']; $rowReference->save(); $dbAdapter->commit(); return $this->_data['id']; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }