コード例 #1
0
ファイル: StudentClass.php プロジェクト: fredcido/simuweb
 /**
  *
  * @return boolean 
  */
 public function sendClassIndmo()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $classes = $this->getDataClassIndmo();
         if (empty($classes)) {
             return true;
         }
         $dataIndmo = array('classes' => serialize($classes));
         $response = App_Util_Indmo::request('api/class', $dataIndmo);
         $dbStudentClassSent = App_Model_DbTable_Factory::get('StudentClass_Sent');
         $trainingProvider = array();
         foreach ($classes as $class) {
             if (!empty($response['classnotfound']) && in_array($class['id'], $response['classnotfound'])) {
                 $trainingProvider[] = $class['id_training_provider'];
                 continue;
             }
             $where = array('fk_id_fefpstudentclass = ?' => $class['id'], 'sent = ?' => 0);
             $row = $dbStudentClassSent->fetchRow($where);
             $row->date_sent = Zend_Date::now()->toString('yyyy-MM-dd HH:mm');
             $row->sent = empty($response['status']) ? 0 : 1;
             if (!empty($response['msg'])) {
                 $row->log = $response;
             }
             $row->save();
         }
         if (!empty($trainingProvider)) {
             // Search the user who must receive notes when training provider was not found at INDMO
             $noteTypeMapper = new Admin_Model_Mapper_NoteType();
             $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::TP_NOT_FOUND);
             $noteModelMapper = new Default_Model_Mapper_NoteModel();
             $noteMapper = new Default_Model_Mapper_Note();
             $dataNote = array('title' => 'SENTRU FORMASAUN LA REJISTRADU', 'level' => 0, 'message' => $noteModelMapper->getTrainingProviderNotFound($trainingProvider), 'users' => $users);
             $noteMapper->setData($dataNote)->saveNote();
         }
         $dbAdapter->commit();
         return true;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         echo 'Error sending classes: ' . $e->getMessage();
         return false;
     }
 }
コード例 #2
0
ファイル: RIContract.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @param int $idRiContract
  */
 protected function _sendWarningDuration($idRiContract)
 {
     // Search the user who must receive notes when the duration is ultrapassed
     $noteTypeMapper = new Admin_Model_Mapper_NoteType();
     $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::RI_DURATION_GREATER);
     $noteModelMapper = new Default_Model_Mapper_NoteModel();
     $noteMapper = new Default_Model_Mapper_Note();
     $dataNote = array('title' => 'RI KONTRATU HO DURASAUN KLEUR', 'level' => 0, 'message' => $noteModelMapper->getRIGreaterDuration($this->detail($idRiContract)), 'users' => $users);
     $noteMapper->setData($dataNote)->saveNote();
 }
コード例 #3
0
ファイル: DRHTrainingPlan.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @param int $idTraining
  */
 protected function _sendWarningAmount($idTraining)
 {
     // Search the user who must receive notes when the amount is ultrapassed
     $noteTypeMapper = new Admin_Model_Mapper_NoteType();
     $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::DRH_GREATER);
     $noteModelMapper = new Default_Model_Mapper_NoteModel();
     $noteMapper = new Default_Model_Mapper_Note();
     $dataNote = array('title' => 'DRH TRAINING PLAN FOLIN HIRA LIU $' . self::LIMIT_AMOUNT, 'level' => 0, 'message' => $noteModelMapper->getDrhTrainingPlan($this->detail($idTraining)), 'users' => $users);
     $noteMapper->setData($dataNote)->saveNote();
 }
コード例 #4
0
ファイル: Notification.php プロジェクト: fredcido/simuweb
 /**
  * 
  */
 public function notifyFollowupJob()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $rows = $this->_listJobHiredFollowup();
         // Search the user who must receive notes to follow up cases
         $noteTypeMapper = new Admin_Model_Mapper_NoteType();
         $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::JOB_FOLLOW_UP);
         $noteModelMapper = new Default_Model_Mapper_NoteModel();
         $noteMapper = new Default_Model_Mapper_Note();
         foreach ($rows as $row) {
             $usersWarning = $users;
             $usersWarning[] = $row->fk_id_sysuser;
             $dataNote = array('title' => 'HALO AKOMPAÑAMENTU HO KLIENTE MAK HETAN SERBISU', 'level' => 0, 'message' => $noteModelMapper->getFollowUpCase($row->fk_id_perdata), 'users' => $usersWarning);
             $noteMapper->setData($dataNote)->saveNote();
         }
         $dbAdapter->commit();
         return true;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         echo "Error sending cases follow-ups notifications: " . $e->getMessage() . "\n";
         return false;
     }
 }
