示例#1
0
 function LoadQuestionBase($store, $q_row, $o_rows)
 {
     // store id that we loaded as so can be referenced later
     $store->load_id = $q_row['q_id'];
     // load in things common to all questions
     $store->leadin = $q_row['leadin'];
     $store->theme = $q_row['theme'];
     $store->notes = $q_row['notes'];
     $store->q_group = isset($q_row['q_group']) ? $q_row['q_group'] : '';
     $store->bloom = $q_row['bloom'];
     $store->score_method = $q_row['score_method'];
     if ($q_row['ownerID'] > 0) {
         $store->author = GetAuthorName($q_row['ownerID']);
     }
     // Get keywords for question
     $db = new Database();
     $db->SetTable('keywords_user', 'ku');
     $db->AddField('keyword');
     $db->AddInnerJoin('keywords_question', 'kq', 'id', 'keywordID');
     $db->AddWhere('kq.q_id', $q_row['q_id'], 'i');
     $o_rows = $db->GetMultiRow();
     $keywords = array();
     if (count($o_rows) > 0) {
         $keywords[] = $o_rows[0]['keyword'];
         for ($i = 1; $i < count($o_rows); $i++) {
             $keywords[] = $o_rows[$i]['keyword'];
         }
     }
     $store->keywords = $keywords;
     // standard media, gets cleared for extmatch
     $this->AddMedia($store, $q_row['q_media'], $q_row['q_media_width'], $q_row['q_media_height']);
     $store->status = $this->statuses[$q_row['status']];
 }
示例#2
0
文件: import.php 项目: vinod-co/centa
    exit;
} else {
    $summative_lock = 0;
}
if (!array_key_exists('file', $_FILES)) {
    include "tmpl/import_file.php";
    exit;
}
if (isset($_GET['debug'])) {
    $show_debug = true;
} else {
    $show_debug = false;
}
// Create dir for QTI to save into
$base_dir = $cfg_web_root . 'qti/imports/';
$dir = GetAuthorName($userObject->get_user_ID()) . "/" . date("Y-m-d") . "/" . date("H.i.s");
//todo replace with userobject function
if (!file_exists($base_dir . $dir)) {
    mkdir($base_dir . $dir, 0755, true);
}
$save_params = new stdClass();
$save_params->dir = $dir;
$save_params->base_dir = $base_dir;
global $load_params;
$load_params = new stdClass();
$load_params->dir = $dir;
$load_params->base_dir = $base_dir;
// upload file
$ext = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION);
$file = $base_dir . $dir . "/import." . $ext;
move_uploaded_file($_FILES["file"]["tmp_name"], $file);