/* AContent                                                             */
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsDAO = new TestsQuestionsDAO();
$qid = intval($_GET['qid']);
if ($qid == 0) {
    $qid = intval($_POST['qid']);
}
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    if ($_POST['tid']) {
        header('Location: questions.php?tid=' . $_POST['tid'] . '&_course_id=' . $_course_id);
    } else {
        header('Location: question_db.php?_course_id=' . $_course_id);
    }
    exit;
} else {
    if (isset($_POST['submit'])) {
        $missing_fields = array();
예제 #2
0
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . '../tests/lib/likert_presets.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsDAO = new TestsQuestionsDAO();
$qid = intval($_GET['qid']);
if ($qid == 0) {
    $qid = intval($_POST['qid']);
}
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    if ($_POST['tid']) {
        header('Location: questions.php?tid=' . $_POST['tid'] . '&_course_id=' . $_course_id);
    } else {
        header('Location: question_db.php?_course_id=' . $_course_id);
    }
    exit;
} else {
    if (isset($_POST['submit'])) {
        $_POST['question'] = trim($_POST['question']);
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'lib/test_question_queries.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsDAO = new TestsQuestionsDAO();
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: question_db.php?_course_id=' . $_course_id);
    exit;
} else {
    if ($_POST['submit']) {
        $missing_fields = array();
        $_POST['feedback'] = trim($_POST['feedback']);
        $_POST['question'] = trim($_POST['question']);
        $_POST['category_id'] = intval($_POST['category_id']);
        if ($_POST['question'] == '') {
            $missing_fields[] = _AT('question');
        }
        if (trim($_POST['choice'][0]) == '') {
            $missing_fields[] = _AT('item') . ' 1';
예제 #4
0
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/testQuestions.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsDAO = new TestsQuestionsDAO();
$_letters = array(_AT('A'), _AT('B'), _AT('C'), _AT('D'), _AT('E'), _AT('F'), _AT('G'), _AT('H'), _AT('I'), _AT('J'));
if (isset($_GET['submit'])) {
    header('Location: ' . TR_BASE_HREF . 'tests/question_db.php?_course_id=' . $_course_id);
    exit;
}
if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {
    $content_base_href = 'get.php/';
} else {
    $content_base_href = 'content/' . $_SESSION['course_id'] . '/';
}
require_once TR_INCLUDE_PATH . 'header.inc.php';
$qids = explode(',', $_GET['qid']);
$rows = $testsQuestionsDAO->getByQuestionIDs($qids);
?>
예제 #5
0
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
$page = 'tests';
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
if (isset($_POST['submit_yes'])) {
    $_POST['catid'] = intval($_POST['catid']);
    $testsQuestionsDAO = new TestsQuestionsDAO();
    //remove category
    if ($testsQuestionsCategoriesDAO->Delete($_POST['catid']) && $testsQuestionsDAO->UpdateField($_POST['catid'], 'category_id', 0)) {
        //set all qestions that use this category to have category=0
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        header('Location: ' . TR_BASE_HREF . 'tests/question_cats.php?_course_id=' . $_course_id);
        exit;
    }
} else {
    if (isset($_POST['submit_no'])) {
        $msg->addFeedback('CANCELLED');
        header('Location: ' . TR_BASE_HREF . 'tests/question_cats.php?_course_id=' . $_course_id);
        exit;
    } else {
        if (!isset($_GET['catid'])) {
            require_once TR_INCLUDE_PATH . 'header.inc.php';
예제 #6
0
파일: dd.php 프로젝트: harriswong/AContent
} else {
    $content_base_href = 'content/' . $_course_id . '/';
}
// Verify that we may access this question
if (!isset($_SESSION['dd_question_ids']) || !is_array($_SESSION['dd_question_ids']) || !isset($_SESSION['dd_question_ids'][$_GET['qid']])) {
    // Just exit as we're in an IFRAME
    exit;
}
// Clean up tidily
unset($_SESSION['dd_question_ids'][$_GET['qid']]);
if (count($_SESSION['dd_question_ids']) == 0) {
    unset($_SESSION['dd_question_ids']);
}
session_write_close();
$_GET['qid'] = intval($_GET['qid']);
$testQuestionsDAO = new TestsQuestionsDAO();
$row = $testQuestionsDAO->get($_GET['qid']);
$_letters = array(_AT('A'), _AT('B'), _AT('C'), _AT('D'), _AT('E'), _AT('F'), _AT('G'), _AT('H'), _AT('I'), _AT('J'));
$_colours = array('#FF9900', '#00FF00', '#0000FF', '#F23AA3', '#9999CC', '#990026', '#0099CC', '#22C921', '#007D48', '#00248F');
$num_options = 0;
for ($i = 0; $i < 10; $i++) {
    if ($row['option_' . $i] != '') {
        $num_options++;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="<?php 
echo $_SESSION['lang'];
?>
">
예제 #7
0
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsAssocDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsDAO = new TestsQuestionsDAO();
$testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
$tid = intval($_REQUEST['tid']);
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: question_db.php?_course_id=' . $_course_id);
    exit;
} else {
    if (isset($_POST['submit_yes'])) {
        $_POST['qid'] = explode(',', $_POST['qid']);
        foreach ($_POST['qid'] as $id) {
            $id = intval($id);
            if ($testsQuestionsDAO->Delete($id)) {
                $testsQuestionsAssocDAO->DeleteByQuestionID($id);
            }
        }
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . '../tests/lib/likert_presets.inc.php';
require_once TR_INCLUDE_PATH . 'lib/test_question_queries.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsDAO = new TestsQuestionsDAO();
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: question_db.php?_course_id=' . $_course_id);
    exit;
} else {
    if (isset($_POST['submit'])) {
        $_POST['question'] = trim($_POST['question']);
        $_POST['category_id'] = intval($_POST['category_id']);
        $empty_fields = array();
        if ($_POST['question'] == '') {
            $empty_fields[] = _AT('question');
        }
        if ($_POST['choice'][0] == '') {
            $empty_fields[] = _AT('choice') . ' 1';
        }
예제 #9
0
/** 
 * Export test questions
 * @param	array	an array consist of all the ids of the questions in which we desired to export.
 */
function test_question_qti_export($question_ids)
{
    global $_course_id;
    require_once TR_INCLUDE_PATH . 'classes/DAO/CoursesDAO.class.php';
    require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
    require_once TR_INCLUDE_PATH . 'classes/zipfile.class.php';
    // for zipfile
    require_once TR_INCLUDE_PATH . 'lib/html_resource_parser.inc.php';
    // for get_html_resources()
    require_once TR_INCLUDE_PATH . 'classes/XML/XML_HTMLSax/XML_HTMLSax.php';
    // for XML_HTMLSax
    global $savant, $db, $languageManager;
    $coursesDAO = new CoursesDAO();
    $course_row = $coursesDAO->get($_course_id);
    $course_language = $course_row['primary_language'];
    $courseLanguage =& $languageManager->getLanguage($course_language);
    $course_language_charset = $courseLanguage->getCharacterSet();
    $zipfile = new zipfile();
    $zipfile->create_dir('resources/');
    // for all the dependency files
    $resources = array();
    $dependencies = array();
    asort($question_ids);
    $testsQuestionsDAO = new TestsQuestionsDAO();
    $rows = $testsQuestionsDAO->getByQuestionIDs($question_ids);
    if (is_array($rows)) {
        foreach ($rows as $row) {
            $obj = TestQuestions::getQuestion($row['type']);
            $local_xml = '';
            $local_xml = $obj->exportQTI($row, $course_language_charset, '1.2.1');
            $local_dependencies = array();
            $text_blob = implode(' ', $row);
            $local_dependencies = get_html_resources($text_blob);
            $dependencies = array_merge($dependencies, $local_dependencies);
            //		$resources[] = array('href'         => 'question_'.$row['question_id'].'.xml',
            //							 'dependencies' => array_keys($local_dependencies));
            $xml = $xml . "\n\n" . $local_xml;
        }
    }
    $xml = trim($xml);
    //TODO
    $savant->assign('xml_content', $xml);
    $savant->assign('title', $row['question']);
    $xml = $savant->fetch('tests/test_questions/wrapper.tmpl.php');
    $xml_filename = 'atutor_questions.xml';
    $zipfile->add_file($xml, $xml_filename);
    // add any dependency files:
    foreach ($dependencies as $resource => $resource_server_path) {
        $zipfile->add_file(@file_get_contents($resource_server_path), 'resources/' . $resource, filemtime($resource_server_path));
    }
    // construct the manifest xml
    //	$savant->assign('resources', $resources);
    $savant->assign('dependencies', array_keys($dependencies));
    $savant->assign('encoding', $course_language_charset);
    $savant->assign('xml_filename', $xml_filename);
    //	$manifest_xml = $savant->fetch('tests/test_questions/manifest_qti_2p1.tmpl.php');
    $manifest_xml = $savant->fetch('tests/test_questions/manifest_qti_1p2.tmpl.php');
    $zipfile->add_file($manifest_xml, 'imsmanifest.xml');
    $zipfile->close();
    $filename = str_replace(array(' ', ':'), '_', $course_row['title'] . '-' . _AT('question_database') . '-' . date('Ymd'));
    $zipfile->send_file($filename);
    exit;
}
예제 #10
0
if (!defined('TR_INCLUDE_PATH')) {
    exit;
}
global $_course_id;
if (isset($_GET['reset_filter'])) {
    unset($_GET['category_id']);
}
if (!isset($_GET['category_id'])) {
    // Suppress warnings
    $_GET['category_id'] = -1;
}
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
//require_once(TR_INCLUDE_PATH.'../tests/classes/TestsUtility.class.php');
$testsQuestionsDAO = new TestsQuestionsDAO();
$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
$cats = array();
if ($_GET['category_id'] >= 0) {
    $category_row = $testsQuestionsCategoriesDAO->get($_GET[category_id]);
} else {
    $category_rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);
}
//$result	= mysql_query($sql, $db);
if ($_GET['category_id'] <= 0) {
    $cats[] = array('title' => _AT('cats_uncategorized'), 'category_id' => 0);
}
if (is_array($category_rows)) {
    foreach ($category_rows as $row) {
        $cats[] = $row;
    }