コード例 #5
0
ファイル: JobMatch.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $dbShortlist = App_Model_DbTable_Factory::get('ShortlistVacancy');
         $clients = $dbShortlist->fetchAll(array('fk_id_jobvacancy = ?' => $this->_data['id_jobvacancy']));
         $clientsShortlist = array();
         foreach ($clients as $client) {
             $clientsShortlist[] = $client->fk_id_perdata;
         }
         // Get just the new clients to the shortlist
         $clients = array_diff($this->_data['clients'], $clientsShortlist);
         $dbPersonHistory = App_Model_DbTable_Factory::get('Person_History');
         $dbJobCandidates = App_Model_DbTable_Factory::get('JOBVacancy_Candidates');
         $dbActionPlanReferences = App_Model_DbTable_Factory::get('Action_Plan_References');
         // Search the user who must receive notes when an user is refered to shortlist
         $noteTypeMapper = new Admin_Model_Mapper_NoteType();
         $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::JOB_REFERED_SHORTLIST);
         $noteModelMapper = new Default_Model_Mapper_NoteModel();
         $noteMapper = new Default_Model_Mapper_Note();
         // Insert all the new clients in the shortlist
         foreach ($clients as $client) {
             // Add the client to the shortlist
             $row = $dbShortlist->createRow();
             $row->fk_id_jobvacancy = $this->_data['id_jobvacancy'];
             $row->fk_id_perdata = $client;
             $row->save();
             // Save history to client
             $rowHistory = $dbPersonHistory->createRow();
             $rowHistory->fk_id_perdata = $client;
             $rowHistory->fk_id_jobvacancy = $this->_data['id_jobvacancy'];
             $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 SHORTLIST VAGA EMPREGU NUMERO:%s ', $this->_data['id_jobvacancy']);
             $rowHistory->description = 'KLIENTE SELECIONADO BA SHORTLISTA VAGA EMPREGU';
             $rowHistory->save();
             // Set the list as shortlisted already to avoid to be shortlisted again
             $update = array('shortlisted' => 1);
             $whereUpdate = array('fk_id_perdata = ?' => $client, 'fk_id_jobvacancy = ?' => $this->_data['id_jobvacancy']);
             $dbJobCandidates->update($update, $whereUpdate);
             // Save the auditing
             $history = sprintf('SHORTED LIST KLIENTE: %s - BA VAGA EMPREGU NUMERU: %s ', $client, $this->_data['id_jobvacancy']);
             $this->_sysAudit($history);
             // Search if the vacancy was referencied by some barrier
             $whereReference = array('fk_id_jobvacancy = ?' => $this->_data['id_jobvacancy'], 'fk_id_perdata = ?' => $client);
             $reference = $dbActionPlanReferences->fetchRow($whereReference);
             if (!empty($reference)) {
                 $usersNotify = $users;
                 $usersNotify[] = $reference->fk_id_sysuser;
                 $dataNoteModel = array('client' => $client, 'vacancy' => $this->_data['id_jobvacancy'], 'case' => $reference->fk_id_action_plan, 'user' => $reference->fk_id_sysuser);
                 $dataNote = array('title' => 'KLIENTE REFERE BA SHORTLIST', 'level' => 1, 'message' => $noteModelMapper->geJobShortlist($dataNoteModel), 'users' => $usersNotify);
                 $noteMapper->setData($dataNote)->saveNote();
             }
         }
         $dbAdapter->commit();
         return $this->_data['id_jobvacancy'];
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }
コード例 #6
0
ファイル: FEContract.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @param array $data
  */
 protected function _checkBeneficiaryGraduation($data)
 {
     $mapperClient = new Client_Model_Mapper_Client();
     $types = array(Register_Model_Mapper_PerTypeScholarity::FORMAL, Register_Model_Mapper_PerTypeScholarity::NON_FORMAL);
     $valid = false;
     foreach ($types as $type) {
         // Check all the client level of scholarity to check if it has National certificate level 2 or greater or is graduated
         $scholarities = $mapperClient->listScholarity($data['fk_id_perdata'], $type);
         foreach ($scholarities as $scholarity) {
             if ($scholarity->category == 'N' && $scholarity->level_scholarity >= 2 || $type == Register_Model_Mapper_PerTypeScholarity::FORMAL && $scholarity->fk_id_perlevelscholarity >= 17) {
                 $valid = true;
                 break 2;
             }
         }
     }
     if (!$valid) {
         // Search the user who must receive notes when the client doens't have the necessary qualification
         $noteTypeMapper = new Admin_Model_Mapper_NoteType();
         $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::FE_GRADUATION);
         $noteModelMapper = new Default_Model_Mapper_NoteModel();
         $noteMapper = new Default_Model_Mapper_Note();
         $dataNote = array('title' => 'FE KONTRATU - BENEFISIARIU LA IHA FORMASAUN', 'level' => 0, 'message' => $noteModelMapper->getFEGraduation($this->detail($data['id_fe_contract'])), 'users' => $users);
         $noteMapper->setData($dataNote)->saveNote();
     }
 }
