Esempio n. 1
0
 private function load_unmarked_enhancedcalc()
 {
     $this->unmarked_enhancedcalc = false;
     if (!isset($this->questions)) {
         $this->load_questions();
     }
     $enhancedcalc_ids = array();
     $paperID = $this->get_property_id();
     $excluded = new Exclusion($paperID, $this->db);
     $excluded->load();
     if (is_array($this->questions) and count($this->questions) > 0) {
         // Calculation questions may be hidden in random blocks of keyword baed questions so we have to check all possibilities.
         foreach ($this->questions as $question) {
             // Skip excluded questions.
             if (!$excluded->is_question_excluded($question['q_id'])) {
                 switch ($question['type']) {
                     case 'random':
                         foreach (QuestionUtils::get_random_calc_question($question['q_id'], $this->db) as $possible) {
                             $enhancedcalc_ids[] = $possible;
                         }
                         break;
                     case 'keyword_based':
                         foreach (QuestionUtils::get_keyword_calc_question($question['q_id'], $this->db) as $possible) {
                             $enhancedcalc_ids[] = $possible;
                         }
                         break;
                     case 'enhancedcalc':
                         $enhancedcalc_ids[] = $question['q_id'];
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     // Find unmarked questions.
     if (count($enhancedcalc_ids) > 0) {
         $result = $this->db->prepare("SELECT log2.id FROM log2, log_metadata WHERE log2.metadataID = log_metadata.id " . "AND q_id IN (" . implode(',', $enhancedcalc_ids) . ") AND paperID = ? AND mark IS NULL LIMIT 1");
         $result->bind_param('i', $paperID);
         $result->execute();
         $result->store_result();
         $result->bind_result($id);
         if ($result->num_rows > 0) {
             $this->unmarked_enhancedcalc = true;
         }
         $result->close();
     }
 }
Esempio n. 2
0
     $log_array[$rowID]['surname'] = demo_replace($surname, $demo);
     $log_array[$rowID]['first_names'] = demo_replace($first_names, $demo);
     $log_array[$rowID]['name'] = str_replace("'", "", $surname) . ',' . $first_names;
     $log_array[$rowID]['gender'] = $gender;
     $log_array[$rowID]['$questionID'] = json_decode($settings, true);
     $user_no++;
     $old_username = $username;
     $old_started = $started;
 }
 $result->close();
 $sortby = 'name';
 $ordering = 'asc';
 $log_array = array_csort($log_array, $sortby, $ordering);
 //********************************
 $exclusions = new Exclusion($paperID, $mysqli);
 $exclusions->load();
 // Get any questions to exclude.
 $row_written = 0;
 foreach ($user_results as $individual) {
     $tmp_user_ID = $individual['username'];
     // Write out the headings.
     if ($row_written == 0) {
         // Only output personal data if assessment, do not show if survey.
         if ($paper_type < 3) {
             $csv .= '"' . $string['gender'] . '","' . $string['title'] . '","' . $string['surname'] . '","' . $string['firstnames'] . '","' . $string['studentid'] . '","' . $string['course'] . '","' . $string['year'] . '","' . $string['submitted'] . '"';
         } else {
             $csv .= '"' . $string['gender'] . '","' . $string['course'] . '","' . $string['year'] . '","' . $string['submitted'] . '"';
         }
         $q_no = 1;
         foreach ($paper_buffer as $q_id => $question) {
             $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id);
    $new_exclusions = new Exclusion($paperID, $mysqli);
    for ($i = 1; $i <= $_POST['question_no']; $i++) {
        $current_id = $_POST['id_' . $i];
        if ($current_id != $old_q_id) {
            if (strpos($old_status, '1') !== false) {
                $new_exclusions->add_exclusion($old_q_id, $old_status);
            }
            $old_status = '';
        }
        $old_status .= $_POST['status_' . $i];
        $old_q_id = $_POST['id_' . $i];
    }
    if (strpos($old_status, '1') !== false) {
        $new_exclusions->add_exclusion($old_q_id, $old_status);
    }
    $new_exclusions->load();
    if ($old_exclusions->excluded !== $new_exclusions->excluded) {
        $propertyObj->set_recache_marks(1);
        $propertyObj->save();
    }
    header("location: ../paper/details.php?paperID=" . $paperID . "&module=" . $_GET['module'] . "&folder=" . $_GET['folder']);
    exit;
}
function excludeButton(&$buttonID, $question_id, $status, $parts, $marks)
{
    $buttonID++;
    if (strpos($status, '1') !== false) {
        $html = "<input type=\"hidden\" name=\"status_" . $buttonID . "\" id=\"status_" . $buttonID . "\" value=\"";
        for ($i = 0; $i < $marks; $i++) {
            $html .= '1';
        }