Example #1
0
 /**
  * Возвращает тесты и id соискателей
  *
  * @return array Массив в которого ключи - id соискателей, а значение - массив с тестами.
  */
 public function getTestsA()
 {
     $select = $this->getAdapter()->select()->from(array('a' => Applicants::NAME), array('applicantId' => 'id'))->join(array('v' => Vacancies::NAME), 'a.vacancy_id = v.id', array())->join(array('vt' => $this->_name), 'vt.vacancy_id = v.id', array())->join(array('t' => Tests::NAME), 'vt.test_id = t.t_id', array('testId' => 't_id', 'testName' => 't_name'));
     $tests = $this->getAdapter()->query($select)->fetchAll();
     $objAT = new ApplicantTests();
     $arrTest = array();
     foreach ($tests as $test) {
         $link = $objAT->getLink($test['applicantId'], $test['testId']);
         $percentMax = $objAT->getMaxPercent($test['applicantId'], $test['testId']);
         $scoreMax = $objAT->getMaxScore($test['applicantId'], $test['testId']);
         $linkMaxPercent = $objAT->getLinkForPercent($test['applicantId'], $test['testId'], $percentMax);
         $linkMaxScore = $objAT->getLinkForScore($test['applicantId'], $test['testId'], $scoreMax);
         $arrTest[$test['applicantId']][] = array('id' => $test['testId'], 'name' => $test['testName'], 'link' => $link, 'linkMaxScore' => $linkMaxScore, 'linkMaxPercent' => $linkMaxPercent, 'percentMax' => $percentMax, 'scoreMax' => $scoreMax);
     }
     return $arrTest;
 }