本文整理汇总了PHP中GetQuizName函数的典型用法代码示例。如果您正苦于以下问题:PHP GetQuizName函数的具体用法?PHP GetQuizName怎么用?PHP GetQuizName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetQuizName函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_name
/**
* Get name to display: same as exercise title
*/
public function get_name()
{
$documentPath = api_get_path(SYS_COURSE_PATH) . $this->course_code . "/document";
require_once api_get_path(SYS_CODE_PATH) . 'exercice/hotpotatoes.lib.php';
$data = $this->get_exercise_data();
if ($this->is_hp == 1) {
if (isset($data['path'])) {
$hotpotatoes_exist = true;
$item = '';
$title = GetQuizName($data['path'], $documentPath);
if ($title == '') {
$title = basename($data['path']);
}
return $title;
}
}
return $data['title'];
}
示例2: get_exam_results_data
//.........这里部分代码省略.........
}
$results[$i]['group_name'] = $group_name_list;
}
$results[$i]['exe_duration'] = !empty($results[$i]['exe_duration']) ? round($results[$i]['exe_duration'] / 60) : 0;
$user_list_id[] = $results[$i]['exe_user_id'];
$id = $results[$i]['exe_id'];
$dt = api_convert_and_format_date($results[$i]['exe_weighting']);
// we filter the results if we have the permission to
if (isset($results[$i]['results_disabled'])) {
$result_disabled = intval($results[$i]['results_disabled']);
} else {
$result_disabled = 0;
}
if ($result_disabled == 0) {
$my_res = $results[$i]['exe_result'];
$my_total = $results[$i]['exe_weighting'];
$results[$i]['start_date'] = api_get_local_time($results[$i]['start_date']);
$results[$i]['exe_date'] = api_get_local_time($results[$i]['exe_date']);
if (!$results[$i]['propagate_neg'] && $my_res < 0) {
$my_res = 0;
}
$score = self::show_score($my_res, $my_total);
$actions = '';
if ($is_allowedToEdit) {
if (isset($teacher_id_list)) {
if (in_array($results[$i]['exe_user_id'], $teacher_id_list)) {
$actions .= Display::return_icon('teachers.gif', get_lang('Teacher'));
}
}
if ($revised) {
$actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=edit&id={$id}'>" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL);
$actions .= ' ';
} else {
$actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=qualify&id={$id}'>" . Display::return_icon('quiz.gif', get_lang('Qualify'));
$actions .= ' ';
}
$actions .= "</a>";
if ($filter == 2) {
$actions .= ' <a href="exercise_history.php?' . api_get_cidreq() . '&exe_id=' . $id . '">' . Display::return_icon('history.gif', get_lang('ViewHistoryChange')) . '</a>';
}
//Admin can always delete the attempt
if (($locked == false || api_is_platform_admin()) && !api_is_student_boss()) {
$ip = TrackingUserLog::get_ip_from_user_event($results[$i]['exe_user_id'], date('Y-m-d h:i:s'), false);
$actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">';
$actions .= Display::return_icon('info.png', $ip, ['title' => $ip]);
$actions .= '</a>';
$delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
onclick="javascript:if(!confirm(\'' . sprintf(get_lang('DeleteAttempt'), $results[$i]['username'], $dt) . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
$delete_link = utf8_encode($delete_link);
if (api_is_drh() && !api_is_platform_admin()) {
$delete_link = null;
}
$actions .= $delete_link . ' ';
}
} else {
$attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
$attempt_link = Display::url(get_lang('Show'), $attempt_url, ['class' => 'ajax btn btn-default', 'data-title' => get_lang('Show')]);
$actions .= $attempt_link;
}
if ($revised) {
$revised = Display::label(get_lang('Validated'), 'success');
} else {
$revised = Display::label(get_lang('NotValidated'), 'info');
}
if ($is_allowedToEdit) {
$results[$i]['status'] = $revised;
$results[$i]['score'] = $score;
$results[$i]['lp'] = $lp_name;
$results[$i]['actions'] = $actions;
$list_info[] = $results[$i];
} else {
$results[$i]['status'] = $revised;
$results[$i]['score'] = $score;
$results[$i]['actions'] = $actions;
$list_info[] = $results[$i];
}
}
}
}
} else {
$hpresults = StatsUtils::getManyResultsXCol($hpsql, 6);
// Print HotPotatoes test results.
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$hp_title = GetQuizName($hpresults[$i][3], $documentPath);
if ($hp_title == '') {
$hp_title = basename($hpresults[$i][3]);
}
$hp_date = api_get_local_time($hpresults[$i][6], null, date_default_timezone_get());
$hp_result = round($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1) * 100, 2) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')';
if ($is_allowedToEdit) {
$list_info[] = array($hpresults[$i][0], $hpresults[$i][1], $hpresults[$i][2], '', $hp_title, '-', $hp_date, $hp_result, '-');
} else {
$list_info[] = array($hp_title, '-', $hp_date, $hp_result, '-');
}
}
}
}
return $list_info;
}
示例3: display_exercise_tracking_info
/**
* Displays the exercise results for a specific user in a specific course.
* @param string $view
* @param int $user_id User ID
* @param string $courseCode Course code
* @return array
* @todo remove globals
*/
public function display_exercise_tracking_info($view, $userId, $courseCode)
{
global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
$courseId = api_get_course_int_id($courseCode);
$userId = intval($userId);
if (substr($view, 1, 1) == '1') {
$new_view = substr_replace($view, '0', 1, 1);
$title[1] = get_lang('ExercicesDetails');
$line = '';
$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)\n FROM {$TABLECOURSE_EXERCICES} AS ce , {$TABLETRACK_EXERCICES} AS te\n WHERE te.c_id = {$courseId}\n AND te.exe_user_id = {$userId}\n AND te.exe_exo_id = ce.id\n ORDER BY ce.title ASC, te.exe_date ASC";
$hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)\n FROM {$TABLETRACK_HOTPOTATOES} AS te\n WHERE te.exe_user_id = '{$userId}' AND te.c_id = {$courseId}\n ORDER BY te.c_id ASC, te.exe_date ASC";
$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
$NoTestRes = 0;
$NoHPTestRes = 0;
$results = StatsUtils::getManyResultsXCol($sql, 4);
$title_line = get_lang('ExercicesTitleExerciceColumn') . ";" . get_lang('Date') . ';' . get_lang('ExercicesTitleScoreColumn') . "\n";
if (is_array($results)) {
for ($i = 0; $i < sizeof($results); $i++) {
$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
$line .= $results[$i][0] . ";" . $display_date . ";" . $results[$i][1] . " / " . $results[$i][2] . "\n";
}
} else {
// istvan begin
$NoTestRes = 1;
}
// The Result of Tests
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$title = GetQuizName($hpresults[$i][0], '');
if ($title == '') {
$title = basename($hpresults[$i][0]);
}
$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
$line .= $title . ';' . $display_date . ';' . $hpresults[$i][1] . '/' . $hpresults[$i][2] . "\n";
}
} else {
$NoHPTestRes = 1;
}
if ($NoTestRes == 1 && $NoHPTestRes == 1) {
$line = get_lang('NoResult');
}
} else {
$new_view = substr_replace($view, '1', 1, 1);
}
return array($title_line, $line);
}
示例4: get_addedresource_link_in_learnpath
/**
* This function is to create and return a link to the added resources (lessons).
* It returns the same thing as display_addedresource_link_in_learnpath() but doesn't display
* anything.
*
* Parameters:
* @param type - that is the correspondent type in the mirror tool (like this is a Link item)
* @param id - that is the correspondent id in the mirror tool (like Agenda item 2)
* @param id_in_path - the unique index in the items table
*/
function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
{
global $_course, $learnpath_id, $tbl_learnpath_item, $items;
global $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid;
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$course_id = api_get_course_int_id();
$hyperlink_target_parameter = '';
// or e.g. target='_blank'
$builder = 'player';
$origin = 'learnpath';
$linktype = $type;
if ($type == 'Link _self' || $type == 'Link _blank') {
$type = 'Link';
}
$link = '';
switch ($type) {
case 'Agenda':
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$result = Database::query("SELECT * FROM {$TABLEAGENDA} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$sql = "select * from {$tbl_lp_item} where c_id = {$course_id} AND id={$id_in_path}";
$result = Database::query($sql);
$row = Database::fetch_array($result);
if ($row['title'] != '') {
$myrow['title'] = $row['title'];
}
$desc = $row['description'];
$agenda_id = $row['item_id'];
if ($builder != 'builder') {
$link .= api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Agenda&origin={$origin}&agenda_id={$agenda_id}#{$id_in_path}";
} else {
$link .= "../calendar/agenda.php?origin={$origin}&agenda_id={$agenda_id}";
}
break;
case 'Ad_Valvas':
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = Database::query("SELECT * FROM {$tbl_announcement} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
if ($builder != 'builder') {
$link .= api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Ad_Valvas&origin={$origin}&ann_id={$id}#{$id_in_path}";
} else {
$link .= "../announcements/announcements.php?origin={$origin}&ann_id={$id}";
}
break;
case 'Link':
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$result = Database::query("SELECT * FROM {$TABLETOOLLINK} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$sql = "select * from {$tbl_lp_item} where c_id = {$course_id} AND id={$id_in_path}";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$thelink = $myrow['url'];
if ($builder != 'builder') {
$link .= api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type={$linktype}&origin={$origin}&thelink={$thelink}#{$id_in_path}";
} else {
$link .= $thelink;
}
break;
case 'Exercise':
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM {$TBL_EXERCICES} WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
if ($builder == 'builder') {
$origin = 'builder';
}
// This is needed for the exercise_submit.php can delete the session info about tests.
$sql = "select * from {$tbl_lp_item} where c_id = {$course_id} AND id={$id_in_path}";
$result = Database::query($sql);
$row = Database::fetch_array($result);
if ($row['title'] != '') {
$myrow['title'] = $row['title'];
}
if ($builder != 'builder') {
$link .= api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Exercise&origin={$origin}&exerciseId=" . $myrow["id"] . "#{$id_in_path}";
} else {
$link .= "../exercice/exercise_submit.php?origin={$origin}&exerciseId=" . $myrow["id"];
}
break;
case 'HotPotatoes':
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
$result = Database::query("SELECT * FROM " . $TBL_DOCUMENT . " WHERE c_id = {$course_id} AND id={$id}");
$myrow = Database::fetch_array($result);
$path = $myrow['path'];
$name = GetQuizName($path, $documentPath);
if ($builder == 'builder') {
$origin = 'builder';
}
$cid = $_course['official_code'];
if ($builder != 'builder') {
//.........这里部分代码省略.........
示例5: while
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$result = Database::query("SELECT * FROM " . $TBL_EXERCICES . " WHERE active='1' ORDER BY id ASC");
while ($myrow = Database::fetch_array($result)) {
echo "<img src='../img/quiz.gif'>" . $myrow["title"] . "<br>";
showorhide_addresourcelink($content, $myrow["id"]);
echo "<br><br>";
}
if ($from_learnpath == 'yes') {
$uploadPath = "/HotPotatoes_files";
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
$sql = "SELECT * FROM " . $TBL_DOCUMENT . " WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '" . $uploadPath . "/%/%' ORDER BY id ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
$path = $myrow["path"];
echo "<img src='../img/jqz.gif'>" . GetQuizName($path, $documentPath) . "<br>";
showorhide_addresourcelink("HotPotatoes", $myrow["id"]);
echo "<br><br>";
}
}
}
/*
-----------------------------------------------------------
External Links
-----------------------------------------------------------
*/
if ($content == "Externallink") {
?>
<form name="form1" method="post" action="">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
示例6: while
$attribute['path'][] = $row['path'];
$attribute['visibility'][] = $row['visibility'];
$attribute['comment'][] = $row['comment'];
}
$nbrActiveTests = 0;
if (isset($attribute['path']) && is_array($attribute['path'])) {
$hotpotatoes_exist = true;
while (list($key, $path) = each($attribute['path'])) {
$item = '';
list($a, $vis) = each($attribute['visibility']);
if (strcmp($vis, "1") == 0) {
$active = 1;
} else {
$active = 0;
}
$title = GetQuizName($path, $documentPath);
if ($title == '') {
$title = basename($path);
}
$class = 'row_even';
if ($count % 2) {
$class = 'row_odd';
}
// prof only
if ($is_allowedToEdit) {
$item = Display::tag('td', '<img src="../img/hotpotatoes_s.png" alt="HotPotatoes" /> <a href="showinframes.php?file=' . $path . '&cid=' . api_get_course_id() . '&uid=' . api_get_user_id() . '"' . (!$active ? 'class="invisible"' : '') . '>' . $title . '</a> ');
$item .= Display::tag('td', '-');
$actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL), 'adminhp.php?' . api_get_cidreq() . '&hotpotatoesName=' . $path);
$actions .= '<a href="hotpotatoes_exercise_report.php?' . api_get_cidreq() . '&path=' . $path . '">' . Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL) . '</a>';
// if active
if ($active) {
示例7: getExercisesReporting
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
public function getExercisesReporting($document_path, $hotpotato_name)
{
$return = array();
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
//$user_id = intval($user_id);
$user_id = null;
$session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
$hotpotato_name = Database::escape_string($hotpotato_name);
if (!empty($exercise_id)) {
$session_id_and .= " AND exe_exo_id = {$exercise_id} ";
}
if (empty($user_id)) {
$sql = "SELECT firstname as userpart1, lastname as userpart2 ,\n email,\n tth.exe_name,\n tth.exe_result,\n tth.exe_weighting,\n tth.exe_date\n FROM {$TBL_TRACK_HOTPOTATOES} tth, {$TBL_USER} tu\n WHERE tu.user_id=tth.exe_user_id AND\n tth.exe_cours_id = '" . Database::escape_string($cid) . "' AND\n tth.exe_name = '{$hotpotato_name}'\n ORDER BY tth.exe_cours_id ASC, tth.exe_date ASC";
} else {
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
// get only this user's results
$sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date\n FROM {$TBL_TRACK_HOTPOTATOES}\n WHERE\n exe_user_id = '" . $user_id . "' AND\n exe_cours_id = '" . Database::escape_string($cid) . "' AND\n tth.exe_name = '{$hotpotato_name}'\n ORDER BY exe_cours_id ASC, exe_date ASC";
}
$results = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
$results[] = $rowx;
}
$hpresults = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
$hpresults[] = $rowx;
}
/*if ($filter) {
switch ($filter) {
case 1 :
$filter_by_not_revised = true;
break;
case 2 :
$filter_by_revised = true;
break;
default :
null;
}
}*/
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$i] = array();
$title = GetQuizName($hpresults[$i]['exe_name'], $document_path);
if ($title == '') {
$title = basename($hpresults[$i]['exe_name']);
}
if (empty($user_id)) {
$return[$i]['email'] = $hpresults[$i]['email'];
$return[$i]['first_name'] = $hpresults[$i]['userpart1'];
$return[$i]['last_name'] = $hpresults[$i]['userpart2'];
}
$return[$i]['title'] = $title;
$return[$i]['exe_date'] = $hpresults[$i]['exe_date'];
$return[$i]['result'] = $hpresults[$i]['exe_result'];
$return[$i]['max'] = $hpresults[$i]['exe_weighting'];
}
}
$this->results = $return;
return true;
}
示例8: str_replace
$newcontent = str_replace($mit, $js_content, $content);
$prehref = "<!-- BeginTopNavButtons -->";
$posthref = "<!-- BeginTopNavButtons -->";
$newcontent = str_replace($prehref, $posthref, $newcontent);
if (CheckSubFolder($full_file_path . $user_id . '.t.html') == 0) {
$newcontent = ReplaceImgTag($newcontent);
}
} else {
$newcontent = $content;
}
WriteFileCont($full_file_path . $user_id . '.t.html', $newcontent);
$doc_url = GetFolderPath($doc_url) . urlencode(basename($doc_url));
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . "/document";
$my_file = Security::remove_XSS($_GET['file']);
$my_file = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($my_file));
$title = GetQuizName($my_file, $documentPath);
if ($title == '') {
$title = basename($my_file);
}
$nameTools = $title;
$noPHP_SELF = true;
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
$htmlHeadXtra[] = '
<script>
$(document).ready( function(){
var height = $(this).innerHeight() - 20;
示例9: _getGradeBookReporting
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
function _getGradeBookReporting($document_path, $user_id = null)
{
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
if (empty($user_id)) {
//get all results (ourself and the others) as an admin should see them
//AND exe_user_id <> $_user['user_id'] clause has been removed
$sql = "SELECT " . (api_is_western_name_order() ? "CONCAT(firstname,' ',lastname)" : "CONCAT(lastname,' ',firstname)") . ", ce.title, te.exe_result ,\n\t\t\t\t\t\tte.exe_weighting, te.exe_date,te.exe_id, user.email, user.user_id\n\t\t\t\t FROM {$TBL_EXERCISES} ce , {$TBL_TRACK_EXERCISES} te, {$TBL_USER} user\n\t\t\t\t WHERE ce.c_id = {$course_id} AND\n\t\t\t\t \t\tte.exe_exo_id = ce.id AND\n\t\t\t\t \t\tuser_id=te.exe_user_id AND te.c_id = '{$course_id}'\n\t\t\t\t ORDER BY te.c_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql = "SELECT " . (api_is_western_name_order() ? "CONCAT(tu.firstname,' ',tu.lastname)" : "CONCAT(tu.lastname,' ',tu.firstname)") . ", tth.exe_name,\n\t\t\t\t\t\ttth.exe_result , tth.exe_weighting, tth.exe_date, tu.email, tu.user_id\n\t\t\t\t\tFROM {$TBL_TRACK_HOTPOTATOES} tth, {$TBL_USER} tu\n\t\t\t\t\tWHERE tu.user_id=tth.exe_user_id AND tth.c_id = '" . $course_id . "'\n\t\t\t\t\tORDER BY tth.c_id ASC, tth.exe_date ASC";
} else {
// get only this user's results
$sql = "SELECT '',ce.title, te.exe_result , te.exe_weighting, te.exe_date,te.exe_id\n\t\t\t\t\t\tFROM {$TBL_EXERCISES} ce , {$TBL_TRACK_EXERCISES} te\n\t\t\t\t \t\tWHERE \tce.c_id \t\t= {$course_id} AND\n\t\t\t\t \t\t\t\tte.exe_exo_id \t= ce.id AND\n\t\t\t\t \t\t\t\tte.exe_user_id \t= '" . $user_id . "' AND\n\t\t\t\t \t\t\t\tte.c_id = '{$course_id}'\n\t\t\t\t \t\tORDER BY te.c_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date\n\t\t\t\t\tFROM {$TBL_TRACK_HOTPOTATOES}\n\t\t\t\t\tWHERE exe_user_id = '" . $user_id . "' AND c_id = '" . $course_id . "'\n\t\t\t\t\tORDER BY c_id ASC, exe_date ASC";
}
$results = getManyResultsXCol($sql, 8);
$hpresults = getManyResultsXCol($hpsql, 7);
$NoTestRes = 0;
$NoHPTestRes = 0;
$j = 0;
//Print the results of tests
if (is_array($results)) {
for ($i = 0; $i < sizeof($results); $i++) {
$return[$i] = array();
$id = $results[$i][5];
$mailid = $results[$i][6];
$user = $results[$i][0];
$test = $results[$i][1];
$res = $results[$i][2];
if (empty($user_id)) {
$user = $results[$i][0];
$return[$i]['user'] = $user;
$return[$i]['user_id'] = $results[$i][7];
}
$return[$i]['title'] = $test;
$return[$i]['time'] = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$return[$i]['result'] = $res;
$return[$i]['max'] = $results[$i][3];
$j = $i;
}
}
$j++;
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$j + $i] = array();
$title = GetQuizName($hpresults[$i][1], $document_path);
if ($title == '') {
$title = basename($hpresults[$i][1]);
}
if (empty($user_id)) {
$return[$j + $i]['user'] = $hpresults[$i][0];
$return[$j + $i]['user_id'] = $results[$i][6];
}
$return[$j + $i]['title'] = $title;
$return[$j + $i]['time'] = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
$return[$j + $i]['result'] = $hpresults[$i][2];
$return[$j + $i]['max'] = $hpresults[$i][3];
}
}
$this->results = $return;
return true;
}
示例10: GetImgParams
$finish = 1;
}
} else {
// If we are (still) on the first step of the upload process.
if ($finish == 0) {
$finish = 2;
// Get number and name of images from the files contents.
GetImgParams('/' . $filename, $document_sys_path . $uploadPath . '/' . $fld, $imgparams, $imgcount);
if ($imgcount == 0) {
$finish = 1;
} else {
$dialogBox .= get_lang('DownloadEnd');
}
}
}
$title = @htmlspecialchars(GetQuizName($filename, $document_sys_path . $uploadPath . '/' . $fld . '/'), ENT_COMPAT, api_get_system_encoding());
$query = "UPDATE {$dbTable} SET comment='" . Database::escape_string($title) . "' WHERE c_id = {$course_id} AND path=\"" . $uploadPath . "/" . $fld . "/" . $filename . "\"";
Database::query($query);
api_item_property_update($_course, TOOL_QUIZ, $id, 'QuizAdded', api_get_user_id());
} else {
if ($finish == 2) {
// delete?
//$dialogBox .= get_lang('NoImg');
}
$finish = 0;
// error
if (api_failure::get_last_failure() == 'not_enough_space') {
$dialogBox .= get_lang('NoSpace');
} elseif (api_failure::get_last_failure() == 'php_file_in_zip_file') {
$dialogBox .= get_lang('ZipNoPhp');
}
示例11: while
while ($myrow = Database::fetch_array($result)) {
echo Display::return_icon('quiz.gif');
echo $myrow["title"] . "<br>";
showorhide_addresourcelink($content, $myrow["id"]);
echo "<br><br>";
}
if ($from_learnpath == 'yes') {
$uploadPath = "/HotPotatoes_files";
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
$sql = "SELECT * FROM " . $TBL_DOCUMENT . " WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '" . $uploadPath . "/%/%' ORDER BY id ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
$path = $myrow["path"];
echo Display::return_icon('jqz.gif');
echo GetQuizName($path, $documentPath) . "<br>";
showorhide_addresourcelink("HotPotatoes", $myrow["id"]);
echo "<br><br>";
}
}
}
/*
-----------------------------------------------------------
External Links
-----------------------------------------------------------
*/
if ($content == "Externallink") {
?>
<form name="form1" method="post" action="">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
示例12: get_addedresource_link_in_learnpath
//.........这里部分代码省略.........
{
$link .= $thelink;
}
break;
case "Exercise":
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST,$_course['dbName']);
$result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id");
$myrow=Database::fetch_array($result);
if ($builder=='builder') { $origin='builder'; }
//this is needed for the exercise_submit.php can delete the session info about tests
$sql="select * from $tbl_learnpath_item where id=$id_in_path";
$result=Database::query($sql); $row=Database::fetch_array($result);
if ($row['title'] != '') { $myrow["title"]=$row['title']; }
if ($builder != 'builder')
{
$link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path";
}
else
{
$link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"];
}
break;
case "HotPotatoes":
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT,$_course['dbName']);
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id");
$myrow= Database::fetch_array($result);
$path=$myrow["path"];
$name=GetQuizName($path,$documentPath);
if ($builder=='builder') { $origin='builder'; }
$cid = $_course['official_code'];
if ($builder != 'builder')
{
$link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path";
}
else
{
$link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."";
}
break;
case "Forum":
//deprecated
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM,$_course['dbName']);
$result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id");
$myrow=Database::fetch_array($result);
if ($builder=='builder') { $origin='builder'; }
$sql="select * from $tbl_learnpath_item where id=$id_in_path";
$result=Database::query($sql); $row=Database::fetch_array($result);
if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; }
if ($myrow["forum_name"]=='') { $type="Forum"; }
$forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"];
if ($builder != 'builder')
{
示例13: SetComment
<h4>
<?php
echo $nameTools;
?>
</h4>
<?php
if (isset($newName)) {
if ($newName != "") {
//alter database record for that test
SetComment($hotpotatoesName, $newName);
echo "<script type='text/javascript'>window.location='" . $urlMainExercise . "exercice.php'; </script>";
}
}
echo "<form action=\"" . $urlMainExercise . "adminhp.php\" method='post' name='form1'>";
echo "<input type=\"hidden\" name=\"hotpotatoesName\" value=\"{$hotpotatoesName}\">";
echo "<input type=\"text\" name=\"newName\" value=\"";
$lstrComment = "";
$lstrComment = GetComment($hotpotatoesName);
if ($lstrComment == "") {
$lstrComment = GetQuizName($hotpotatoesName, $documentPath);
}
if ($lstrComment == "") {
$lstrComment = basename($hotpotatoesName, $documentPath);
}
echo $lstrComment;
echo "\" size=40> ";
echo "<button type=\"submit\" class=\"save\" name=\"submit\" value=\"" . get_lang('Ok') . "\">" . get_lang('Ok') . "</button>";
echo "<button type=\"button\" class=\"cancel\" name=\"cancel\" value=\"" . get_lang('Cancel') . "\" onclick=\"javascript:document.form1.newName.value='';\">" . get_lang('Cancel') . "</button>";
echo "</form>";
Display::display_footer();
示例14: _getExercisesReporting
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
*/
function _getExercisesReporting($document_path, $user_id = null, $filter = 0, $exercise_id = 0, $hotpotato_name = null)
{
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
$user_id = intval($user_id);
$session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
$exercise_id = intval($exercise_id);
$hotpotato_name = Database::escape_string($hotpotato_name);
if (!empty($exercise_id)) {
$session_id_and .= " AND exe_exo_id = {$exercise_id} ";
}
if (empty($user_id)) {
$user_id_and = null;
$sql = "SELECT " . (api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2") . ",\n ce.title as extitle,\n te.exe_result as exresult ,\n te.exe_weighting as exweight,\n te.exe_date as exdate,\n te.exe_id as exid,\n email as exemail,\n te.start_date as exstart,\n steps_counter as exstep,\n exe_user_id as excruid,\n te.exe_duration as duration\n FROM {$TBL_EXERCISES} AS ce \n INNER JOIN {$TBL_TRACK_EXERCISES} AS te ON (te.exe_exo_id = ce.iid) \n INNER JOIN {$TBL_USER} AS user ON (user.user_id = exe_user_id)\n LEFT JOIN {$TBL_TABLE_LP_MAIN} AS tlm ON tlm.id = te.orig_lp_id AND tlm.c_id = ce.c_id\n WHERE ce.c_id = {$course_id} AND\n te.status != 'incomplete' AND\n te.c_id = '" . $course_id . "' {$user_id_and} {$session_id_and} AND\n ce.active <>-1 AND\n orig_lp_id = 0 AND\n orig_lp_item_id = 0";
$hpsql = "SELECT " . (api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2") . ",\n email,\n tth.exe_name,\n tth.exe_result,\n tth.exe_weighting,\n tth.exe_date\n FROM {$TBL_TRACK_HOTPOTATOES} tth, {$TBL_USER} tu\n WHERE tu.user_id=tth.exe_user_id AND\n tth.c_id = '" . $course_id . "' AND\n tth.exe_name = '{$hotpotato_name}'\n ORDER BY tth.c_id ASC, tth.exe_date DESC";
} else {
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
// get only this user's results
$sql = "SELECT " . (api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2") . ",\n ce.title as extitle,\n te.exe_result as exresult,\n te.exe_weighting as exweight,\n te.exe_date as exdate,\n te.exe_id as exid,\n email as exemail,\n te.start_date as exstart,\n steps_counter as exstep,\n exe_user_id as excruid,\n te.exe_duration as duration,\n ce.results_disabled as exdisabled,\n te.orig_lp_id as orig_lp_id,\n tlm.name as lp_name\n FROM {$TBL_EXERCISES} AS ce \n INNER JOIN {$TBL_TRACK_EXERCISES} AS te ON (te.exe_exo_id = ce.id) \n INNER JOIN {$TBL_USER} AS user ON (user.user_id = exe_user_id)\n LEFT JOIN {$TBL_TABLE_LP_MAIN} AS tlm ON tlm.id = te.orig_lp_id AND tlm.c_id = ce.c_id\n WHERE ce.c_id = {$course_id} AND\n te.status != 'incomplete' AND\n te.c_id ='" . $course_id . "' {$user_id_and} {$session_id_and} AND\n ce.active <>-1 AND\n orig_lp_id = 0 AND\n orig_lp_item_id = 0\n ORDER BY userpart2, te.c_id ASC, ce.title ASC, te.exe_date DESC";
$hpsql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date\n FROM {$TBL_TRACK_HOTPOTATOES}\n WHERE exe_user_id = '" . $user_id . "' AND\n c_id = '" . $course_id . "' AND\n tth.exe_name = '{$hotpotato_name}'\n ORDER BY c_id ASC, exe_date DESC";
}
$results = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
$results[] = $rowx;
}
$hpresults = array();
$resx = Database::query($hpsql);
while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
$hpresults[] = $rowx;
}
$filter_by_not_revised = false;
$filter_by_revised = false;
if ($filter) {
switch ($filter) {
case 1:
$filter_by_not_revised = true;
break;
case 2:
$filter_by_revised = true;
break;
default:
null;
}
}
//Print the results of tests
if (is_array($results) && empty($hotpotato_name)) {
for ($i = 0; $i < sizeof($results); $i++) {
$revised = false;
//revised or not
$sql_exe = "SELECT exe_id FROM {$TBL_TRACK_ATTEMPT_RECORDING}\n\t\t\t\t\t\t\tWHERE author != '' AND exe_id = " . Database::escape_string($results[$i]['exid']) . " LIMIT 1";
$query = Database::query($sql_exe);
if (Database::num_rows($query) > 0) {
$revised = true;
}
if ($filter_by_not_revised && $revised) {
continue;
}
if ($filter_by_revised && !$revised) {
continue;
}
$return[$i] = array();
if (empty($user_id)) {
$return[$i]['first_name'] = $results[$i]['userpart1'];
$return[$i]['last_name'] = $results[$i]['userpart2'];
$return[$i]['user_id'] = $results[$i]['excruid'];
$return[$i]['email'] = $results[$i]['exemail'];
}
$return[$i]['title'] = $results[$i]['extitle'];
$return[$i]['start_date'] = api_get_local_time($results[$i]['exstart']);
$return[$i]['end_date'] = api_get_local_time($results[$i]['exdate']);
$return[$i]['duration'] = $results[$i]['duration'];
$return[$i]['result'] = $results[$i]['exresult'];
$return[$i]['max'] = $results[$i]['exweight'];
$return[$i]['status'] = $revised ? get_lang('Validated') : get_lang('NotValidated');
$return[$i]['lp_id'] = $results[$i]['orig_lp_id'];
$return[$i]['lp_name'] = $results[$i]['lp_name'];
}
}
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$i] = array();
$title = GetQuizName($hpresults[$i]['exe_name'], $document_path);
if ($title == '') {
$title = basename($hpresults[$i]['exe_name']);
}
if (empty($user_id)) {
//.........这里部分代码省略.........