本文整理汇总了PHP中api_get_cidReq函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_cidReq函数的具体用法?PHP api_get_cidReq怎么用?PHP api_get_cidReq使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_cidReq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_self
}
}
} else {
$certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
}
} else {
$certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
}
echo '<div class="btn-group">';
$url = api_get_self() . '?action=generate_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id . '&filter=' . $filterOfficialCode;
echo Display::url(get_lang('GenerateCertificates'), $url, array('class' => 'btn btn-default'));
$url = api_get_self() . '?action=delete_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id . '&filter=' . $filterOfficialCode;
echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn btn-default'));
$hideCertificateExport = api_get_setting('hide_certificate_export_link');
if (count($certificate_list) > 0 && $hideCertificateExport !== 'true') {
$url = api_get_self() . '?action=export_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id . '&filter=' . $filterOfficialCode;
echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn btn-default'));
}
echo '</div>';
echo $filterForm;
if (count($certificate_list) == 0) {
echo Display::display_warning_message(get_lang('NoResultsAvailable'));
} else {
echo '<br /><br /><table class="data_table">';
foreach ($certificate_list as $index => $value) {
echo '<tr>
<td width="100%" class="actions">' . get_lang('Student') . ' : ' . api_get_person_name($value['firstname'], $value['lastname']) . ' (' . $value['username'] . ')</td>';
echo '</tr>';
echo '<tr><td>
<table class="data_table">';
$list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
示例2: addslashes
}
$confirmYourChoice = addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset));
$htmlHeadXtra[] = "\n<script>\n\tfunction submit_form(obj) {\n\t\tdocument.question_pool.submit();\n\t}\n\n\tfunction mark_course_id_changed() {\n\t\t\$('#course_id_changed').val('1');\n\t}\n\n\tfunction mark_exercice_id_changed() {\n\t\t\$('#exercice_id_changed').val('1');\n\t}\n\n\tfunction confirm_your_choice() {\n\t\treturn confirm('{$confirmYourChoice}');\n\t}\n</script>";
Display::display_header($nameTools, 'Exercise');
// Menu
echo '<div class="actions">';
if (isset($type)) {
$url = api_get_self() . '?type=1';
} else {
$url = api_get_self();
}
if (isset($fromExercise) && $fromExercise > 0) {
echo '<a href="admin.php?' . api_get_cidreq() . '&exerciseId=' . $fromExercise . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
$titleAdd = get_lang('AddQuestionToTest');
} else {
echo '<a href="exercice.php?' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo "<a href='admin.php?exerciseId=0'>" . Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM) . "</a>";
$titleAdd = get_lang('ManageAllQuestions');
}
echo '</div>';
if ($displayMessage != "") {
Display::display_confirmation_message($displayMessage);
$displayMessage = "";
}
// Form
echo '<form class="form-horizontal" name="question_pool" method="GET" action="' . $url . '">';
// Title
echo '<legend>' . $nameTools . ' - ' . $titleAdd . '</legend>';
if (isset($type)) {
echo '<input type="hidden" name="type" value="1">';
}
示例3: display_resources
/**
* Function that displays a list with al the resources that could be added to the learning path
*
* @return string
*/
function display_resources()
{
global $_course, $charset;
//TODO: don't use globals
$add_page_lang_var = api_convert_encoding(get_lang('LpAddPage'), $charset, api_get_system_encoding());
$send_file_lang_var = api_convert_encoding(get_lang('SendFile'), $charset, api_get_system_encoding());
$add_quiz_lang_var = api_convert_encoding(get_lang('LpAddQuiz'), $charset, api_get_system_encoding());
$upload_quiz_lang_var = api_convert_encoding(get_lang('LpUploadQuiz'), $charset, api_get_system_encoding());
$mindmap_lang_var = api_convert_encoding(get_lang('Mindmap'), $charset, api_get_system_encoding());
$video_lang_var = api_convert_encoding(get_lang('Video'), $charset, api_get_system_encoding());
$commonCssClasses = "big_button four_buttons rounded grey_border";
// add page
$href = 'lp_gallery.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&action=add_item&type=template&lp_id=' . $_SESSION['oLP']->lp_id;
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' create_page_button">' . $add_page_lang_var . '</a>';
// upload docs
$href = 'lp_upload_document.php?' . api_get_cidreq() . '&lp_id=' . $this->lp_id . '&path=%2F&selectcat=';
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' upload_doc_button">' . $send_file_lang_var . '</a>';
// select document
$return .= $this->get_documents();
// links
$return .= $this->get_links();
// add quiz
$href = api_get_path(REL_CODE_PATH) . 'exercice/exercise_admin.php?' . api_get_cidreq() . '&fromlp=1&lp_id=' . $this->lp_id;
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' create_quiz_button">' . $add_quiz_lang_var . '</a>';
/**
==============================================================================
* TODO set upload quiz link
==============================================================================
*/
//upload quiz
$href = 'lp_upload_quiz.php?' . api_get_cidreq() . '&lp_id=' . $this->lp_id;
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' upload_quiz_button">' . $upload_quiz_lang_var . '</a>';
// select quiz
$return .= $this->get_exercises();
// survey
$return .= $this->get_survey();
// forum
$return .= $this->get_forums();
// assignement
$return .= $this->get_student_publication();
// mindmap
if (api_get_setting('enable_certificate') === 'true') {
$href = 'certificate.php?' . api_get_cidReq() . '&lp_id=' . $this->lp_id;
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' create_certificate_button">' . get_lang("Certificate") . '</a>';
} else {
// Mindmaps page
$href = 'lp_mindmap.php?' . api_get_cidreq() . '&view=&action=add&curdirpath=&type=' . TOOL_MINDMAP . '&lp_id=' . $this->lp_id;
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' mindmap_button">' . $mindmap_lang_var . '</a>';
}
/**
==============================================================================
* TODO set video link
==============================================================================
*/
// video
$href = 'lp_video.php?' . api_get_cidreq() . '&view=&action=add&type=video&lp_id=' . $this->lp_id;
$return .= '<a href="' . $href . '" class="' . $commonCssClasses . ' video_button">' . $video_lang_var . '</a>';
return $return;
}
示例4: get_list_users_certificates
$total_resource_weight = $total_resource_weight + $item['2'];
}
}
}
if ($total_resource_weight != $total_weight) {
Display::display_warning_message(get_lang('SumOfActivitiesWeightMustBeEqualToTotalWeight'));
}
}
$certificate_list = get_list_users_certificates($cat_id);
echo '<div class="btn-group">';
$url = api_get_self() . '?action=generate_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id;
echo Display::url(get_lang('GenerateCertificates'), $url, array('class' => 'btn'));
$url = api_get_self() . '?action=delete_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id;
echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn'));
if (count($certificate_list) > 0) {
$url = api_get_self() . '?action=export_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id;
echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn'));
}
echo '</div>';
if (count($certificate_list) == 0) {
echo Display::display_warning_message(get_lang('NoResultsAvailable'));
} else {
echo '<br /><br /><table class="data_table">';
foreach ($certificate_list as $index => $value) {
echo '<tr>
<td width="100%" class="actions">' . get_lang('Student') . ' : ' . api_get_person_name($value['firstname'], $value['lastname']) . ' ( ' . $value['username'] . ')</td>';
echo '</tr>';
echo '<tr><td>
<table class="data_table">';
$list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
foreach ($list_certificate as $value_certificate) {
示例5: array
case 'csv':
Export::arrayToCsv($data);
exit;
break;
case 'xls':
if (!empty($data)) {
Export::arrayToXls($data);
exit;
}
break;
}
break;
}
}
/* Header */
$interbreadcrumb[] = array('url' => 'group.php?' . api_get_cidReq(), 'name' => get_lang('Groups'));
if (!isset($_GET['origin']) || $_GET['origin'] != 'learnpath') {
// So we are not in learnpath tool
if (!$is_allowed_in_course) {
api_not_allowed(true);
}
if (!api_is_allowed_to_edit(false, true)) {
api_not_allowed(true);
} else {
Display::display_header($nameTools, 'Group');
// Tool introduction
Display::display_introduction_section(TOOL_GROUP);
}
} else {
Display::display_reduced_header();
}
示例6: elseif
}
echo '</div>';
} elseif (isset($_GET['action']) && $_GET['action'] == 'showterm') {
$id = $_GET['q'];
$t_glossary = Database::get_course_table(TABLE_GLOSSARY);
$t_item_propery = Database::get_course_table(TABLE_ITEM_PROPERTY);
$query = "SELECT \tg.glossary_id \t\tAS glossary_id,\n\t\t\t\t\tg.name \t\t\t\tAS glossary_title,\n\t\t\t\t\tg.description \t\tAS glossary_comment,\n\t\t\t\t\tg.display_order\t\tAS glossary_display_order\n\t\t\t FROM {$t_glossary} g, {$t_item_propery} ip\n\t\t\t WHERE g.glossary_id = ip.ref\n\t\t\t AND tool = '" . TOOL_GLOSSARY . "'\n\t\t\t AND g.glossary_id = '" . Database::escape_string($id) . "' ";
$res = api_sql_query($query, __FILE__, __LINE__);
while ($data = Database::fetch_object($res)) {
$glossary_name = convert_encoding($data->glossary_title);
$glossary_description = convert_encoding($data->glossary_comment);
}
// Wrapper for add edit form + image map
echo '<div id="wrapper_glossary_form">';
//To show Add and Edit Definition form
echo '<div id="glossary_form">';
echo '<div align="center" class="quiz_content_actions">' . $glossary_name . '</div>';
echo '<div align="center" class="quiz_content_actions glossary_description_height" style="overflow:auto;text-align:left;">' . $glossary_description . '</div>';
if (api_is_allowed_to_edit(null, true)) {
echo '<div align="right" class="quiz_content_actions" style="border:none;"><a href="index.php?' . api_get_cidReq() . '&action=editterm&glossary_id=' . $id . '">' . Display::return_icon('pixel.gif', get_lang('Edit'), array('class' => 'actionplaceholdericon actionedit')) . ' <a onclick="return confirmation(\'' . $glossary_name . '\');" href="index.php?action=delete_glossary&glossary_id=' . $id . '">' . Display::return_icon('pixel.gif', get_lang('Delete'), array('class' => 'actionplaceholdericon actiondelete')) . '</a></div>';
}
// Close add/edit form
echo '</div>';
// Add image map
echo '<div id="glossary_image_map">';
echo '<a href="index.php?' . api_get_cidReq() . '"><img class="abs" src="../img/imagemap90.png" style="margin:30px 30px 0 0; right:0; top:0;"></a>';
// Close "image map"
echo '</div>';
// Close glossary wrapper form
echo '</div>';
}
示例7: header
<?php
/* For licensing terms, see /license.txt */
/**
* Redirection script
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true;
require 'back_compat.inc.php';
header('location: lp_controller.php?'.api_get_cidReq().'&action=list');
示例8: isset
} else {
Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
}
}
// If we are in a test
$inATest = isset($exerciseId) && $exerciseId > 0;
if ($inATest) {
echo '<div class="actions">';
if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
echo '<a href="' . $urlMainExercise . 'admin.php?exerciseId=' . $exerciseId . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
echo '<a href="' . $urlMainExercise . 'exercice.php?' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
echo '<a href="' . $urlMainExercise . 'overview.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '&preview=1">' . Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM) . '</a>';
echo Display::url(Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM), $urlMainExercise . 'exercise_report.php?' . api_get_cidReq() . '&exerciseId=' . $objExercise->id);
if ($objExercise->edit_exercise_in_lp == false) {
echo '<a href="">' . Display::return_icon('settings_na.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM) . '</a>';
} else {
echo '<a href="' . $urlMainExercise . 'exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM) . '</a>';
}
// @todo if you have 5000 questions this will slow down everything
/*
$maxScoreAllQuestions = 0;
if (!empty($objExercise->questionList)) {
foreach ($objExercise->questionList as $q) {
$question = Question::read($q);
if ($question) {
$maxScoreAllQuestions += $question->selectWeighting();
}
}
示例9: isset
} else {
Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
}
}*/
// If we are in a test
$inATest = isset($exerciseId) && $exerciseId > 0;
if ($inATest) {
echo '<div class="actions">';
if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?exerciseId=' . $exerciseId . '&' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise.php?' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '&preview=1">' . Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM) . '</a>';
echo Display::url(Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidReq() . '&exerciseId=' . $objExercise->id);
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM) . '</a>';
$maxScoreAllQuestions = 0;
if (!empty($objExercise->questionList)) {
foreach ($objExercise->questionList as $q) {
$question = Question::read($q);
if ($question) {
$maxScoreAllQuestions += $question->selectWeighting();
}
}
}
echo '</div>';
echo '<div class="alert alert-info">' . sprintf(get_lang('XQuestionsWithTotalScoreY'), $objExercise->selectNbrQuestions(), $maxScoreAllQuestions) . '</div>';
} else {
if (isset($_GET['newQuestion'])) {
// we are in create a new question from question pool not in a test
示例10: header
$exercise_id = $objExercise->id;
Session::erase('objExercise');
header('Location:admin.php?&exerciseId=' . $exercise_id . '&' . api_get_cidreq());
exit;
} else {
// DISPLAY FORM
if (api_is_in_gradebook()) {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'gradebook/index.php?' . api_get_cidreq(), 'name' => get_lang('ToolGradebook'));
}
$nameTools = get_lang('ExerciseManagement');
$interbreadcrumb[] = array("url" => 'exercise.php?' . api_get_cidreq(), 'name' => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => 'admin.php?exerciseId=' . $objExercise->id . '&' . api_get_cidreq(), "name" => $objExercise->name);
Display::display_header($nameTools, get_lang('Exercise'));
echo '<div class="actions">';
if ($objExercise->id != 0) {
echo '<a href="admin.php?' . api_get_cidReq() . '&exerciseId=' . $objExercise->id . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
} else {
if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
if (!empty($_POST['lp_id'])) {
$lp_id = intval($_POST['lp_id']);
//TODO:this remains to be implemented after press the first post
} else {
$lp_id = intval($_GET['lp_id']);
}
echo "<a href=\"../newscorm/lp_controller.php?" . api_get_cidreq() . "&gradebook=&action=add_item&type=step&lp_id=" . $lp_id . "#resource_tab-2\">" . Display::return_icon('back.png', get_lang("BackTo") . ' ' . get_lang("LearningPaths"), '', ICON_SIZE_MEDIUM) . "</a>";
} else {
echo '<a href="exercise.php?' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
}
echo '</div>';
if ($objExercise->feedback_type == 1) {
示例11: api_get_path
// If this is the case there will be a language choice
$sql = "SELECT * FROM {$table_survey} WHERE c_id = {$course_id} AND code='" . Database::escape_string($survey_data['code']) . "'";
$result = Database::query($sql);
if (Database::num_rows($result) > 1) {
Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
}
// Invited / answered message
if ($survey_data['invited'] > 0 && !isset($_POST['submit'])) {
$message = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_invitation.php?view=answered&survey_id=' . $survey_data['survey_id'] . '">' . $survey_data['answered'] . '</a> ';
$message .= get_lang('HaveAnswered') . ' ';
$message .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_invitation.php?view=invited&survey_id=' . $survey_data['survey_id'] . '">' . $survey_data['invited'] . '</a> ';
$message .= get_lang('WereInvited');
Display::display_normal_message($message, false);
}
// Building the form for publishing the survey
$form = new FormValidator('publish_form', 'post', api_get_self() . '?survey_id=' . $survey_id . '&' . api_get_cidReq());
$form->addElement('header', '', $tool_name);
// Course users
$complete_user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), '', api_sort_by_first_name() ? 'ORDER BY firstname' : 'ORDER BY lastname');
$possible_users = array();
foreach ($complete_user_list as &$user) {
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
}
$users = $form->addElement('advmultiselect', 'course_users', get_lang('CourseUsers'), $possible_users, 'style="width: 250px; height: 200px;"');
$users->setElementTemplate('
{javascript}
<table{class}>
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
<!-- BEGIN label_3 --><th> </th><th>{label_3}</th></tr><!-- END label_3 -->
<tr>
<td valign="top">{unselected}</td>
示例12: substr
$dispid = substr($disp[$i], 8, strlen($disp[$i]));
$query = "UPDATE {$tbl_lp_item} SET display_order = " . $listingCounter . " WHERE id = " . $dispid;
$result = api_sql_query($query, __FILE__, __LINE__);
$listingCounter = $listingCounter + 1;
}
} elseif ($dispaction == "sortlp") {
$listingCounter = 1;
$disp = explode(",", $updateRecordsArray);
$cntdispid = sizeof($disp);
for ($i = 0; $i < $cntdispid; $i++) {
$dispid = substr($disp[$i], 8, strlen($disp[$i]));
$query = "UPDATE {$lp_table} SET display_order = " . $listingCounter . " WHERE id = " . $dispid;
$result = api_sql_query($query, __FILE__, __LINE__);
$listingCounter = $listingCounter + 1;
}
echo '<script type="text/javascript">window.location.href="lp_controller.php?' . api_get_cidReq() . '&action=course"</script>';
}
}
$lp_controller_touched = 1;
$lp_found = false;
if (isset($_SESSION['lpobject'])) {
if ($debug > 0) {
error_log('New LP - SESSION[lpobject] is defined', 0);
}
$oLP = unserialize($_SESSION['lpobject']);
if (is_object($oLP)) {
if ($debug > 0) {
error_log('New LP - oLP is object', 0);
}
$_SESSION['oLP'] = $oLP;
$lp_found = true;
示例13: get_lang
$nameTools = get_lang('PropModify');
}
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$("#max_member").on("focus", function() {
$("#max_member_selected").attr("checked", true);
});
});
</script>';
$interbreadcrumb[] = array('url' => 'group.php?' . api_get_cidReq(), 'name' => get_lang('Groups'));
$course_id = api_get_course_int_id();
// Build the form
if (isset($_GET['id'])) {
// Update settings of existing category
$action = 'update_settings';
$form = new FormValidator('group_category', 'post', api_get_self() . '?id=' . $category['id'] . '&' . api_get_cidReq());
$form->addElement('hidden', 'id');
} else {
// Checks if the field was created in the table Category. It creates it if is neccesary
$table_category = Database::get_course_table(TABLE_GROUP_CATEGORY);
if (!Database::query("SELECT wiki_state FROM {$table_category} WHERE c_id = {$course_id}")) {
Database::query("ALTER TABLE {$table_category} ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = {$course_id}");
}
// Create a new category
$action = 'add_category';
$form = new FormValidator('group_category');
}
// If categories allowed, show title & description field
if (api_get_setting('allow_group_categories') == 'true') {
$form->addElement('header', $nameTools);
$form->addElement('html', '<div class="row"><div class="col-md-6">');
示例14: lp_upload_quiz_action_handling
//.........这里部分代码省略.........
for ($j = $question_name_index_init[$i]; $j <= $question_name_index_end[$i]; $j++) {
if (is_array($data->sheets[0]['cells'][$j])) {
$column_data = $data->sheets[0]['cells'][$j];
// Fill all column with data
for ($x = 1; $x <= $data->sheets[0]['numCols']; $x++) {
if (empty($column_data[$x])) {
$data->sheets[0]['cells'][$j][$x] = '';
}
}
$column_data = $data->sheets[0]['cells'][$j];
// Array filled of data
if (is_array($data->sheets[0]['cells'][$j]) && count($data->sheets[0]['cells'][$j]) > 0) {
$new_answer[$i][$j] = $data->sheets[0]['cells'][$j];
}
}
}
}
$quiz_title = $quiz[2];
// Quiz title
if ($quiz_title != '') {
// Variables
$type = 2;
$random = $active = $results = $max_attempt = $expired_time = 0;
//make sure feedback is enabled (3 to disable), otherwise the fields
// added to the XLS are not shown, which is confusing
$feedback = 0;
// Quiz object
$quiz_object = new Exercise();
$quiz_id = $quiz_object->create_quiz($quiz_title, $expired_time, $type, $random, $active, $results, $max_attempt, $feedback);
if ($quiz_id) {
// insert into the item_property table
api_item_property_update($_course, TOOL_QUIZ, $quiz_id, 'QuizAdded', api_get_user_id());
// Import questions
for ($i = 0; $i < $number_questions; $i++) {
// Create questions
$question_title = $question[$i][2];
// Question name
// Unique answers are the only question types available for now
// through xls-format import
$unique_answer = new UniqueAnswer();
if ($question_title != '') {
$question_id = $unique_answer->create_question($quiz_id, $question_title);
}
if (is_array($new_answer[$i])) {
$id = 1;
$answers_data = $new_answer[$i];
foreach ($answers_data as $answer_data) {
$answer = $answer_data[2];
$correct = 0;
$score = 0;
$comment = '';
if (strtolower($answer_data[3]) == 'x') {
$correct = 1;
$score = $score_list[$i][3];
$comment = $feedback_true_list[$i][2];
} else {
$comment = $feedback_false_list[$i][2];
}
// Create answer
$unique_answer->create_answer($id, $question_id, $answer, $comment, $score, $correct);
$id++;
}
}
}
}
if (isset($_SESSION['lpobject'])) {
if ($debug > 0) {
error_log('New LP - SESSION[lpobject] is defined', 0);
}
$oLP = unserialize($_SESSION['lpobject']);
if (is_object($oLP)) {
if ($debug > 0) {
error_log('New LP - oLP is object', 0);
}
if (empty($oLP->cc) or $oLP->cc != api_get_course_id()) {
if ($debug > 0) {
error_log('New LP - Course has changed, discard lp object', 0);
}
$oLP = null;
Session::erase('oLP');
Session::erase('lpobject');
} else {
$_SESSION['oLP'] = $oLP;
$lp_found = true;
}
}
}
if (isset($_SESSION['oLP']) && isset($_GET['lp_id'])) {
$previous = $_SESSION['oLP']->select_previous_item_id();
$parent = 0;
// Add a Quiz as Lp Item
$_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, $quiz_title, '');
// Redirect to home page for add more content
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() . '&action=add_item&type=step&lp_id=' . Security::remove_XSS($_GET['lp_id']) . '&session_id=' . api_get_session_id());
exit;
} else {
echo '<script>window.location.href = "' . api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidReq() . '&exerciseId=' . $quiz_id . '&session_id=' . api_get_session_id() . '"</script>';
}
}
}
示例15: lp_upload_quiz_action_handling
//.........这里部分代码省略.........
$numberRightAnswers++;
}
}
foreach ($answers_data as $answer_data) {
$answerValue = $answer_data[2];
$correct = 0;
$score = 0;
if (strtolower($answer_data[3]) == 'x') {
$correct = 1;
$score = $score_list[$i][3];
$comment = $feedback_true_list[$i][2];
} else {
$comment = $feedback_false_list[$i][2];
$floatVal = (double) $answer_data[3];
if (is_numeric($floatVal)) {
$score = $answer_data[3];
}
}
if ($useCustomScore) {
if ($correct) {
$score = $correctScore;
} else {
$score = $incorrectScore;
}
}
// Fixing scores:
switch ($detectQuestionType) {
case GLOBAL_MULTIPLE_ANSWER:
$score /= $numberRightAnswers;
break;
case UNIQUE_ANSWER:
break;
case MULTIPLE_ANSWER:
if (!$correct) {
//$total = $total - $score;
}
break;
}
$objAnswer->createAnswer($answerValue, $correct, $comment, $score, $id);
$total += $score;
$id++;
}
$objAnswer->save();
$questionObj = Question::read($question_id, $courseId);
switch ($detectQuestionType) {
case GLOBAL_MULTIPLE_ANSWER:
$questionObj->updateWeighting($globalScore);
break;
case UNIQUE_ANSWER:
case MULTIPLE_ANSWER:
default:
$questionObj->updateWeighting($total);
break;
}
$questionObj->save();
} else {
if ($detectQuestionType === FREE_ANSWER) {
$questionObj = Question::read($question_id, $courseId);
$globalScore = $score_list[$i][3];
$questionObj->updateWeighting($globalScore);
$questionObj->save();
}
}
}
}
if (isset($_SESSION['lpobject'])) {
if ($debug > 0) {
error_log('New LP - SESSION[lpobject] is defined', 0);
}
$oLP = unserialize($_SESSION['lpobject']);
if (is_object($oLP)) {
if ($debug > 0) {
error_log('New LP - oLP is object', 0);
}
if (empty($oLP->cc) or $oLP->cc != api_get_course_id()) {
if ($debug > 0) {
error_log('New LP - Course has changed, discard lp object', 0);
}
$oLP = null;
Session::erase('oLP');
Session::erase('lpobject');
} else {
$_SESSION['oLP'] = $oLP;
}
}
}
if (isset($_SESSION['oLP']) && isset($_GET['lp_id'])) {
$previous = $_SESSION['oLP']->select_previous_item_id();
$parent = 0;
// Add a Quiz as Lp Item
$_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, $quiz_title, '');
// Redirect to home page for add more content
header('location: ../newscorm/lp_controller.php?' . api_get_cidreq() . '&action=add_item&type=step&lp_id=' . Security::remove_XSS($_GET['lp_id']));
exit;
} else {
// header('location: exercise.php?' . api_get_cidreq());
echo '<script>window.location.href = "' . api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidReq() . '&exerciseId=' . $quiz_id . '&session_id=' . api_get_session_id() . '"</script>';
}
}
}