public function send_invitation($username, $password, $userfriend_id, $content_message = '') { global $charset; if ($this->verifyUserPass($username, $password) == "valid") { $user_id = UserManager::get_user_id_from_username($username); $message_title = get_lang('Invitation'); $count_is_true = SocialManager::send_invitation_friend($user_id, $userfriend_id, $message_title, $content_message); if ($count_is_true) { return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES, $charset), false); } else { return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES, $charset), false); } } return get_lang('InvalidId'); }
function display_survey_list_for_coach() { $parameters = array(); $parameters['cidReq'] = api_get_course_id(); if (isset($_GET['do_search'])) { $message = get_lang('DisplaySearchResults') . '<br />'; $message .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '">' . get_lang('DisplayAll') . '</a>'; Display::display_normal_message($message, false); } // Create a sortable table with survey-data $table = new SortableTable('surveys_coach', 'get_number_of_surveys_for_coach', 'get_survey_data_for_coach', 2); $table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('SurveyName')); $table->set_header(2, get_lang('SurveyCode')); $table->set_header(3, get_lang('NumberOfQuestions')); $table->set_header(4, get_lang('Author')); //$table->set_header(5, get_lang('Language')); //$table->set_header(6, get_lang('Shared')); $table->set_header(5, get_lang('AvailableFrom')); $table->set_header(6, get_lang('AvailableUntil')); $table->set_header(7, get_lang('Invite')); $table->set_header(8, get_lang('Anonymous')); $table->set_header(9, get_lang('Modify'), false, 'width="130"'); $table->set_column_filter(8, 'anonymous_filter'); $table->set_column_filter(9, 'modify_filter_for_coach'); $table->display(); }
Display::display_header($nameTools, 'Doc'); Display::display_error_message(get_lang('Impossible')); Display::display_footer(); } } else { // Interbreadcrumb for the current directory root path // Copied from document.php $dir_array = explode('/', $dir); $array_len = count($dir_array); // Interbreadcrumb for the current directory root path if (empty($document_data['parents'])) { $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); } else { foreach ($document_data['parents'] as $document_sub_data) { $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); } } $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools); Display::display_header($nameTools, "Doc"); if ($is_certificate_mode) { $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id()); $str_info = ''; foreach ($all_information_by_create_certificate[0] as $info_value) { $str_info .= $info_value . '<br/>'; } $create_certificate = get_lang('CreateCertificateWithTags'); Display::display_normal_message($create_certificate . ': <br /><br/>' . $str_info, false); } echo $form->return_form(); Display::display_footer(); }
$attempt_count = Event::get_attempt_count(api_get_user_id(), $objExercise->id, $learnpath_id, $learnpath_item_id, $learnpath_item_view_id); if ($attempt_count >= $objExercise->selectAttempts()) { Display::display_warning_message(sprintf(get_lang('ReachedMaxAttempts'), $objExercise->selectTitle(), $objExercise->selectAttempts()), false); if ($origin != 'learnpath') { //we are not in learnpath tool Display::display_footer(); } exit; } } $total_score = 0; if (!empty($exercise_stat_info)) { $total_score = $exercise_stat_info['exe_result']; } $max_score = $objExercise->get_max_score(); Display::display_normal_message(get_lang('Saved') . '<br />', false); // Display and save questions ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true); //Unset session for clock time ExerciseLib::exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id); ExerciseLib::delete_chat_exercise_session($exe_id); if ($origin != 'learnpath') { echo '<hr>'; echo Display::url(get_lang('ReturnToCourseHomepage'), api_get_course_url(), array('class' => 'btn btn-primary')); if (api_is_allowed_to_session_edit()) { Session::erase('objExercise'); Session::erase('exe_id'); } Display::display_footer(); } else { $lp_mode = Session::read('lp_mode');
if ($access_url_id != -1) { $url = api_get_access_url($access_url_id); $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('SignatureFormula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } } else { $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('SignatureFormula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } @api_mail_html($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin); }*/ Security::clear_token(); $tok = Security::get_token(); header('Location: group_list.php?action=show_message&message=' . urlencode(get_lang('GroupAdded')) . '&sec_token=' . $tok); exit; } } else { if (isset($_POST['submit'])) { Security::clear_token(); } $token = Security::get_token(); $form->addElement('hidden', 'sec_token'); $form->setConstants(array('sec_token' => $token)); } // Display form Display::display_header($tool_name); if (!empty($message)) { Display::display_normal_message(stripslashes($message)); } $form->display(); // Footer Display::display_footer();
$_SESSION['session_message_import_skills'] = $warning_message; $warning_message = 'session_message'; } if ($error_kind_file) { $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); } else { //header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skills_import.php?action=show_message&warn='.urlencode($warning_message).'&message='.urlencode($see_message_import).'&sec_token='.$tok); //exit; } } Display::display_header($tool_name); if (!empty($error_message)) { Display::display_error_message($error_message); } if (!empty($see_message_import)) { Display::display_normal_message($see_message_import); } $form = new FormValidator('user_import', 'post', 'skills_import.php'); $form->addElement('header', '', $tool_name); $form->addElement('hidden', 'formSent'); $form->addElement('file', 'import_file', get_lang('ImportFileLocation')); $group = array(); $group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="skill_example.csv" target="_blank">' . get_lang('ExampleCSVFile') . '</a>)', 'csv'); //$group[] = $form->createElement('radio', 'file_type', null, 'XML (<a href="skill_example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml'); $form->addGroup($group, '', get_lang('FileType'), '<br/>'); $form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"'); $defaults['formSent'] = 1; $defaults['sendMail'] = 0; $defaults['file_type'] = 'csv'; $form->setDefaults($defaults); $form->display();
foreach ($classes as $class_id) { ClassManager::unsubscribe_from_course($class_id, $course_code); } } Display::display_normal_message(get_lang('ClassesUnSubscribed')); } } } $sql = "SELECT id,name FROM {$tbl_class} WHERE name LIKE '" . $first_letter_class . "%' ORDER BY " . (count($classes) > 0 ? "(id IN('" . implode("','", $classes) . "')) DESC," : "") . " name"; $result = Database::query($sql); $db_classes = Database::store_result($result); $sql = "SELECT code,visual_code,title FROM {$tbl_course} WHERE visual_code LIKE '" . $first_letter_course . "%' ORDER BY " . (count($courses) > 0 ? "(code IN('" . implode("','", $courses) . "')) DESC," : "") . " visual_code"; $result = Database::query($sql); $db_courses = Database::store_result($result); if (!empty($error_message)) { Display::display_normal_message($error_message); } ?> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?> " style="margin:0px;"> <input type="hidden" name="formSent" value="1"/> <table border="0" cellpadding="5" cellspacing="0" width="100%"> <tr> <td width="40%" align="center"> <b><?php echo get_lang('ClassList'); ?> </b> <br/><br/>
} // Displaying the header Display::display_header($nameTools); $result = ''; if (count($output) > 0) { $result = '<div class="filler-report">' . "\n"; $result .= '<h3>' . $output[0]['title'] . '</h3>' . "\n"; $result .= '<table>'; foreach ($output as $line) { $result .= '<tr>'; $result .= '<td class="filler-report-data-init">' . $line['line-init'] . ' </td><td class="filler-report-data">' . $line['line-info'] . '</td>'; $result .= '</tr>'; } $result .= '</table>'; $result .= '</div>'; Display::display_normal_message($result, false); } ?> <div id="datafiller" class="actions"> <h4><?php echo Display::return_icon('bug.png', get_lang('DataFiller'), null, ICON_SIZE_MEDIUM) . ' ' . get_lang('DataFiller'); ?> </h4> <div class="description"><?php echo get_lang('ThisSectionIsOnlyVisibleOnSourceInstalls'); ?> </div> <ul class="fillers"> <li><a href="filler.php?fill=users"><?php echo Display::return_icon('user.png', get_lang('FillUsers'), null, ICON_SIZE_SMALL) . ' ' . get_lang('FillUsers'); ?>
?> " type="text" id="audio_title"><br/> <button type="button" value="" onclick="setupRecorder()" id="audio_button" /><?php echo get_lang('Activate'); ?> </button> <button type="button" value="" onclick="newNameRecord()" id="new_name" /><?php echo get_lang('Reload'); ?> </button> <?php echo Display::return_icon('info3.gif', get_lang('WamiNeedFilename') . ' ' . get_lang('WamiFlashDialog'), array('align' => 'absmiddle', 'hspace' => '3px'), false); ?> </form> </div> <div align="center" id="audio_message_1" style="display:inline"> <?php Display::display_normal_message(get_lang('WamiNeedFilename') . ' ' . get_lang('WamiStartRecorder'), false); ?> </div> <script> if (navigator.appName == 'Microsoft Internet Explorer') { document.getElementById('wami').style.marginLeft='400px'; }else{ document.getElementById('wami').style.marginLeft='510px'; } </script> <?php Display::display_footer();
//include needed librabries for treatment $result_log = import_exercise($_FILES['uploadedExercise']['name']); //display the result message (fail or success) $dialogBox = ''; foreach ($result_log as $log) { $dialogBox .= $log . '<br>'; } break; } //---------------------------------- // FIND INFORMATION //---------------------------------- //empty! //---------------------------------- // DISPLAY //---------------------------------- include api_get_path(INCLUDE_PATH) . '/header.inc.php'; //display title // Tool introduction // TODO: These settings to be checked when it is possible. Display::display_introduction_section(TOOL_QUIZ, array('CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/', 'CreateDocumentDir' => '../../../courses/' . api_get_course_path() . '/document/', 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/')); //Display Forms or dialog box(if needed) if (isset($dialogBox)) { echo Display::display_normal_message($dialogBox, false); } //display content if (isset($display)) { echo $display; } //footer display include api_get_path(INCLUDE_PATH) . '/footer.inc.php';
/** * * @param int student id * @param int years * @param bool show warning_message * @param bool return_timestamp */ public static function delete_inactive_student($student_id, $years = 2, $warning_message = false, $return_timestamp = false) { $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); $sql = 'SELECT login_date FROM ' . $tbl_track_login . ' WHERE login_user_id = ' . intval($student_id) . ' ORDER BY login_date DESC LIMIT 0,1'; if (empty($years)) { $years = 1; } $inactive_time = $years * 31536000; //1 year $rs = Database::query($sql); if (Database::num_rows($rs) > 0) { if ($last_login_date = Database::result($rs, 0, 0)) { $last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get()); if ($return_timestamp) { return api_strtotime($last_login_date); } else { if (!$warning_message) { return api_format_date($last_login_date, DATE_FORMAT_SHORT); } else { $timestamp = api_strtotime($last_login_date); $currentTimestamp = time(); //If the last connection is > than 7 days, the text is red //345600 = 7 days in seconds 63072000= 2 ans // if ($currentTimestamp - $timestamp > 184590 ) if ($currentTimestamp - $timestamp > $inactive_time && UserManager::delete_user($student_id)) { Display::display_normal_message(get_lang('UserDeleted')); echo '<p>', 'id', $student_id, ':', $last_login_date, '</p>'; } } } } } return false; }
/** * Function that displays a list with al the resources that could be added to the learning path * @return string */ public function display_resources() { $_course = api_get_course_info(); // TODO: Don't use globals. $course_code = api_get_course_id(); //Get all the docs $documents = $this->get_documents(); //Get all the exercises $exercises = $this->get_exercises(); // Get all the links $links = $this->get_links(); //Get al the student publications $works = $this->get_student_publications(); //Get al the forums $forums = $this->get_forums(null, $course_code); $headers = array(Display::return_icon('folder_document.png', get_lang('Documents'), array(), 64), Display::return_icon('quiz.png', get_lang('Quiz'), array(), 64), Display::return_icon('links.png', get_lang('Links'), array(), 64), Display::return_icon('works.png', get_lang('Works'), array(), 64), Display::return_icon('forum.png', get_lang('Forums'), array(), 64), Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array(), 64)); echo Display::display_normal_message(get_lang('ClickOnTheLearnerViewToSeeYourLearningPath')); $chapter = $_SESSION['oLP']->display_item_form('chapter', get_lang('EnterDataNewChapter'), 'add_item'); echo Display::tabs($headers, array($documents, $exercises, $links, $works, $forums, $chapter), 'resource_tab'); return true; }
Display::display_normal_message($error_message, false); } $form = new FormValidator('import_sessions', 'post', api_get_self(), null, array('enctype' => 'multipart/form-data')); $form->addElement('hidden', 'formSent', 1); $form->addElement('file', 'import_file', get_lang('ImportFileLocation')); $form->addElement('radio', 'file_type', array(get_lang('FileType'), '<a href="example_session.csv" target="_blank">' . get_lang('ExampleCSVFile') . '</a>'), 'CSV', 'csv'); $form->addElement('radio', 'file_type', array(null, '<a href="example_session.xml" target="_blank">' . get_lang('ExampleXMLFile') . '</a>'), 'XML', 'xml'); $form->addElement('checkbox', 'overwrite', null, get_lang('IfSessionExistsUpdate')); $form->addElement('checkbox', 'delete_users_not_in_list', null, get_lang('DeleteUsersNotInList')); $form->addElement('checkbox', 'update_course_coaches', null, get_lang('CleanAndUpdateCourseCoaches')); $form->addElement('checkbox', 'add_me_as_coach', null, get_lang('AddMeAsCoach')); $form->addElement('checkbox', 'sendMail', null, get_lang('SendMailToUsers')); $form->addElement('button', 'submit', get_lang('ImportSession')); $defaults = array('sendMail' => 'true', 'file_type' => 'csv'); $form->setDefaults($defaults); Display::display_normal_message(get_lang('TheXMLImportLetYouAddMoreInfoAndCreateResources')); $form->display(); ?> <p><?php echo get_lang('CSVMustLookLike') . ' (' . get_lang('MandatoryFields') . ')'; ?> :</p> <blockquote> <pre> <strong>SessionName</strong>;Coach;<strong>DateStart</strong>;<strong>DateEnd</strong>;Users;Courses;VisibilityAfterExpiration <strong>Example 1</strong>;username;<strong>yyyy/mm/dd;yyyy/mm/dd</strong>;username1|username2;course1[coach1][username1,username2,...]|course2[coach1][username1,username2,...];read_only <strong>Example 2</strong>;username;<strong>yyyy/mm/dd;yyyy/mm/dd</strong>;username1|username2;course1[coach1][username1,username2,...]|course2[coach1][username1,username2,...];accessible <strong>Example 3</strong>;username;<strong>yyyy/mm/dd;yyyy/mm/dd</strong>;username1|username2;course1[coach1][username1,username2,...]|course2[coach1][username1,username2,...];not_accessible </pre> </blockquote> <p><?php
} </script> <?php /* DISPLAY SECTION */ echo $_SESSION['oLP']->build_action_menu(); echo '<div class="row-fluid">'; echo '<div class="span4">'; // Build the tree with the menu items in it. echo $_SESSION['oLP']->return_new_tree(); echo '</div>'; echo '<div class="span8">'; if (isset($is_success) && $is_success === true) { Display::display_confirmation_message(get_lang('ItemRemoved')); } else { if ($is_new) { Display::display_normal_message(get_lang('LearnpathAdded'), false); } // Display::display_normal_message(get_lang('LPCreatedAddChapterStep'), false); $gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null; echo Display::page_subheader(get_lang('LearnPathAddedTitle')); echo '<ul id="lp_overview" class="thumbnails">'; echo show_block('lp_controller.php?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=add_item&type=step&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png'); // echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=admin_view&updateaudio=true&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("BasicOverview"), get_lang('BasicOverviewComment'), 'audio.png'); echo show_block('lp_controller.php?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png'); //echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Settings"), null, 'reference.png'); echo '</ul>'; } echo '</div>'; echo '</div>'; function show_block($link, $title, $subtitle, $icon) {
/** * Display the exercise results * @param Exercise $objExercise * @param int $exe_id * @param bool $save_user_result save users results (true) or just show the results (false) */ public static function display_question_list_by_attempt($objExercise, $exe_id, $save_user_result = false) { global $origin; // Getting attempt info $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); // Getting question list $question_list = array(); if (!empty($exercise_stat_info['data_tracking'])) { $question_list = explode(',', $exercise_stat_info['data_tracking']); } else { // Try getting the question list only if save result is off if ($save_user_result == false) { $question_list = $objExercise->get_validated_question_list(); } } $counter = 1; $total_score = $total_weight = 0; $exercise_content = null; // Hide results $show_results = false; $show_only_score = false; if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS) { $show_results = true; } if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) { $show_only_score = true; } // Not display expected answer, but score, and feedback $show_all_but_expected_answer = false; if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) { $show_all_but_expected_answer = true; $show_results = true; $show_only_score = false; } if ($show_results || $show_only_score) { $user_info = api_get_user_info($exercise_stat_info['exe_user_id']); //Shows exercise header echo $objExercise->show_exercise_result_header($user_info, api_convert_and_format_date($exercise_stat_info['start_date'], DATE_TIME_FORMAT_LONG), $exercise_stat_info['duration'], $exercise_stat_info['user_ip']); } // Display text when test is finished #4074 and for LP #4227 $end_of_message = $objExercise->selectTextWhenFinished(); if (!empty($end_of_message)) { Display::display_normal_message($end_of_message, false); echo "<div class='clear'> </div>"; } $question_list_answers = array(); $media_list = array(); $category_list = array(); // Loop over all question to show results for each of them, one by one if (!empty($question_list)) { foreach ($question_list as $questionId) { // creates a temporary Question object $objQuestionTmp = Question::read($questionId); // This variable came from exercise_submit_modal.php ob_start(); // We're inside *one* question. Go through each possible answer for this question $result = $objExercise->manage_answer($exercise_stat_info['exe_id'], $questionId, null, 'exercise_result', array(), $save_user_result, true, $show_results, $objExercise->selectPropagateNeg(), array()); if (empty($result)) { continue; } // In case of global score, make sure the calculated total score is integer /*if (!is_int($result['score'])) { $result['score'] = round($result['score']); }*/ $total_score += $result['score']; $total_weight += $result['weight']; $question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer'], 'answer_type' => $result['answer_type']); $my_total_score = $result['score']; $my_total_weight = $result['weight']; // Category report $category_was_added_for_this_test = false; if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) { if (!isset($category_list[$objQuestionTmp->category]['score'])) { $category_list[$objQuestionTmp->category]['score'] = 0; } if (!isset($category_list[$objQuestionTmp->category]['total'])) { $category_list[$objQuestionTmp->category]['total'] = 0; } $category_list[$objQuestionTmp->category]['score'] += $my_total_score; $category_list[$objQuestionTmp->category]['total'] += $my_total_weight; $category_was_added_for_this_test = true; } if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { foreach ($objQuestionTmp->category_list as $category_id) { $category_list[$category_id]['score'] += $my_total_score; $category_list[$category_id]['total'] += $my_total_weight; $category_was_added_for_this_test = true; } } // No category for this question! if ($category_was_added_for_this_test == false) { if (!isset($category_list['none']['score'])) { $category_list['none']['score'] = 0; } if (!isset($category_list['none']['total'])) { $category_list['none']['total'] = 0; } $category_list['none']['score'] += $my_total_score; $category_list['none']['total'] += $my_total_weight; } if ($objExercise->selectPropagateNeg() == 0 && $my_total_score < 0) { $my_total_score = 0; } $comnt = null; if ($show_results) { $comnt = Event::get_comments($exe_id, $questionId); if (!empty($comnt)) { echo '<b>' . get_lang('Feedback') . '</b>'; echo '<div id="question_feedback">' . $comnt . '</div>'; } } if ($show_results) { $score = array('result' => get_lang('Score') . " : " . self::show_score($my_total_score, $my_total_weight, false, true), 'pass' => $my_total_score >= $my_total_weight ? true : false, 'score' => $my_total_score, 'weight' => $my_total_weight, 'comments' => $comnt); } else { $score = array(); } $contents = ob_get_clean(); $question_content = ''; if ($show_results) { $question_content = '<div class="question_row_answer">'; $show_media = false; /*if ($objQuestionTmp->parent_id != 0 && !in_array($objQuestionTmp->parent_id, $media_list)) { $show_media = true; $media_list[] = $objQuestionTmp->parent_id; }*/ //Shows question title an description $question_content .= $objQuestionTmp->return_header(null, $counter, $score); } $counter++; $question_content .= $contents; if ($show_results) { $question_content .= '</div>'; } $exercise_content .= $question_content; } // end foreach() block that loops over all questions } $total_score_text = null; if ($origin != 'learnpath') { if ($show_results || $show_only_score) { $total_score_text .= '<div class="question_row_score">'; $total_score_text .= self::get_question_ribbon($objExercise, $total_score, $total_weight, true); $total_score_text .= '</div>'; } } if (!empty($category_list) && ($show_results || $show_only_score)) { //Adding total $category_list['total'] = array('score' => $total_score, 'total' => $total_weight); echo TestCategory::get_stats_table_by_attempt($objExercise->id, $category_list); } if ($show_all_but_expected_answer) { $exercise_content .= "<div class='normal-message'>" . get_lang("ExerciseWithFeedbackWithoutCorrectionComment") . "</div>"; } // Remove audio auto play from questions on results page - refs BT#7939 $exercise_content = preg_replace(['/autoplay[\\=\\".+\\"]+/', '/autostart[\\=\\".+\\"]+/'], '', $exercise_content); echo $total_score_text; echo $exercise_content; if (!$show_only_score) { echo $total_score_text; } if ($save_user_result) { // Tracking of results $learnpath_id = $exercise_stat_info['orig_lp_id']; $learnpath_item_id = $exercise_stat_info['orig_lp_item_id']; $learnpath_item_view_id = $exercise_stat_info['orig_lp_item_view_id']; if (api_is_allowed_to_session_edit()) { Event::update_event_exercice($exercise_stat_info['exe_id'], $objExercise->selectId(), $total_score, $total_weight, api_get_session_id(), $learnpath_id, $learnpath_item_id, $learnpath_item_view_id, $exercise_stat_info['exe_duration'], $question_list, '', array()); } // Send notification .. if (!api_is_allowed_to_edit(null, true) && !api_is_excluded_user_type()) { if (api_get_course_setting('email_alert_manager_on_new_quiz') == 1) { $objExercise->send_mail_notification_for_exam($question_list_answers, $origin, $exe_id); } $objExercise->send_notification_for_open_questions($question_list_answers, $origin, $exe_id); $objExercise->send_notification_for_oral_questions($question_list_answers, $origin, $exe_id); } } }
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?> ?user=<?php echo $user_id; ?> " style="margin:0px;" <?php if ($ajax_search) { echo ' onsubmit="valide();"'; } ?> > <input type="hidden" name="formSent" value="1" /> <?php if (!empty($msg)) { Display::display_normal_message($msg); //main API } ?> <table border="0" cellpadding="5" cellspacing="0" width="100%" align="center"> <tr> <td align="left"></td> <td align="left"></td> <td width="" align="center"> </td> </tr> <tr> <td width="45%" align="center"><b><?php echo get_lang('SessionsListInPlatform'); ?> :</b></td> <td width="10%"> </td>
//select of sessions $sql = "SELECT id, name FROM {$tbl_session} ORDER BY name"; if (api_is_multiple_url_enabled()) { $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $sql = "SELECT s.id, name FROM {$tbl_session} s\n\t\t\tINNER JOIN {$tbl_session_rel_access_url} as session_rel_url\n\t\t\tON (s.id = session_rel_url.session_id)\n\t\t\tWHERE access_url_id = {$access_url_id}\n\t\t\tORDER BY name"; } } $result = Database::query($sql); $Sessions = Database::store_result($result); echo '<div class="actions">'; echo '<a href="../session/session_list.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('SessionList'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; if (!empty($errorMsg)) { Display::display_normal_message($errorMsg, false); //main API } $form = new FormValidator('session_export', 'post', api_get_self()); $form->addElement('hidden', 'formSent', 1); $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null); $form->addElement('radio', 'file_type', '', 'XLS', 'xls', null); $form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml')); $options = array(); $options['0'] = get_lang('AllSessions'); foreach ($Sessions as $enreg) { $options[$enreg['id']] = $enreg['name']; } $form->addElement('select', 'session_id', get_lang('WhichSessionToExport'), $options); $form->addButtonExport(get_lang('ExportSession')); $defaults = array();
/** * Updates an announcement to the database * @param integer $id : id of the announcement * @param string $title : title of the announcement * @param string $content : content of the announcement * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) * @return bool True on success, false on failure */ public static function update_announcement($id, $title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0, $lang = null, $send_mail = 0, $sendEmailTest = false) { $a_dateS = explode(' ', $date_start); $a_arraySD = explode('-', $a_dateS[0]); $a_arraySH = explode(':', $a_dateS[1]); $date_start_to_compare = array_merge($a_arraySD, $a_arraySH); $a_dateE = explode(' ', $date_end); $a_arrayED = explode('-', $a_dateE[0]); $a_arrayEH = explode(':', $a_dateE[1]); $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH); $langsql = is_null($lang) ? 'NULL' : "'" . Database::escape_string($lang) . "'"; $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) { Display::display_normal_message(get_lang('InvalidStartDate')); return false; } if (($date_end_to_compare[1] || $date_end_to_compare[2] || $date_end_to_compare[0]) && !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])) { Display::display_normal_message(get_lang('InvalidEndDate')); return false; } if (strlen(trim($title)) == 0) { Display::display_normal_message(get_lang('InvalidTitle')); return false; } $start = api_get_utc_datetime($date_start); $end = api_get_utc_datetime($date_end); $title = Database::escape_string($title); $content = Database::escape_string($content); //Fixing urls that are sent by email $content = str_replace('src=\\"/home/', 'src=\\"' . api_get_path(WEB_PATH) . 'home/', $content); $content = str_replace('file=/home/', 'file=' . api_get_path(WEB_PATH) . 'home/', $content); $id = intval($id); $sql = "UPDATE " . $db_table . " SET lang={$langsql},title='" . $title . "',content='" . $content . "',date_start='" . $start . "',date_end='" . $end . "', "; $sql .= " visible_teacher = '" . $visible_teacher . "', visible_student = '" . $visible_student . "', visible_guest = '" . $visible_guest . "' , access_url_id = '" . api_get_current_access_url_id() . "' WHERE id = " . $id; if ($sendEmailTest) { SystemAnnouncementManager::send_system_announcement_by_email($title, $content, null, null, $lang, $sendEmailTest); } else { if ($send_mail == 1) { SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang); } } $res = Database::query($sql); if ($res === false) { return false; } return true; }
/** * function which redefines Question::createAnswersForm * @param FormValidator $form */ public function createAnswersForm($form) { $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0); $obj_ex = Session::read('objExercise'); /* Mise en variable de Affichage "Reponses" et son icone, "N�", "Vrai", "Reponse" */ $html = '<table class="data_table"> <tr> <th width="10px"> ' . get_lang('Number') . ' </th> <th width="10px"> ' . get_lang('True') . ' </th> <th width="50%"> ' . get_lang('Answer') . ' </th>'; $html .= '<th>' . get_lang('Comment') . '</th>'; $html .= '</tr>'; $form->addElement('label', get_lang('Answers') . '<br /> <img src="../img/fill_field.png">', $html); $defaults = array(); $correct = 0; $answer = false; if (!empty($this->id)) { $answer = new Answer($this->id); $answer->read(); if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { $nb_answers = $answer->nbrAnswers; } } #le nombre de r�ponses est bien enregistr� sous la forme int(nb) /* Ajout mise en forme nb reponse */ $form->addElement('hidden', 'nb_answers'); $boxes_names = array(); /* V�rification : Cr�action d'au moins une r�ponse */ if ($nb_answers < 1) { $nb_answers = 1; Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } //D�but affichage score global dans la modification d'une question $scoreA = "0"; //par reponse $scoreG = "0"; //Global /* boucle pour sauvegarder les donn�es dans le tableau defaults */ for ($i = 1; $i <= $nb_answers; ++$i) { /* si la reponse est de type objet */ if (is_object($answer)) { $defaults['answer[' . $i . ']'] = $answer->answer[$i]; $defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['correct[' . $i . ']'] = $answer->correct[$i]; // start $scoreA = $answer->weighting[$i]; } if ($scoreA > 0) { $scoreG = $scoreG + $scoreA; } //------------- Fin //------------- Debut si un des scores par reponse est egal � 0 : la coche vaut 1 (coch�) if ($scoreA == 0) { $defaults['pts'] = 1; } $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment[' . $i . ']'); //$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']'); $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); $answer_number->freeze(); $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); $boxes_names[] = 'correct[' . $i . ']'; $form->addHtmlEditor('answer[' . $i . ']', null, null, array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); $form->addHtmlEditor('comment[' . $i . ']', null, null, array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); $form->addElement('html', '</tr>'); } //--------- Mise en variable du score global lors d'une modification de la question/r�ponse $defaults['weighting[1]'] = round($scoreG); $form->addElement('html', '</div></div></table>'); //$form -> addElement ('html', '<br />'); $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required'); //only 1 answer the all deal ... $form->addElement('text', 'weighting[1]', get_lang('Score')); global $pts; //--------- Creation coche pour ne pas prendre en compte les n�gatifs $form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore')); $form->addElement('html', '<br />'); // Affiche un message si le score n'est pas renseign� $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required'); global $text, $class; if ($obj_ex->edit_exercise_in_lp == true) { $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers'); $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers'); $form->addButtonSave($text, 'submitQuestion'); // setting the save button here and not in the question class.php } $renderer->setElementTemplate('{element} ', 'lessAnswers'); $renderer->setElementTemplate('{element} ', 'submitQuestion'); $renderer->setElementTemplate('{element}', 'moreAnswers'); $form->addElement('html', '</div></div>'); $defaults['correct'] = $correct; if (!empty($this->id)) { $form->setDefaults($defaults); } else { if ($this->isContent == 1) { $form->setDefaults($defaults); } } $form->setConstants(array('nb_answers' => $nb_answers)); }
header('Location: user_fields.php?action=show_message&message=' . urlencode(get_lang('FieldAdded'))); exit; } } else { if (isset($_POST['submit'])) { Security::clear_token(); } $token = Security::get_token(); $form->addElement('hidden', 'sec_token'); $form->setConstants(array('sec_token' => $token)); } // Display form Display::display_header($tool_name); //api_display_tool_title($tool_name); if (!empty($_GET['message'])) { Display::display_normal_message($_GET['message']); } //else //{ //Display::display_normal_message(get_lang('UserFieldsAddHelp'),false); //} $form->display(); echo '<div id="id_image_user_field">'; if (!empty($defaults['fieldtype'])) { $image_value = $defaults['fieldtype']; if ($image_value == 1) { echo '<br />' . Display::return_icon('userfield_text.png', get_lang('AddUserFields')); } else { if ($image_value == 2) { echo '<br />' . Display::return_icon('userfield_text_area.png', get_lang('AddUserFields')); } else {
} elseif ($action == 'thematic_details') { if (isset($_GET['thematic_plan_save_message']) && $_GET['thematic_plan_save_message'] == 'ok') { Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull')); } if (isset($last_id) && $last_id) { $link_to_thematic_plan = '<a href="index.php?' . api_get_cidreq() . '&action=thematic_plan_list&thematic_id=' . $last_id . '">' . Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL) . '</a>'; $link_to_thematic_advance = '<a href="index.php?' . api_get_cidreq() . '&action=thematic_advance_list&thematic_id=' . $last_id . '">' . Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL) . '</a>'; Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull') . '<br />' . sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'), $link_to_thematic_plan, $link_to_thematic_advance), false); } // display title if (!empty($thematic_id)) { } else { // display information $message = '<strong>' . get_lang('Information') . '</strong><br />'; $message .= get_lang('ThematicDetailsDescription'); Display::display_normal_message($message, false); echo '<br />'; } // Display thematic data if (!empty($thematic_data)) { // display progress echo '<div style="text-align:right;"><h2>' . get_lang('Progress') . ': <span id="div_result">' . $total_average_of_advances . '</span> %</h2></div>'; echo '<table width="100%" class="data_table">'; echo '<tr><th width="33%">' . get_lang('Thematic') . '</th><th>' . get_lang('ThematicPlan') . '</th><th width="33%">' . get_lang('ThematicAdvance') . '</th></tr>'; foreach ($thematic_data as $thematic) { $my_thematic_id = $thematic['id']; $session_star = ''; if (api_is_allowed_to_edit(null, true)) { if (api_get_session_id() == $thematic['session_id']) { $session_star = api_get_session_image(api_get_session_id(), $user_info['status']); }
<a href="courseLog.php?' . api_get_cidreq() . '&studentlist=true">' . get_lang('StudentsTracking') . '</a> | <a href="courseLog.php?' . api_get_cidreq() . '&studentlist=false">' . get_lang('CourseTracking') . '</a> '; echo '</div>'; } echo '</div>'; if (api_is_platform_admin()) { echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=coaches">' . get_lang('DisplayCoaches') . '</a> | '; echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=useroverview">' . get_lang('DisplayUserOverview') . '</a>'; echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=sessionoverview">' . get_lang('DisplaySessionOverview') . '</a>'; echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=courseoverview">' . get_lang('DisplayCourseOverview') . '</a>'; echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'tracking/question_course_report.php?view=admin">' . get_lang('LPQuestionListResults') . '</a>'; echo ' | ' . get_lang('LPExerciseResultsBySession') . ''; } echo '<h2>' . get_lang('LPExerciseResultsBySession') . '</h2>'; $form->display(); Display::display_normal_message(get_lang('StudentScoreAverageIsCalculatedBaseInAllLPsAndAllAttempts')); } $users = SessionManager::get_users_by_session($session_id); $course_average = $course_average_counter = array(); $counter = 0; $main_result = array(); //Getting course list foreach ($course_list as $current_course) { $course_info = api_get_course_info($current_course['code']); $_course = $course_info; $attempt_result = array(); //Getting LP list $list = new LearnpathList('', $current_course['code'], $session_id); $lp_list = $list->get_flat_list(); // Looping LPs foreach ($lp_list as $lp_id => $lp) {
$id = (int) $_GET['id']; if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) { // a coach can only delete an element belonging to his session showhide_agenda_item($id); } display_agenda_items(); break; case "announce": //copying the agenda item into an announcement $id = (int) $_GET['id']; if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) { // a coach can only delete an element belonging to his session $ann_id = store_agenda_item_as_announcement($id); $tool_group_link = isset($_SESSION['toolgroup']) ? '&toolgroup=' . $_SESSION['toolgroup'] : ''; echo '<br />'; Display::display_normal_message(get_lang('CopiedAsAnnouncement') . '<a href="../announcements/announcements.php?id=' . $ann_id . $tool_group_link . '">' . get_lang('NewAnnouncement') . '</a>', false); } display_agenda_items(); break; case "delete_attach": //delete attachment file $id_attach = (int) $_GET['id_attach']; if (!empty($id_attach)) { delete_attachment_file($id_attach); } display_agenda_items(); break; } } // this is for students and whenever the courseaministrator has not chosen any action. It is in fact the default behaviour if (!$_GET['action'] or $_GET['action'] == "showall" or $_GET['action'] == "showcurrent" or $_GET['action'] == "view") {
$userid = Security::remove_XSS($_GET['userid']); } else { $userid = ''; } if ($showeval) { $alleval = $cat[0]->get_evaluations($userid, true); } else { $alleval = null; } if ($showlink) { $alllinks = $cat[0]->get_links($userid, true); } else { $alllinks = null; } if (isset($export_flatview_form) && !$file_type == 'pdf') { Display::display_normal_message($export_flatview_form->toHtml(), false); } if (isset($_GET['selectcat'])) { $category_id = Security::remove_XSS($_GET['selectcat']); } else { $category_id = ''; } $simple_search_form = new UserForm(UserForm::TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' . $category_id); $values = $simple_search_form->exportValues(); $keyword = ''; if (isset($_GET['search']) && !empty($_GET['search'])) { $keyword = Security::remove_XSS($_GET['search']); } if ($simple_search_form->validate() && empty($keyword)) { $keyword = $values['keyword']; }
/** * function which redifines Question::createAnswersForm * @param the formvalidator instance * @param the answers number to display */ function createAnswersForm($form) { $editorConfig = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125'); $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0); $obj_ex = $_SESSION['objExercise']; $form->addHeader(get_lang('Answers')); $html = '<table class="table table-striped table-hover"> <thead> <tr> <th width="10">' . get_lang('Number') . '</th> <th width="10">' . get_lang('True') . '</th> <th width="50%">' . get_lang('Answer') . '</th> <th width="50%">' . get_lang('Comment') . '</th> <th width="10">' . get_lang('Weighting') . '</th> </tr> </thead> <tbody>'; $form->addHtml($html); $defaults = array(); $correct = 0; $answer = false; if (!empty($this->id)) { $answer = new Answer($this->id); $answer->read(); if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { $nb_answers = $answer->nbrAnswers; } } $form->addElement('hidden', 'nb_answers'); $boxes_names = array(); if ($nb_answers < 1) { $nb_answers = 1; Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } for ($i = 1; $i <= $nb_answers; ++$i) { $form->addHtml('<tr>'); if (is_object($answer)) { $defaults['answer[' . $i . ']'] = $answer->answer[$i]; $defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); $defaults['correct[' . $i . ']'] = $answer->correct[$i]; } else { $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); $defaults['correct[1]'] = true; $defaults['weighting[1]'] = 10; $defaults['answer[2]'] = get_lang('DefaultMultipleAnswer1'); $defaults['comment[2]'] = get_lang('DefaultMultipleComment1'); $defaults['correct[2]'] = false; $defaults['weighting[2]'] = -5; } $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting[' . $i . ']'); $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); $answer_number->freeze(); $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox" style="margin-left: 0em;"'); $boxes_names[] = 'correct[' . $i . ']'; $form->addHtmlEditor("answer[{$i}]", null, null, true, $editorConfig); $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); $form->addHtmlEditor("comment[{$i}]", null, null, true, $editorConfig); $form->addElement('text', 'weighting[' . $i . ']', null, array('class' => "col-md-1", 'value' => '0')); $form->addHtml('</tr>'); } $form->addHtml('</tbody>'); $form->addHtml('</table>'); $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required'); $buttonGroup = []; global $text, $class; if ($obj_ex->edit_exercise_in_lp == true) { // setting the save button here and not in the question class.php $buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true); $buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true); $buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true); } $form->addGroup($buttonGroup); $defaults['correct'] = $correct; if (!empty($this->id)) { $form->setDefaults($defaults); } else { if ($this->isContent == 1) { $form->setDefaults($defaults); } } $form->setConstants(array('nb_answers' => $nb_answers)); }
/** * function which redefines Question::createAnswersForm * @param FormValidator $form */ public function createAnswersForm($form) { // Getting the exercise list $obj_ex = $_SESSION['objExercise']; $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125'); //this line defines how many questions by default appear when creating a choice question // The previous default value was 2. See task #1759. $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 4; $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0); /* Types of Feedback $feedback_option[0]=get_lang('Feedback'); $feedback_option[1]=get_lang('DirectFeedback'); $feedback_option[2]=get_lang('NoFeedback'); */ $feedback_title = ''; if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { //Scenario $editor_config['Width'] = '250'; $editor_config['Height'] = '110'; $comment_title = '<th width="500px" >' . get_lang('Comment') . '</th>'; $feedback_title = '<th width="350px" >' . get_lang('Scenario') . '</th>'; } else { $comment_title = '<th>' . get_lang('Comment') . '</th>'; } $html = '<table class="data_table"> <tr style="text-align: center;"> <th width="10px"> ' . get_lang('Number') . ' </th> <th width="10px" > ' . get_lang('True') . ' </th> <th width="50%"> ' . get_lang('Answer') . ' </th> ' . $comment_title . ' ' . $feedback_title . ' <th width="50px"> ' . get_lang('Weighting') . ' </th> </tr>'; $form->addElement('label', get_lang('Answers') . '<br /> <img src="../img/fill_field.png">', $html); $defaults = array(); $correct = 0; if (!empty($this->id)) { $answer = new Answer($this->id); $answer->read(); if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { $nb_answers = $answer->nbrAnswers; } } $form->addElement('hidden', 'nb_answers'); //Feedback SELECT $question_list = $obj_ex->selectQuestionList(); $select_question = array(); $select_question[0] = get_lang('SelectTargetQuestion'); require_once '../newscorm/learnpathList.class.php'; if (is_array($question_list)) { foreach ($question_list as $key => $questionid) { //To avoid warning messages if (!is_numeric($questionid)) { continue; } $question = Question::read($questionid); $select_question[$questionid] = 'Q' . $key . ' :' . cut($question->selectTitle(), 20); } } $select_question[-1] = get_lang('ExitTest'); $list = new LearnpathList(api_get_user_id()); $flat_list = $list->get_flat_list(); $select_lp_id = array(); $select_lp_id[0] = get_lang('SelectTargetLP'); foreach ($flat_list as $id => $details) { $select_lp_id[$id] = cut($details['lp_name'], 20); } $temp_scenario = array(); if ($nb_answers < 1) { $nb_answers = 1; Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } for ($i = 1; $i <= $nb_answers; ++$i) { $form->addElement('html', '<tr>'); if (isset($answer) && is_object($answer)) { if ($answer->correct[$i]) { $correct = $i; } $defaults['answer[' . $i . ']'] = $answer->answer[$i]; $defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); $item_list = explode('@@', $answer->destination[$i]); $try = $item_list[0]; $lp = $item_list[1]; $list_dest = $item_list[2]; $url = $item_list[3]; if ($try == 0) { $try_result = 0; } else { $try_result = 1; } if ($url == 0) { $url_result = ''; } else { $url_result = $url; } $temp_scenario['url' . $i] = $url_result; $temp_scenario['try' . $i] = $try_result; $temp_scenario['lp' . $i] = $lp; $temp_scenario['destination' . $i] = $list_dest; } else { $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1'); $defaults['weighting[1]'] = 10; $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2'); $defaults['weighting[2]'] = 0; $temp_scenario['destination' . $i] = array('0'); $temp_scenario['lp' . $i] = array('0'); } $defaults['scenario'] = $temp_scenario; $renderer = $form->defaultRenderer(); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment[' . $i . ']'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting[' . $i . ']'); $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, ' value = "' . $i . '"'); $answer_number->freeze(); $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"'); $form->addElement('html_editor', 'answer[' . $i . ']', null, 'style="vertical-align:middle"', $editor_config); $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { $form->addElement('html_editor', 'comment[' . $i . ']', null, 'style="vertical-align:middle"', $editor_config); // Direct feedback //Adding extra feedback fields $group = array(); $group['try' . $i] = $form->createElement('checkbox', 'try' . $i, null, get_lang('TryAgain')); $group['lp' . $i] = $form->createElement('select', 'lp' . $i, get_lang('SeeTheory') . ': ', $select_lp_id); $group['destination' . $i] = $form->createElement('select', 'destination' . $i, get_lang('GoToQuestion') . ': ', $select_question); $group['url' . $i] = $form->createElement('text', 'url' . $i, get_lang('Other') . ': ', array('class' => 'span2', 'placeholder' => get_lang('Other'))); $form->addGroup($group, 'scenario'); $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}', 'scenario'); } else { $form->addElement('html_editor', 'comment[' . $i . ']', null, 'style="vertical-align:middle"', $editor_config); } $form->addElement('text', 'weighting[' . $i . ']', null, array('class' => "span1", 'value' => '0')); $form->addElement('html', '</tr>'); } $form->addElement('html', '</table>'); $form->addElement('html', '<br />'); $navigator_info = api_get_navigator(); global $text, $class; //ie6 fix if ($obj_ex->edit_exercise_in_lp == true) { if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { $form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'), 'class="btn minus"'); $form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'), 'class="btn plus"'); $form->addElement('submit', 'submitQuestion', $text, 'class="' . $class . '"'); } else { //setting the save button here and not in the question class.php $form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'), 'class="btn minus"'); $form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'), 'class="btn plus"'); $form->addElement('style_submit_button', 'submitQuestion', $text, 'class="' . $class . '"'); } } $renderer->setElementTemplate('{element} ', 'submitQuestion'); $renderer->setElementTemplate('{element} ', 'lessAnswers'); $renderer->setElementTemplate('{element} ', 'moreAnswers'); $form->addElement('html', '</div></div>'); // We check the first radio button to be sure a radio button will be check if ($correct == 0) { $correct = 1; } $defaults['correct'] = $correct; if (!empty($this->id)) { $form->setDefaults($defaults); } else { if ($this->isContent == 1) { // Default sample content. $form->setDefaults($defaults); } else { $form->setDefaults(array('correct' => 1)); } } $form->setConstants(array('nb_answers' => $nb_answers)); }
?> &course_code=<?php echo urlencode($course_code); ?> &page=<?php echo Security::remove_XSS($_GET['page']); ?> " style="margin:0px;"> <input type="hidden" name="formSent" value="1"> <div class="row"> <div class="col-md-12"> <div class="title"></div> <?php if (!empty($errorMsg)) { Display::display_normal_message($errorMsg); } ?> </div> </div> <div class="row"> <div class="col-md-2"> <?php echo get_lang("CoachName"); ?> </div> <div class="col-md-8"> <select name="id_coach[]" class="form-control" multiple> <option value="0">----- <?php echo get_lang("Choose");
$access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url = api_get_access_url($access_url_id); $portal_url = $url['url']; } } $emailbody = get_lang('Dear') . " " . stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])) . ",\n\n" . get_lang('YouAreReg') . " " . api_get_setting('platform.site_name') . " " . get_lang('WithTheFollowingSettings') . "\n\n" . get_lang('Username') . " : " . $username . "\n" . get_lang('Pass') . " : " . stripslashes($password) . "\n\n" . get_lang('Address') . " " . api_get_setting('platform.site_name') . " " . get_lang('Is') . " : " . $portal_url . "\n\n" . get_lang('Problem') . "\n\n" . get_lang('SignatureFormula') . ",\n\n" . api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname')) . "\n" . get_lang('Manager') . " " . api_get_setting('platform.site_name') . "\nT. " . api_get_setting('admin.administrator_phone') . "\n" . get_lang('Email') . " : " . api_get_setting('admin.administrator_email'); $emailbody = nl2br($emailbody); api_mail_html(api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $email, $emailsubject, $emailbody); } Security::clear_token(); $tok = Security::get_token(); header('Location: ' . $url . '&message=1'); exit; } } else { if (isset($_POST['submit'])) { Security::clear_token(); } $token = Security::get_token(); $form->addElement('hidden', 'sec_token'); $form->setConstants(array('sec_token' => $token)); } $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . "mySpace/student.php", "name" => get_lang('UserList')); // Display form Display::display_header($tool_name); if (isset($_REQUEST['message'])) { Display::display_normal_message(get_lang('Updated')); } $form->display(); Display::display_footer();
$cats = Category::load($category); $stud_id = api_is_allowed_to_edit() ? null : api_get_user_id(); $allcat = $cats[0]->get_subcategories($stud_id); $alleval = $cats[0]->get_evaluations($stud_id); $alllink = $cats[0]->get_links($stud_id); } $addparams = array('selectcat' => $cats[0]->get_id()); if (isset($_GET['search'])) { $addparams['search'] = $keyword; } if (isset($_GET['studentoverview'])) { $addparams['studentoverview'] = ''; } if (isset($allcat_info) && count($allcat_info) >= 0 && (isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search']) && strlen(trim($_GET['search'])) > 0) { $allcat = $allcat_info; } else { $allcat = $allcat; } $gradebooktable = new GradebookTable($cats[0], $allcat, $alleval, $alllink, $addparams); if (empty($allcat) && empty($alleval) && empty($alllink) && !$is_platform_admin && $is_course_admin && !isset($_GET['selectcat']) && api_is_course_tutor()) { Display::display_normal_message(get_lang('GradebookWelcomeMessage') . '<br /><br /><form name="createcat" method="post" action="' . api_get_self() . '?createallcategories=1"><input type="submit" value="' . get_lang('CreateAllCat') . '"></form>', false); } // Here we are in a sub category if ($category != '0') { DisplayGradebook::header($cats[0], 1, $_GET['selectcat'], $is_course_admin, $is_platform_admin, $simple_search_form); } else { // This is the root category DisplayGradebook::header($cats[0], count($allcat) == '0' && !isset($_GET['search']) ? 0 : 1, 0, $is_course_admin, $is_platform_admin, $simple_search_form); } $gradebooktable->display(); Display::display_footer();
{ $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $user_id = intval($user_id); $sql = "SELECT DISTINCT exe_user_id, c_id, session_id\n FROM {$TABLETRACK_EXERCICES}\n WHERE exe_user_id = {$user_id}\n ORDER by exe_user_id, c_id ASC"; $res = Database::query($sql); $course_list = array(); while ($row = Database::fetch_array($res, 'ASSOC')) { $course_list[] = $row; } return $course_list; } Display::display_header(get_lang('MoveUserStats')); echo '<div class="actions">'; echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; echo Display::display_normal_message(get_lang('CompareUserResultsBetweenCoursesAndCoursesInASession'), false); // Some pagination $page = 1; if (isset($_GET['page']) && !empty($_GET['page'])) { $page = intval($_GET['page']); } $default = 20; $count = UserManager::get_number_of_users(); $nro_pages = round($count / $default) + 1; $begin = $default * ($page - 1); $end = $default * $page; $navigation = "{$begin} - {$end} / {$count}<br />"; if ($page > 1) { $navigation .= '<a href="' . api_get_self() . '?page=' . ($page - 1) . '">' . get_lang('Previous') . '</a>'; } else { $navigation .= get_lang('Previous');