getId(); $query = "SELECT * FROM " . DB_PREFIX . $this->table; $query .= $this->getWhereQuery(); $query .= " ORDER BY {$order} DESC"; $query .= " LIMIT {$limit} OFFSET {$offset}"; $res = query_rows($query); return $res; } function getWhereQuery() { global $TeKe; $query = ""; $query .= " WHERE"; $query .= " deleted=false"; if (!$TeKe->plugin->is_test_constructor()) { $user_id = get_logged_in_user()->getId(); $query .= " AND proctor=".$user_id; } return $query; } function getPageCount($limit=20) { $query = "SELECT * FROM ". DB_PREFIX . $this->table; $query .= $this->getWhereQuery(); $total_count = mysql_num_rows(query($query)); $last_page = ceil($total_count/$limit); return $last_page; } function getCandidateByToken($token) { global $TeKe; $query = "SELECT * FROM ". DB_PREFIX . "candidates WHERE token='".$token."'"; $res = query_row($query); if ($res) { $candidate_id = $res->id; return $candidate_id; } return false; } function getAssessmentByUserToken($token) { global $TeKe; $query = "SELECT * FROM ". DB_PREFIX . "candidates WHERE token='".$token."'"; $res = query_row($query); if ($res) { $assessment_id = $res->assessment; $assessment = $TeKe->plugin->loadType("assessment", $assessment_id); return $assessment; } return false; } function getAssessmentsStatistics($ids) { global $TeKe; $statistics = array(); $statistics []= $this->getAssessmentsStatisticsFileHeading(); foreach ($ids as $id) { $assessment = $TeKe->plugin->loadType("assessment", $id); $candidates = $assessment->getCandidates(); foreach ($candidates as $candidate) { $result = $assessment->getCandidateInfoForCSV($candidate->id); if ($result) { $statistics []= $result; } } } return $statistics; } function getAssessmentsStatisticsFileHeading() { $heading_row = array(); $heading_row []= _("Name"); $heading_row []= _("Email"); $heading_row []= _("Assessment"); $heading_row []= _("Status"); $heading_row []= _("Beginning"); $heading_row []= _("Ending"); $heading_row []= _("Score"); $heading_row []= _("Percent"); return $heading_row; } } ?>