Exemplo n.º 1
0
 /**
  * Invalidate the cache for the given paper
  * @param  integer $paper_id ID of paper for which the cache should be invalidated
  */
 protected function invalidate_paper_cache($paper_id)
 {
     $properties = new PaperProperties($this->_mysqli);
     $properties->set_property_id($paper_id);
     $properties->load();
     $properties->set_recache_marks(1);
     $properties->save();
 }
Exemplo n.º 2
0
// You should have received a copy of the GNU General Public License
// along with Rogo.  If not, see <http://www.gnu.org/licenses/>.
/**
* 
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require '../include/staff_auth.inc';
require_once '../include/errors.inc';
require_once '../include/paper_security.inc';
require_once '../classes/paperproperties.class.php';
$paperID = check_var('paperID', 'GET', true, false, true);
// Get some paper properties
$propertyObj = PaperProperties::get_paper_properties_by_id($paperID, $mysqli, $string);
$paper_title = $propertyObj->get_paper_title();
$start_date = $propertyObj->get_start_date();
$end_date = $propertyObj->get_end_date();
$calendar_year = $propertyObj->get_calendar_year();
$paper_bgcolor = $propertyObj->get_bgcolor();
$paper_fgcolor = $propertyObj->get_fgcolor();
$paper_themecolor = $propertyObj->get_themecolor();
$paper_labelcolor = $propertyObj->get_labelcolor();
$type = $propertyObj->get_rubric();
$paper_prologue = $propertyObj->get_paper_prologue();
$marking = $propertyObj->get_marking();
$display_photos = $propertyObj->get_display_correct_answer();
$labs = $propertyObj->get_labs();
$crypt_name = $propertyObj->get_crypt_name();
$review_type = $propertyObj->get_display_question_mark();
Exemplo n.º 3
0
 static function get_paper_properties_by_lab($lab_object, $db)
 {
     $sql = "SELECT\n    \t\t\tproperties.property_id,\n    \t\t\tpaper_title,\n    \t\t\tUNIX_TIMESTAMP(start_date) AS start_date,\n          UNIX_TIMESTAMP(end_date) AS end_date,\n    \t\t\texam_duration,\n    \t\t\tcalendar_year,\n    \t\t\tpassword,\n    \t\t\ttimezone,\n          rubric\n    \t\tFROM\n    \t\t\tproperties\n    \t\tWHERE\n    \t\t\tpaper_type = '2' AND\n    \t\t\tlabs REGEXP ? AND\n    \t\t\tstart_date < DATE_ADD( NOW(), interval 30 minute ) AND\n    \t\t\tend_date > NOW() AND\n    \t\t\tdeleted IS NULL";
     $paper_results = $db->prepare($sql);
     // TODO get_lab_based_on_client only fetches the first lab that populates $lab_object
     // If an ip address is on many labs we only use with the first we come across
     $lab_regexp = "(^|,)(" . $lab_object->get_id() . ")(,|\$)";
     $paper_results->bind_param('s', $lab_regexp);
     $paper_results->execute();
     $paper_results->store_result();
     $paper_results->bind_result($property_id, $paper_title, $start_date, $end_date, $exam_duration, $calendar_year, $password, $timezone, $rubric);
     if ($paper_results->num_rows <= 0) {
         $paper_results->close();
         return false;
     }
     $properties = array();
     while ($paper_results->fetch()) {
         $property_object = new PaperProperties($db);
         $property_object->set_property_id($property_id);
         $property_object->set_paper_title($paper_title);
         $property_object->set_start_date($start_date);
         $property_object->set_end_date($end_date);
         $property_object->set_exam_duration($exam_duration);
         $property_object->set_calendar_year($calendar_year);
         $property_object->set_calendar_year($calendar_year);
         $property_object->set_password($password);
         $property_object->set_timezone($timezone);
         $property_object->set_display_start_date();
         $property_object->set_display_start_time();
         $property_object->set_display_end_date();
         $property_object->set_display_end_time();
         $property_object->set_rubric($rubric);
         $properties[] = $property_object;
     }
     $paper_results->close();
     return $properties;
 }
Exemplo n.º 4
0
        if ($_GET['userID'] != '') {
            $userID = $_GET['userID'];
        } else {
            display_error($string['idmissing'], $string['idmissing_msg'], false, true, false);
        }
    } else {
        // Student is trying to hack into another students userID on the URL.
        header("HTTP/1.0 404 Not Found");
        $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
        $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
    }
} else {
    $userID = $userObject->get_user_ID();
}
// Get some paper properties
$propertyObj = PaperProperties::get_paper_properties_by_crypt_name($_GET['id'], $mysqli, $string, true);
// Check the feedback has been released !!!
if ($userObject->has_role('Student')) {
    if (!$propertyObj->is_objective_fb_released()) {
        $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
        $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
    }
}
if (!isset($_GET['ordering'])) {
    $ordering = 'screen';
    $direction = 'asc';
}
$paperID = $propertyObj->get_property_id();
$paper_title = $propertyObj->get_paper_title();
$paper_type = $propertyObj->get_paper_type();
$session = $propertyObj->get_calendar_year();
Exemplo n.º 5
0
/**
*
* This screen presents a list of students assigned to a particular cohort.
* You click on the student name of interest and the OSCE station marking
* form comes up.
*
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require '../include/staff_auth.inc';
require_once '../include/errors.inc';
require_once '../classes/paperproperties.class.php';
$id = check_var('id', 'GET', true, false, true);
$properties = PaperProperties::get_paper_properties_by_crypt_name($id, $mysqli, $string, true);
$paperID = $properties->get_property_id();
$paper_title = $properties->get_paper_title();
$calendar_year = $properties->get_calendar_year();
$modules = $properties->get_modules();
function quick_links()
{
    $html = '';
    $html .= "<table style=\"width:100%; text-align:center\">\n<tr>\n";
    for ($i = 1; $i <= 26; $i++) {
        $html .= "<td class=\"qlink\"><a href=\"#" . chr($i + 64) . "\" class=\"qlink\">" . chr($i + 64) . "</a></td>";
    }
    $html .= "</tr>\n</table>\n";
    return $html;
}
?>
Exemplo n.º 6
0
// You should have received a copy of the GNU General Public License
// along with Rogō.  If not, see <http://www.gnu.org/licenses/>.
/**
* 
* Confirm that it is OK to proceed deleting a paper.
*
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require '../include/staff_auth.inc';
require_once '../include/errors.inc';
require_once '../classes/paperproperties.class.php';
$paperID = check_var('paperID', 'GET', true, false, true);
$properties = PaperProperties::get_paper_properties_by_id($paperID, $mysqli, $string, true);
if ($properties->get_summative_lock() == 1) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['paperlocked'], $msg, $string['paperlocked'], '../artwork/padlock_48.png', '#C00000', true, true);
}
$mysqli->close();
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html;charset=<?php 
echo $configObject->get('cfg_page_charset');
?>
" />
  
Exemplo n.º 7
0
function get_timestamp_from_time($hours, $minutes, $timezone)
{
    $tmp_datetime = new DateTime(date('Y-m-d') . $hours . ':' . $minutes . ':00', $timezone);
    return $tmp_datetime->getTimestamp();
}
if (isset($_POST['start_exam_form'])) {
    check_var('paper_id', 'POST', true, false, false);
}
$current_address = NetworkUtils::get_client_address();
$lab = new LabFactory($mysqli);
$lab_object = $lab->get_lab_based_on_client($current_address);
$properties_list = array();
if ($lab_object !== false) {
    $lab_id = $lab_object->get_id();
    $room_name = $lab_object->get_name();
    $properties_list = PaperProperties::get_paper_properties_by_lab($lab_object, $mysqli);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="content-type" content="text/html;charset=<?php 
echo $configObject->get('cfg_page_charset');
?>
"/>

<title>Rog&#333;: <?php 
echo $string['invigilatoraccess'];
?>
</title>
Exemplo n.º 8
0
    $statuses[$sid] = $status->get_name();
}
$ob = new OB();
if ($dest == 'qti21') {
    $dest = 'qti20';
}
if (isset($_GET['debug'])) {
    $show_debug = true;
} else {
    $show_debug = false;
}
// load in some paper information to display
if ($ids != '') {
    $type = 'paper';
    // get paper properties
    $properties = PaperProperties::get_paper_properties_by_id($_GET['paperID'], $mysqli, $string);
    $paper_title = $properties->get_paper_title();
} else {
    $ids = GetVar("q_id");
    $type = 'question';
    $paper_title = 'Questions';
}
// set up classes
$load_params = new stdClass();
$load_params->source = 'rogo';
$load_params->type = $type;
$load_params->ids = explode(",", $ids);
$paperID = $load_params->ids[0];
$import = new IE_Local_Load();
$import->setStatuses($statuses);
if ($dest == "qti12") {
Exemplo n.º 9
0
    while ($result->fetch()) {
        if (($paper_type == '2' or $paper_type == '4') and $end_date != '' and date("Y-m-d H:i:s") > $end_date) {
            //echo "<tr><td style=\"width:20px\"><img src=\"../artwork/small_padlock.png\" width=\"18\" height=\"18\" alt=\"" . $string['warning'] . "\" /></td><td><input type=\"radio\" name=\"property_id\" value=\"$paper_title\" disabled><span style=\"color:#808080\">$paper_title</span></td></tr>\n";
        } elseif ($start_date < date("Y-m-d H:i:s") and $end_date > date("Y-m-d H:i:s")) {
            echo "<tr><td style=\"width:20px\"><img src=\"../artwork/small_yellow_warning_icon.gif\" width=\"12\" height=\"11\" alt=\"" . $string['warning'] . "\" /></td><td><input type=\"radio\" name=\"property_id\" value=\"{$paper_title}\" disabled><span style=\"color:#808080\">{$paper_title}</span></td></tr>\n";
        } else {
            echo "<tr><td style=\"width:20px\">&nbsp;</td><td><input type=\"radio\" name=\"property_id\" value=\"{$property_id}\" id=\"{$property_id}\"><label for=\"{$property_id}\">{$paper_title}</label></td></tr>\n";
        }
    }
    $result->close();
    echo "</table>\n</div>";
    echo '<input type="hidden" id="outcomes" name="outcomes" value="" />';
    echo "<div style=\"text-align:center; padding-top:4px;\"><img src=\"../artwork/working.gif\" id=\"working\" width=\"16\" height=\"16\" alt=\"Working\" style=\"display: none\" /> <input type=\"submit\" class=\"ok\" name=\"submit\" value=\"" . $string['addtopaper'] . "\" /><input type=\"button\" class=\"cancel\" name=\"cancel\" id=\"cancel\" value=\"" . $string['cancel'] . "\" /></div>\n</form>\n";
} else {
    $property_id = $_POST['property_id'];
    $properties = PaperProperties::get_paper_properties_by_id($property_id, $mysqli, $string);
    ?>
<!DOCTYPE html>
<html>
<head>
  <title><?php 
    echo $string['linktopaper'];
    ?>
</title>
  <link rel="stylesheet" type="text/css" href="../css/body.css" />
  <link rel="stylesheet" type="text/css" href="../css/dialog.css" />
  <link rel="stylesheet" type="text/css" href="../css/header.css" />
  <style>
    body {font-size:90%; background-color:EEECDC; text-align:center}
  </style>
  <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
Exemplo n.º 10
0
*
* Remove the link between a question an a paper.
*
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require '../include/staff_auth.inc';
require '../include/errors.inc';
require_once '../classes/logger.class.php';
require_once '../classes/paperproperties.class.php';
check_var('questionID', 'POST', true, false, false);
check_var('pID', 'POST', true, false, false);
$tmp_paperID = check_var('paperID', 'POST', true, false, true);
$properties = PaperProperties::get_paper_properties_by_id($tmp_paperID, $mysqli, $string);
// Check that the paper is not summative and not locked.
if ($properties->get_summative_lock()) {
    exit;
}
$tmp_pIDs = explode(',', substr($_POST['pID'], 1));
$tmp_questionIDs = explode(',', substr($_POST['questionID'], 1));
for ($i = 0; $i < count($tmp_pIDs); $i++) {
    if ($result = $mysqli->prepare("DELETE FROM papers WHERE p_id = ?")) {
        $result->bind_param('i', $tmp_pIDs[$i]);
        $result->execute();
        $result->close();
        // Look up any std set IDs for the paper.
        $std_setIDs = array();
        $result = $mysqli->prepare("SELECT id FROM std_set WHERE paperID = ?");
        $result->bind_param('i', $tmp_paperID);
Exemplo n.º 11
0
 /**
  * IMPORT: Loads a ZIP file, parses and adds contents to the database.
  */
 public function import($paperID = 0)
 {
     if ($paperID != 0) {
         $this->properties = PaperProperties::get_paper_properties_by_id($paperID, $this->db, $this->string);
     }
     $this->logger = new Logger($this->db);
     $this->status_array = QuestionStatus::get_all_statuses_by_name($this->db, $this->string);
     $this->get_keyword_ids();
     $this->zip_filename = $this->userID . '_raf.zip';
     $tmp_path = $this->configObj->get('cfg_tmpdir');
     if (!move_uploaded_file($_FILES['raffile']['tmp_name'], $tmp_path . $this->zip_filename)) {
         echo uploadError($_FILES['raffile']['error']);
         exit;
     }
     $dest_dir = $tmp_path . $this->userID;
     if (!file_exists($dest_dir)) {
         mkdir($dest_dir, 0700);
     }
     $zip = new ZipArchive();
     if ($zip->open($tmp_path . $this->zip_filename) === TRUE) {
         $zip->extractTo($dest_dir);
         if (file_exists($dest_dir . '/raf.json')) {
             $this->data = file_get_contents($dest_dir . '/raf.json');
         } else {
             $zip->close();
             $msg = sprintf($this->string['furtherassistance'], $this->configObj->get('support_email'), $this->configObj->get('support_email'));
             $this->notice->display_notice_and_exit($this->db, $this->string['invalidraf'], $msg, $this->string['invalidraf'], '../artwork/exclamation_48.png', '#C00000', true, true);
         }
         $this->copy_images($dest_dir, $tmp_path);
         $this->load_raf_data();
         unlink($dest_dir . '/raf.json');
         $zip->close();
     } else {
         $msg = sprintf($this->string['furtherassistance'], $this->configObj->get('support_email'), $this->configObj->get('support_email'));
         $this->notice->display_notice_and_exit($this->db, $this->string['invalidzip'], $msg, $this->string['invalidzip'], '../artwork/exclamation_48.png', '#C00000', true, true);
     }
 }