Пример #1
0
        $staff_modules_sql .= ") OR users.id=" . $userObject->get_user_ID() . ") ";
    } else {
        // Reset to just look for current owners paper if not on any teams.
        $staff_modules_sql .= "AND users.id=" . $userObject->get_user_ID() . " ";
    }
}
if ($module_sql != '') {
    $module_sql = 'AND (' . $module_sql . ')';
}
if ($keyword != '%' and $keyword != '') {
    $keyword = ' AND keywordID=' . $keyword;
} else {
    $keyword = '';
}
$display_no = 0;
$retired_in = '-1,' . implode(',', QuestionStatus::get_retired_status_ids($status_array));
$questions = array();
if (isset($_GET['sortby'])) {
    $sortby = $_GET['sortby'];
} else {
    if (isset($state['sortby'])) {
        $sortby = $state['sortby'];
    } else {
        $sortby = 'leadin';
    }
}
if (isset($_GET['ordering'])) {
    $ordering = $_GET['ordering'];
} else {
    if (isset($state['ordering'])) {
        $ordering = $state['ordering'];
Пример #2
0
 private function load_performance_stats()
 {
     $this->stats = array('veryeasy' => 0, 'easy' => 0, 'moderate' => 0, 'hard' => 0, 'veryhard' => 0, 'highest' => 0, 'high' => 0, 'intermediate' => 0, 'low' => 0);
     $status_array = QuestionStatus::get_all_statuses($this->db, $this->string, true);
     $retired_in = '-1,' . implode(',', QuestionStatus::get_retired_status_ids($status_array));
     $sql = 'SELECT DISTINCT p, d, questions.q_id FROM questions, questions_modules, performance_main, performance_details WHERE questions.q_id = questions_modules.q_id AND questions.q_id = performance_main.q_id AND performance_main.id = performance_details.perform_id AND idMod = ? AND deleted IS NULL AND status NOT IN (' . $retired_in . ')';
     $result = $this->db->prepare($sql);
     $result->bind_param('i', $this->idMod);
     $result->execute();
     $result->bind_result($p, $d, $q_id);
     while ($result->fetch()) {
         if ($p >= 80 and $p <= 100) {
             $this->stats['veryeasy']++;
         } elseif ($p >= 60 and $p < 80) {
             $this->stats['easy']++;
         } elseif ($p >= 40 and $p < 60) {
             $this->stats['moderate']++;
         } elseif ($p >= 20 and $p < 40) {
             $this->stats['hard']++;
         } elseif ($p >= 0 and $p < 20) {
             $this->stats['veryhard']++;
         }
         if ($d >= 35 and $d <= 100) {
             $this->stats['highest']++;
         } elseif ($d >= 25 and $d < 35) {
             $this->stats['high']++;
         } elseif ($d >= 15 and $d < 25) {
             $this->stats['intermediate']++;
         } elseif ($d >= 0 and $d < 15) {
             $this->stats['low']++;
         }
     }
     $result->close();
 }