Example #1
0
 /**
  * 
  */
 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;
     }
 }
Example #2
0
 /**
  *
  * @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);
 }
Example #3
0
    /**
     *
     * @param int $id
     * @return Zend_Db_Table_Rowset
     */
    public function listJobTrainingBarriers($id)
    {
        $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining();
        $selectJobTraining = $mapperJobTraining->getSelectJobTraining();
        $dbActionPlanReferences = App_Model_DbTable_Factory::get('Action_Plan_References');
        $dbJobTrainingTrainee = App_Model_DbTable_Factory::get('JOBTraining_Trainee');
        $selectJobTraining->join(array('apr' => $dbActionPlanReferences), 'apr.fk_id_jobtraining = jt.id_jobtraining', array())->joinLeft(array('jtt' => $dbJobTrainingTrainee), 'jtt.fk_id_jobtraining = jt.id_jobtraining
			    AND jtt.fk_id_perdata = apr.fk_id_perdata', array('trainee' => 'id_trainee'))->where('apr.fk_id_action_barrier = ?', $id);
        return $dbActionPlanReferences->fetchAll($selectJobTraining);
    }