コード例 #1
0
ファイル: create_test.php プロジェクト: harriswong/AContent
/* 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/TestsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$test_type = 'normal';
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: index.php?_course_id=' . $_course_id);
    exit;
} else {
    if (isset($_POST['submit'])) {
        $testsDAO = new TestsDAO();
        if ($testsDAO->Create($_course_id, $_POST['title'], $_POST['description'])) {
            $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
            header('Location: index.php?_course_id=' . $_course_id);
            exit;
        }
    }
}
$onload = 'document.form.title.focus();';
$savant->assign('course_id', $_course_id);
require_once TR_INCLUDE_PATH . 'header.inc.php';
$msg->printErrors();
$savant->display('tests/create_edit_test.tmpl.php');
require TR_INCLUDE_PATH . 'footer.inc.php';
コード例 #2
0
 /**
  * This function is to import a test and returns the test id.
  * @param	string	custmom test title
  *
  * @return	int		test id
  */
 function importTest($title = '')
 {
     global $_course_id;
     $title = $title == '' ? $this->title : $title;
     $testsDAO = new TestsDAO();
     $tid = $testsDAO->Create($_course_id, $title, $test_obj['description']);
     //			$sql_params = array (	$_SESSION['course_id'],
     //									$test_obj['title'],
     //									$test_obj['description'],
     //									$test_obj['format'],
     //									$start_date,
     //									$end_date,
     //									$test_obj['order'],
     //									$test_obj['num_questions'],
     //									$test_obj['instructions'],
     //									$test_obj['content_id'],
     //									$test_obj['passscore'],
     //									$test_obj['passpercent'],
     //									$test_obj['passfeedback'],
     //									$test_obj['failfeedback'],
     //									$test_obj['result_release'],
     //									$test_obj['random'],
     //									$test_obj['difficulty'],
     //									$test_obj['num_takes'],
     //									$test_obj['anonymous'],
     //									'',
     //									$test_obj['allow_guests'],
     //									$test_obj['display']);
     //
     //			$sql = vsprintf(AT_SQL_TEST, $sql_params);
     //			$result = mysql_query($sql, $db);
     //			$tid = mysql_insert_id($db);
     //debug($qti_import->weights, 'weights');
     return $tid;
 }