コード例 #7
0
ファイル: CampaignSms.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @param array $campaigns
  */
 protected function _sendNotificationCampaigns($campaigns)
 {
     $dbCampaign = App_Model_DbTable_Factory::get('Campaign');
     // Retrieve the campaigns
     $mapperCampaigns = new Sms_Model_Mapper_Campaign();
     $selectCampaings = $mapperCampaigns->getSelectCampaign();
     $selectCampaings->where('c.id_campaign IN(?)', $campaigns);
     $rows = $dbCampaign->fetchAll($selectCampaings);
     $noteMapper = new Default_Model_Mapper_Note();
     $noteModelMapper = new Default_Model_Mapper_NoteModel();
     // Search the user who must receive notes when there is sms
     $noteTypeMapper = new Admin_Model_Mapper_NoteType();
     $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::SMS_RECEIVED);
     foreach ($rows as $row) {
         $responsibles = $users;
         $responsibles[] = $row['responsible'];
         // save the warning to the user responsible of the department
         $dataNote = array('title' => 'SMS KAMPANHA FOIN TAMA', 'level' => 1, 'message' => $noteModelMapper->getCampaignSmsReceived($row), 'users' => $responsibles);
         $noteMapper->setData($dataNote)->saveNote();
     }
 }
コード例 #8
0
ファイル: JobTraining.php プロジェクト: fredcido/simuweb
 /**
  * 
  * @return int|bool
  */
 public function saveTrainee()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $dbJobTrainingTrainee = App_Model_DbTable_Factory::get('JOBTraining_Trainee');
         $dbJobTrainingCandidates = App_Model_DbTable_Factory::get('JOBTraining_Candidates');
         $clientTrainee = $dbJobTrainingTrainee->fetchAll(array('fk_id_jobtraining = ?' => $this->_data['id_jobtraining']));
         $clientsCandidates = array();
         foreach ($clientTrainee as $client) {
             $clientsCandidates[] = $client->fk_id_perdata;
         }
         // Get just the new clients to the trainee
         $clients = array_diff($this->_data['clients'], $clientsCandidates);
         $dbPersonHistory = App_Model_DbTable_Factory::get('Person_History');
         $jobTraining = $this->fetchRow($this->_data['id_jobtraining']);
         // Check if the total of participants exceeds the total defined in the information step
         if ($clientTrainee->count() + count($clients) > $jobTraining['total_participants']) {
             $message = sprintf('Erro: Total partisipante la bele liu: %s. Iha %s tiha ona, bele aumenta: %s', $jobTraining['total_participants'], $clientTrainee->count(), $jobTraining['total_participants'] - $clientTrainee->count());
             $this->_message->addMessage($message, App_Message::ERROR);
             return false;
         }
         // Search the user who must receive notes when an user is refered to shortlist
         $noteTypeMapper = new Admin_Model_Mapper_NoteType();
         $users = $noteTypeMapper->getUsersByNoteType(Admin_Model_Mapper_NoteType::CLASS_SHORTLIST);
         $noteMapper = new Default_Model_Mapper_Note();
         $noteModelMapper = new Default_Model_Mapper_NoteModel();
         // Insert all the new clients in the trainee program
         foreach ($clients as $client) {
             // Add the client to the trainee program
             $row = $dbJobTrainingTrainee->createRow();
             $row->fk_id_jobtraining = $this->_data['id_jobtraining'];
             $row->fk_id_perdata = $client;
             $row->fk_id_sysuser = Zend_Auth::getInstance()->getIdentity()->id_sysuser;
             $row->date_start = $jobTraining->date_start;
             $row->date_finish = $jobTraining->date_finish;
             $row->duration = $jobTraining->duration;
             $row->status = 0;
             $row->completed = 0;
             $row->save();
             // Save history to client
             $rowHistory = $dbPersonHistory->createRow();
             $rowHistory->fk_id_perdata = $client;
             $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 JOB TRAINING NUMERU:%s ', $this->_data['id_jobtraining']);
             $rowHistory->description = 'KLIENTE HALO REJISTU KLIENTE SELECIONADO BA JOB TRAINING';
             $rowHistory->save();
             // Set the candidate already selected to avoid to be selected again
             $update = array('selected' => 1);
             $whereUpdate = array('fk_id_perdata  = ?' => $client, 'fk_id_jobtraining = ?' => $this->_data['id_jobtraining']);
             $dbJobTrainingCandidates->update($update, $whereUpdate);
             // Save the auditing
             $history = sprintf('KLIENTE %s SELECIONADO BA JOB TRAINING NUMERU: %s ', $client, $this->_data['id_jobtraining']);
             $this->_sysAudit($history);
             $whereCandidates = array('fk_id_perdata = ?' => $client, 'fk_id_jobtraining = ?' => $this->_data['id_jobtraining']);
             $referer = $dbJobTrainingCandidates->fetchRow($whereCandidates);
             if (empty($referer->fk_id_sysuser)) {
                 continue;
             }
             $usersNotify = $users;
             $usersNotify[] = $referer->fk_id_sysuser;
             $dataNote = array('title' => 'KLIENTE SELECIONADO BA JOB TRAINING', 'level' => 1, 'message' => $noteModelMapper->getJobTrainingCandidate($client, $this->_data['id_jobtraining']), 'users' => $usersNotify);
             $noteMapper->setData($dataNote)->saveNote();
         }
         $dbAdapter->commit();
         return $this->_data['id_jobtraining'];
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }