$q_id_list = array();
$found = false;
$target_id = $q_id;
do {
    $data = question_info::check_copies($target_id, $mysqli);
    if (count($data) > 0 and isset($data[0]['paperID'])) {
        $q_id_list[] = $data[0]['question_id'];
        $target_id = $data[0]['question_id'];
        $found = true;
    } else {
        $found = false;
    }
} while ($found);
$q_id_list[] = $q_id;
unset($data);
$data = question_info::check_copied($q_id, $mysqli);
$rows = count($data);
for ($i = 0; $i < $rows; $i++) {
    if (isset($data[$i]['paperID'])) {
        $q_id_list[] = $data[$i]['question_id'];
    }
}
$display_data = array();
$row = -1;
foreach ($q_id_list as $lookup_q_id) {
    $performance_array = question_info::question_performance($lookup_q_id, $mysqli);
    if (count($performance_array) > 0) {
        $row++;
        foreach ($performance_array as $paper => $performance) {
            $display_data[$row]['q_id'] = $lookup_q_id;
            if (!array_key_exists('icon', $performance)) {
Example #2
0
 /**
  * Get the question information
  * @param integer $q_id
  * @param object $db
  * @return formated HTML for display of question information
  */
 static function full_question_information($q_id, $db, $userObj, $string, $notice)
 {
     global $configObject, $string;
     echo '<table cellpadding="5" cellspacing="0" border="0" width="100%">';
     echo '<tr><td colspan="2" valign="middle" style="background-color:white; text-align:left; border-bottom:1px solid #CCD9EA">';
     echo '<img src="../artwork/lrg_info_icon.png" width="37" height="37" alt="Information" style="float:left" /><span style="color:#295AAD; font-size:18pt; font-weight:bold">&nbsp;&nbsp;' . $string['questioninformation'] . '</span></td></tr>';
     $question_data = $db->prepare("SELECT email, title, surname, initials, DATE_FORMAT(creation_date,\"%d/%m/%Y %H:%i\") AS creation_date, DATE_FORMAT(last_edited,\"%d/%m/%Y %H:%i\") AS last_edited, DATE_FORMAT(locked,\"{$configObject->get('cfg_long_date_time')}\") AS locked,  q_type, std, status FROM (users, questions) WHERE users.id=questions.ownerID AND q_id = ? LIMIT 1");
     $question_data->bind_param('i', $q_id);
     $question_data->execute();
     $question_data->bind_result($email, $title, $surname, $initials, $creation_date, $last_edited, $locked, $q_type, $std, $status);
     $question_data->store_result();
     $question_data->fetch();
     $question_data->close();
     if (!isset($creation_date)) {
         $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
         $notice->display_notice_and_exit($db, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', false, true);
     }
     $modules = QuestionUtils::get_modules($q_id, $db);
     $q_group = '';
     if (count($modules) == 0) {
         $q_group = '<span style="color:#808080">' . $string['na'] . '</span>';
     } else {
         foreach ($modules as $code => $module) {
             if ($q_group == '') {
                 $q_group = $module;
             } else {
                 $q_group .= ', ' . $module;
             }
         }
     }
     if ($locked == '') {
         $locked = '<span style="color:#808080">' . $string['na'] . '</span>';
     }
     if ($userObj->has_role('Demo')) {
         $owner = 'Dr J, Bloggs (<a href="">joe.bloggs@uni.ac.uk</a>)';
     } else {
         $owner = "{$title} {$initials} {$surname} (<a href=\"mailto:{$email}\">{$email}</a>)";
     }
     echo "<tr><td style=\"width:70px\">" . $string['author'] . "</td><td>{$owner}</td></tr>\n";
     echo "<tr><td>" . $string['created'] . "</td><td>{$creation_date}</td></tr>\n";
     echo "<tr><td>" . $string['modified'] . "</td><td>{$last_edited}</td></tr>\n";
     echo "<tr><td>" . $string['locked'] . "</td><td>{$locked}</td></tr>\n";
     echo "<tr><td>" . $string['teams'] . "</td><td>{$q_group}</td></tr>\n";
     echo "<tr><td>" . $string['copies'] . "</td><td></td></tr>\n";
     echo "</table>\n";
     echo "<div style=\"margin:5px; display:block; height:95px; overflow-y:scroll; border:1px solid #295AAD; font-size:100%; background-color:white\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" style=\"width:100%\">";
     echo "<tr><th>" . $string['type'] . "</th><th>" . $string['papername'] . "</th><th>" . $string['questionno'] . "</th></tr>\n";
     $data = question_info::check_copies($q_id, $db);
     $rows = count($data);
     for ($i = 0; $i < $rows; $i++) {
         if (isset($data[$i]['paperID'])) {
             echo "<tr><td>" . $string['copyof'] . "</td><td><a href=\"\" onclick=\"loadPaper('" . $data[$i]['paperID'] . "')\">" . $data[$i]['paper_title'] . "</a></td><td>" . $data[$i]['question_no'] . "</td></tr>\n";
         } else {
             echo "<tr><td>" . $string['copyof'] . "</td><td colspan=\"2\">Question ID #" . $data[$i]['question_id'] . "</td></tr>\n";
         }
     }
     unset($data);
     $data = question_info::check_copied($q_id, $db);
     $rows = count($data);
     for ($i = 0; $i < $rows; $i++) {
         if (isset($data[$i]['paperID'])) {
             echo "<tr><td>" . $string['sourcefor'] . "</td><td><a href=\"\" onclick=\"loadPaper('" . $data[$i]['paperID'] . "')\">" . $data[$i]['paper_title'] . "</a></td><td>" . $data[$i]['question_no'] . "</td></tr>\n";
         } else {
             echo "<tr><td>" . $string['sourcefor'] . "</td><td colspan=\"2\">Question ID #" . $data[$i]['question_id'] . "</td></tr>\n";
         }
     }
     echo "</table>\n</div>\n";
     echo "<table style=\"width:100%\">\n";
     echo "<tr><td colspan=\"2\">&nbsp;</td></tr>\n";
     echo "<tr><td>" . $string['followingpapers'] . "</td><td style=\"text-align:right\"><input type=\"button\" name=\"longitudinal\" value=\"" . $string['Longitudinal'] . "\" onclick=\"openLongitudinal({$q_id});\" /></td></tr>\n";
     echo "</table>\n";
     echo "<div style=\"margin:5px; display:block; height:195px; overflow-y:scroll; border:1px solid #295AAD; font-size:100%; background-color:white\">\n<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" style=\"width:100%\">";
     echo "<tr><th></th><th>" . $string['papername'] . "</th><th>" . $string['screenno'] . "</th><th>" . $string['examdate'] . "</th><th>" . $string['cohort'] . "</th><th></th><th>" . $string['p'] . "</th><th>" . $string['d'] . "</th></tr>\n";
     $performance_array = question_info::question_performance($q_id, $db);
     foreach ($performance_array as $paper => $performance) {
         if (!array_key_exists('icon', $performance)) {
             $performance['icon'] = 'red_flag.png';
         }
         echo "<tr><td><img src=\"../artwork/" . $performance['icon'] . "\" width=\"16\" height=\"16\" border=\"0\" alt=\"0\" /></td>";
         if (!array_key_exists('title', $performance)) {
             $performance['title'] = '?';
         }
         echo "<td><a href=\"\" onclick=\"loadPaper('{$paper}')\">" . $performance['title'] . "</a></td>";
         if (!array_key_exists('screen', $performance)) {
             $performance['screen'] = '?';
         }
         echo "<td class=\"num\">" . $performance['screen'] . "</td>";
         if (isset($performance['performance'][1]['taken'])) {
             echo "<td>" . $performance['performance'][1]['taken'] . "</td><td class=\"num\">" . $performance['performance'][1]['cohort'] . "</td><td style=\"text-align:right\">" . question_info::display_parts($performance['performance'], $q_type) . "</td><td class=\"num\">" . question_info::display_p($performance['performance'], $q_type) . "</td><td class=\"num\">" . question_info::display_d($performance['performance'], $q_type) . "</td>";
         } else {
             echo "<td></td><td></td><td></td><td></td><td></td>";
         }
         echo "</tr>\n";
     }
     echo '</table></div>';
 }