/**
  * Returns array of peron ids who took a course by a name
  */
 public static function getParticipantsByCourseName($training_title)
 {
     $tableObj = new PersonToTraining();
     $select = $tableObj->select()->from(array('c' => 'course'), array())->setIntegrityCheck(false)->join(array('t' => 'training'), "t.training_title_option_id = c.id")->join(array('ptt' => 'person_to_training'), "ptt.training_id = t.id", array('person_id'))->join(array('tto' => 'training_title_option'), "tto.id = c.training_title_option_id", array('person_id'))->where("tto.training_title_phrase = ?", "{$training_title}");
     $ids = array();
     $rows = $tableObj->fetchAll($select);
     foreach ($rows as $r) {
         $ids[] = $r->person_id;
     }
     return $ids;
 }
Esempio n. 2
0
 public static function isReferenced($id)
 {
     require_once 'PersonToTraining.php';
     $participant = new PersonToTraining();
     $select = $participant->select();
     $select->where("person_id = ?", $id);
     if ($participant->fetchRow($select)) {
         return true;
     }
     require_once 'TrainingToTrainer.php';
     $trainer = new TrainingToTrainer();
     $select = $trainer->select();
     $select->where("trainer_id = ?", $id);
     if ($trainer->fetchRow($select)) {
         return true;
     }
     return false;
 }