function lp_upload_quiz_main() { // variable initialisation $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : null; $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data')); $form->addElement('header', get_lang('ImportExcelQuiz')); $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload')); $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>'; $form->addElement('label', '', $link); $table = new HTML_Table(array('class' => 'table')); $tableList = array(UNIQUE_ANSWER => get_lang('UniqueSelect'), MULTIPLE_ANSWER => get_lang('MultipleSelect'), FILL_IN_BLANKS => get_lang('FillBlanks'), MATCHING => get_lang('Matching'), FREE_ANSWER => get_lang('FreeAnswer'), GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer')); $table->setHeaderContents(0, 0, get_lang('QuestionType')); $table->setHeaderContents(0, 1, '#'); $row = 1; foreach ($tableList as $key => $label) { $table->setCellContents($row, 0, $label); $table->setCellContents($row, 1, $key); $row++; } $table = $table->toHtml(); $form->addElement('label', get_lang('QuestionType'), $table); $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score')); $form->addElement('html', '<div id="options" style="display:none">'); $form->addElement('text', 'correct_score', get_lang('CorrectScore')); $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore')); $form->addElement('html', '</div>'); $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required'); $form->add_progress_bar(); $form->addButtonUpload(get_lang('Upload'), 'submit_upload_quiz'); // Display the upload field $form->display(); }
function define_htt($htt_file, $urlp, $course_path) { global $charset; ($htt_file_contents = @fgc($htt_file)) or give_up('Templates file "' . $htt_file . '" is missing...'); $xhtDoc = new xhtdoc($htt_file_contents); if ($xhtDoc->htt_error) give_up('Templates file "' . $htt_file . '": ' . $xhtDoc->htt_error); $xhtDoc->xht_param['self'] = api_get_self() . $urlp; $xhtDoc->xht_param['dateTime'] = date('Y-m-d'); $ckw = $course_path . '/CourseKwds.js'; define('KEYWORDS_CACHE', get_course_path() . $ckw); if (file_exists(KEYWORDS_CACHE)) $kcdt = htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)), ENT_QUOTES, $charset); $xhtDoc->xht_param['keywordscache'] = $kcdt ? '<script type="text/javascript" src="' . get_course_web() . $ckw . '"></script>' . '<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : ''; return $xhtDoc; }
function edit_filter($id, $url_params, $row) { global $charset; $return = '<a href="specific_fields_add.php?action=edit&field_id=' . $row[0] . '">' . Display::return_icon('edit.gif', get_lang('Edit')) . '</a>'; $return .= ' <a href="' . api_get_self() . '?action=delete&field_id=' . $row[0] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . Display::return_icon('delete.gif', get_lang('Delete')) . '</a>'; return $return; }
/** * @package chamilo.survey * @author Arnaud Ligot <*****@*****.**> * @version $Id: $ * * A small peace of code to enable user to access images included into survey * which are accessible by non authenticated users. This file is included * by document/download.php */ function check_download_survey($course, $invitation, $doc_url) { require_once 'survey.lib.php'; // Getting all the course information $_course = CourseManager::get_course_information($course); $course_id = $_course['real_id']; // Database table definitions $table_survey = Database::get_course_table(TABLE_SURVEY); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); // Now we check if the invitationcode is valid $sql = "SELECT * FROM {$table_survey_invitation}\n\t WHERE\n\t c_id = {$course_id} AND\n\t invitation_code = '" . Database::escape_string($invitation) . "'"; $result = Database::query($sql); if (Database::num_rows($result) < 1) { Display::display_error_message(get_lang('WrongInvitationCode'), false); Display::display_footer(); exit; } $survey_invitation = Database::fetch_assoc($result); // Now we check if the user already filled the survey if ($survey_invitation['answered'] == 1) { Display::display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false); Display::display_footer(); exit; } // Very basic security check: check if a text field from a survey/answer/option contains the name of the document requested // Fetch survey ID // If this is the case there will be a language choice $sql = "SELECT * FROM {$table_survey}\n\t WHERE\n\t c_id = {$course_id} AND\n\t code='" . Database::escape_string($survey_invitation['survey_code']) . "'"; $result = Database::query($sql); if (Database::num_rows($result) > 1) { if ($_POST['language']) { $survey_invitation['survey_id'] = $_POST['language']; } else { echo '<form id="language" name="language" method="POST" action="' . api_get_self() . '?course=' . $_GET['course'] . '&invitationcode=' . $_GET['invitationcode'] . '">'; echo ' <select name="language">'; while ($row = Database::fetch_assoc($result)) { echo '<option value="' . $row['survey_id'] . '">' . $row['lang'] . '</option>'; } echo '</select>'; echo ' <input type="submit" name="Submit" value="' . get_lang('Ok') . '" />'; echo '</form>'; display::display_footer(); exit; } } else { $row = Database::fetch_assoc($result); $survey_invitation['survey_id'] = $row['survey_id']; } $sql = "SELECT count(*)\n\t FROM {$table_survey}\n\t WHERE\n\t c_id = {$course_id} AND\n\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n title LIKE '%{$doc_url}%'\n or subtitle LIKE '%{$doc_url}%'\n or intro LIKE '%{$doc_url}%'\n or surveythanks LIKE '%{$doc_url}%'\n )\n\t\t UNION\n\t\t SELECT count(*)\n\t\t FROM {$table_survey_question}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n survey_question LIKE '%{$doc_url}%'\n or survey_question_comment LIKE '%{$doc_url}%'\n )\n\t\t UNION\n\t\t SELECT count(*)\n\t\t FROM {$table_survey_question_option}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n option_text LIKE '%{$doc_url}%'\n )"; $result = Database::query($sql); if (Database::num_rows($result) == 0) { Display::display_error_message(get_lang('WrongInvitationCode'), false); Display::display_footer(); exit; } return $_course; }
/** * @return FormValidator */ private function getSearchForm() { $form = new FormValidator('form-search', 'post', api_get_self() . '?action=subscribe&hidden_links=0', null, array('class' => 'form-search')); $form->addElement('hidden', 'search_course', '1'); $form->addElement('text', 'search_term'); $form->addElement('button', 'submit', get_lang('Search')); return $form; }
/** * Displays the title + grid */ public function display() { echo '<div class="actions" style="margin-bottom:20px">'; echo '<a href="career_dashboard.php">' . Display::return_icon('back.png', get_lang('Back'), '', '32') . '</a>'; echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('new_career.png', get_lang('Add'), '', '32') . '</a>'; echo '</div>'; echo Display::grid_html('careers'); }
/** * Displays the title + grid */ public function display() { // action links echo '<div class="actions" style="margin-bottom:20px">'; echo '<a href="grade_models.php">' . Display::return_icon('back.png', get_lang('Back'), '', '32') . '</a>'; echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('add.png', get_lang('Add'), '', '32') . '</a>'; echo '</div>'; echo Display::grid_html('grade_model'); }
/** * Displays the title + grid */ public function listing() { // action links $html = '<div class="actions">'; //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; $html .= '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('add.png', get_lang('Add'), '', '32') . '</a>'; $html .= '</div>'; $html .= Display::grid_html('timelines'); return $html; }
/** * Displays the title + grid */ function display() { // action links echo '<div class="actions">'; echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', '32') . '</a>'; echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('new_class.png', get_lang('AddClasses'), '', '32') . '</a>'; echo Display::url(Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM), 'usergroup_import.php'); echo Display::url(Display::return_icon('export_csv.png', get_lang('Export'), array(), ICON_SIZE_MEDIUM), 'usergroup_export.php'); echo '</div>'; echo Display::grid_html('usergroups'); }
function mdo_add_breadcrump_nav() { global $interbreadcrumb; $regs = array(); // for use with ereg() $docurl = api_get_self(); // should be .../main/xxx/yyy.php if (ereg('^(.+[^/\\.]+)/[^/\\.]+/[^/\\.]+.[^/\\.]+$', $docurl, $regs)) { $docurl = $regs[1] . '/newscorm/index.php'; } $interbreadcrumb[] = array('url' => $docurl, 'name' => get_lang('MdCallingTool')); }
/** * This function displays the form for import of the zip file with qti2 */ function ch_qti2_display_form() { $name_tools = get_lang('ImportQtiQuiz'); $form = '<div class="actions">'; $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise.php?show=test&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>'; $form .= '</div>'; $formValidator = new FormValidator('qti_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data')); $formValidator->addElement('header', $name_tools); $formValidator->addElement('file', 'userFile', get_lang('DownloadFile')); $formValidator->addButtonImport(get_lang('Upload')); $form .= $formValidator->returnForm(); echo $form; }
function display_mymonthcalendar_2($agendaitems, $month, $year, $weekdaynames = array(), $monthName, $session_id) { global $DaysShort, $course_path; //Handle leap year $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if ($year % 400 == 0 or $year % 4 == 0 and $year % 100 != 0) { $numberofdays[2] = 29; } //Get the first day of the month $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); //Start the week on monday $startdayofweek = $dayone['wday'] != 0 ? $dayone['wday'] - 1 : 6; $g_cc = isset($_GET['courseCode']) ? $_GET['courseCode'] : ''; $backwardsURL = api_get_self() . "?coursePath=" . urlencode($course_path) . "&session=" . Security::remove_XSS($session_id) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . ($month == 1 ? 12 : $month - 1) . "&year=" . ($month == 1 ? $year - 1 : $year); $forewardsURL = api_get_self() . "?coursePath=" . urlencode($course_path) . "&session=" . Security::remove_XSS($session_id) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . ($month == 12 ? 1 : $month + 1) . "&year=" . ($month == 12 ? $year + 1 : $year); echo "<table class=\"data_table\">\n", "<tr>\n", "<th width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></th>\n", "<th width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</th>\n", "<th width=\"10%\"><a href=\"", $forewardsURL, "\">»</a></th>\n", "</tr>\n"; echo "<tr>\n"; for ($ii = 1; $ii < 8; $ii++) { echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>\n"; } echo "</tr>\n"; $curday = -1; $today = getdate(); while ($curday <= $numberofdays[$month]) { echo "<tr>\n"; for ($ii = 0; $ii < 7; $ii++) { if ($curday == -1 && $ii == $startdayofweek) { $curday = 1; } if ($curday > 0 && $curday <= $numberofdays[$month]) { $bgcolor = $ii < 5 ? $class = "class=\"days_week\" style=\"width:10%;\"" : ($class = "class=\"days_weekend\" style=\"width:10%;\""); $dayheader = "<b>{$curday}</b><br />"; if ($curday == $today['mday'] && $year == $today['year'] && $month == $today['mon']) { $dayheader = "<b>{$curday} - " . get_lang("Today") . "</b><br />"; $class = "class=\"days_today\" style=\"width:10%;\""; } echo "<td " . $class . ">", "" . $dayheader; if (!empty($agendaitems[$curday])) { echo "<span class=\"agendaitem\">" . $agendaitems[$curday] . "</span>"; } echo "</td>\n"; $curday++; } else { echo "<td> </td>\n"; } } echo "</tr>\n"; } echo "</table>\n"; }
function lp_upload_quiz_main() { // variable initialisation $lp_id = Security::remove_XSS($_GET['lp_id']); $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data')); $form->addElement('header', get_lang('ImportExcelQuiz')); $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload')); $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate'), null, 16) . get_lang('DownloadExcelTemplate'); $form->addElement('advanced_settings', $link); //button send document $form->addElement('style_submit_button', 'submit_upload_quiz', get_lang('Send'), 'class="upload"'); // Display the upload field $form->display(); }
/** * This function displays the form for import of the zip file with qti2 * @param string Report message to show in case of error */ function aiken_display_form($msg = '') { $name_tools = get_lang('ImportAikenQuiz'); $form = '<div class="actions">'; $form .= '<a href="exercice.php?show=test">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>'; $form .= '</div>'; $form .= $msg; $form_validator = new FormValidator('aiken_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data')); $form_validator->addElement('header', $name_tools); $form_validator->addElement('text', 'total_weight', get_lang('TotalWeight')); $form_validator->addElement('file', 'userFile', get_lang('DownloadFile')); $form_validator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"'); $form .= $form_validator->return_form(); $form .= '<blockquote>' . get_lang('ImportAikenQuizExplanation') . '<br /><pre>' . get_lang('ImportAikenQuizExplanationExample') . '</pre></blockquote>'; echo $form; }
function lp_upload_quiz_main() { // variable initialisation $lp_id = isset($_GET['lp_id']) ? Security::remove_XSS($_GET['lp_id']) : null; $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data')); $form->addElement('header', get_lang('ImportExcelQuiz')); $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload')); $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>'; $form->addElement('label', '', $link); $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score')); $form->addElement('html', '<div id="options" style="display:none">'); $form->addElement('text', 'correct_score', get_lang('CorrectScore')); $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore')); $form->addElement('html', '</div>'); $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required'); $form->add_progress_bar(); $form->addButtonUpload(get_lang('Send'), 'submit_upload_quiz'); // Display the upload field $form->display(); }
function display_form() { $html = ''; $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC')); // Actions // Link back to the documents overview $actionsLeft = '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>'; $html .= Display::toolbarAction('toolbar-copysession', array(0 => $actionsLeft)); $html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'), 'warning'); $html .= '<form class="form-horizontal" name="formulaire" method="post" action="' . api_get_self() . '" >'; $html .= '<div class="form-group">'; // origin $html .= '<label class="col-sm-2 control-label">' . get_lang('OriginCoursesFromSession') . ': </label>'; $html .= '<div class="col-sm-5">' . make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')) . '</div>'; $html .= '<div class="col-sm-5" id="ajax_list_courses_origin">'; $html .= '<select id="origin" class="form-control" name="SessionCoursesListOrigin[]" ></select>'; $html .= '</div></div>'; //destination $html .= '<div class="form-group">'; $html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>'; $html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">'; $html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">'; $html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option></select ></div>'; $html .= '<div class="col-sm-5" id="ajax_list_courses_destination">'; $html .= '<select id="destination" class="form-control" name="SessionCoursesListDestination[]" ></select>'; $html .= '</div></div>'; $options = '<div class="radio"><label><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>'; $options .= get_lang('FullCopy') . '</label></div>'; $options .= '<div class="radio"><label><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>'; $options .= ' ' . get_lang('LetMeSelectItems') . '</label></div>'; $options .= '<div class="checkbox"><label><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />' . get_lang('CopyOnlySessionItems') . '</label></div>'; $html .= Display::panel($options, get_lang('TypeOfCopy')); $html .= '<div class="form-group"><div class="col-sm-12">'; $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;"><em class="fa fa-files-o"></em> ' . get_lang('CopyCourse') . '</button>'; // Add Security token $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">'; $html .= '</div></div>'; $html .= '</form>'; echo $html; }
function display_form() { $html = ''; $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC')); // Actions $html .= '<div class="actions">'; // Link back to the documents overview $html .= '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>'; $html .= '</div>'; $html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation')); $html .= '<form name="formulaire" method="post" action="' . api_get_self() . '" >'; $html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">'; // origin $html .= '<tr><td width="15%"><b>' . get_lang('OriginCoursesFromSession') . ':</b></td>'; $html .= '<td width="10%" align="left">' . make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')) . '</td>'; $html .= '<td width="50%"><div id="ajax_list_courses_origin">'; $html .= '<select id="origin" name="SessionCoursesListOrigin[]" style="width:380px;"></select></div></td></tr>'; //destination $html .= '<tr><td width="15%"><b>' . get_lang('DestinationCoursesFromSession') . ':</b></td>'; $html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">'; $html .= '<select name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">'; $html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option></select ></div></td>'; $html .= '<td width="50%">'; $html .= '<div id="ajax_list_courses_destination">'; $html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>'; $html .= '</tr></table>'; $html .= '<h4>' . get_lang('TypeOfCopy') . '</h4>'; $html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>'; $html .= get_lang('FullCopy') . '</label><br/>'; $html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>'; $html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>'; $html .= '<label class="checkbox"><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />' . get_lang('CopyOnlySessionItems') . '</label><br /><br/>'; $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;"><i class="fa fa-files-o"></i> ' . get_lang('CopyCourse') . '</button>'; // Add Security token $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">'; $html .= '</form>'; echo $html; }
/** * Displays the page header * @param string The name of the page (will be showed in the page title) * @param string Optional help file name * @param string $page_header */ public static function display_header($tool_name = '', $help = null, $page_header = null) { return; $origin = api_get_origin(); $showHeader = true; if (isset($origin) && $origin == 'learnpath') { $showHeader = false; } self::$global_template = new Template($tool_name, $showHeader, $showHeader); // Fixing tools with any help it takes xxx part of main/xxx/index.php if (empty($help)) { $currentURL = api_get_self(); preg_match('/main\\/([^*\\/]+)/', $currentURL, $matches); $toolList = self::toolList(); if (!empty($matches)) { foreach ($matches as $match) { if (in_array($match, $toolList)) { $help = explode('_', $match); $help = array_map('ucfirst', $help); $help = implode('', $help); break; } } } } self::$global_template->setHelp($help); if (!empty(self::$preview_style)) { self::$global_template->preview_theme = self::$preview_style; self::$global_template->setCssFiles(); self::$global_template->set_js_files(); self::$global_template->setCssCustomFiles(); } if (!empty($page_header)) { self::$global_template->assign('header', $page_header); } echo self::$global_template->show_header_template(); }
} if (isset($value['max_student']) && isset($value['group_members']) && $value['max_student'] < count($value['group_members'])) { return array('group_members' => get_lang('GroupTooMuchMembers')); } return true; } /* MAIN CODE */ $htmlHeadXtra[] = '<script> $(document).ready( function() { $("#max_member").on("focus", function() { $("#max_member_selected").attr("checked", true); }); }); </script>'; // Build form $form = new FormValidator('group_edit', 'post', api_get_self() . '?' . api_get_cidreq()); $form->addElement('hidden', 'action'); $form->addElement('hidden', 'max_student', $current_group['max_student']); $complete_user_list = GroupManager::fill_groups_list($current_group['id']); $orderUserListByOfficialCode = api_get_setting('platform.order_user_list_by_official_code'); $possible_users = array(); $userGroup = new UserGroup(); if (!empty($complete_user_list)) { usort($complete_user_list, 'sort_users'); foreach ($complete_user_list as $index => $user) { $officialCode = !empty($user['official_code']) ? ' - ' . $user['official_code'] : null; $groups = $userGroup->getUserGroupListByUser($user['user_id']); $groupNameListToString = ''; if (!empty($groups)) { $groupNameList = array_column($groups, 'name'); $groupNameListToString = ' - [' . implode(', ', $groupNameList) . ']';
public static function getMediaLabels() { // Shows media questions $courseMedias = Question::prepare_course_media_select(api_get_course_int_id()); $labels = null; if (!empty($courseMedias)) { $labels .= get_lang('MediaQuestions') . '<br />'; foreach ($courseMedias as $mediaId => $media) { $editLink = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . MEDIA_QUESTION . '&myid=1&editQuestion=' . $mediaId . '">' . Display::return_icon('edit.png', get_lang('Modify'), array(), ICON_SIZE_SMALL) . '</a>'; $deleteLink = '<a id="delete_' . $mediaId . '" class="opener" href="' . api_get_self() . '?' . api_get_cidreq() . '&deleteQuestion=' . $mediaId . '" >' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; if (!empty($mediaId)) { $labels .= self::getMediaLabel($media) . '' . $editLink . $deleteLink . '<br />'; } } } return $labels; }
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; global $charset; $show_description_field = false; //for now $nameTools = get_lang('Doc'); $this_section = SECTION_COURSES; Event::event_access_tool(TOOL_LEARNPATH); api_protect_course_script(); if (isset($_SESSION['gradebook'])) { $gradebook = $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook')); } $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths')); $interbreadcrumb[] = array('url' => api_get_self() . "?action=build&lp_id=" . $_SESSION['oLP']->get_id(), 'name' => $_SESSION['oLP']->get_name()); $htmlHeadXtra[] = '<script> function activate_start_date() { if(document.getElementById(\'start_date_div\').style.display == \'none\') { document.getElementById(\'start_date_div\').style.display = \'block\'; } else { document.getElementById(\'start_date_div\').style.display = \'none\'; } } function activate_end_date() { if(document.getElementById(\'end_date_div\').style.display == \'none\') { document.getElementById(\'end_date_div\').style.display = \'block\'; } else { document.getElementById(\'end_date_div\').style.display = \'none\'; }
$form->addElement('text', 'name', api_ucfirst(get_lang('Name'))); $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('hidden', 'action', 'add_lp_category'); $form->addElement('hidden', 'c_id', api_get_course_int_id()); $form->addElement('hidden', 'id', 0); $form->addButtonSave(get_lang('Save')); if ($form->validate()) { $values = $form->getSubmitValues(); if (!empty($values['id'])) { learnpath::updateCategory($values); $url = api_get_self() . '?action=list&' . api_get_cidreq(); header('Location: ' . $url); exit; } else { learnpath::createCategory($values); $url = api_get_self() . '?action=list&' . api_get_cidreq(); header('Location: ' . $url); exit; } } else { $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; if ($id) { $item = learnpath::getCategory($id); $defaults = array('id' => $item->getId(), 'name' => $item->getName()); $form->setDefaults($defaults); } } Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path'); echo '<div class="actions">'; echo '<a href="lp_controller.php?' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>';
function manage_form($default, $select_from_user_list = null, $sent_to = null) { $group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null; $message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null; $param_f = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null; $form = new FormValidator('compose_message', null, api_get_self() . '?f=' . $param_f, null, array('enctype' => 'multipart/form-data')); if (empty($group_id)) { if (isset($select_from_user_list)) { $form->addText('id_text_name', get_lang('SendMessageTo'), true, array('id' => 'id_text_name', 'onkeyup' => 'send_request_and_search()', 'autocomplete' => 'off')); $form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('html', '<div id="id_div_search" style="padding:0px" class="message-select-box" > </div>'); $form->addElement('hidden', 'user_list', 0, array('id' => 'user_list')); } else { if (!empty($sent_to)) { $form->addLabel(get_lang('SendMessageTo'), $sent_to); } if (empty($default['users'])) { //fb select $form->addElement('select_ajax', 'users', get_lang('SendMessageTo'), array(), ['multiple' => 'multiple', 'url' => api_get_path(WEB_AJAX_PATH) . 'message.ajax.php?a=find_users']); } else { $form->addElement('hidden', 'hidden_user', $default['users'][0], array('id' => 'hidden_user')); } } } else { $userGroup = new UserGroup(); $group_info = $userGroup->get($group_id); $form->addElement('label', get_lang('ToGroup'), api_xml_http_response_encode($group_info['name'])); $form->addElement('hidden', 'group_id', $group_id); $form->addElement('hidden', 'parent_id', $message_id); } $form->addText('title', get_lang('Subject'), true); $form->addHtmlEditor('content', get_lang('Message'), false, false, array('ToolbarSet' => 'Messages', 'Width' => '100%', 'Height' => '250')); if (isset($_GET['re_id'])) { $message_reply_info = MessageManager::get_message_by_id($_GET['re_id']); $default['title'] = get_lang('MailSubjectReplyShort') . " " . $message_reply_info['title']; $form->addElement('hidden', 're_id', intval($_GET['re_id'])); $form->addElement('hidden', 'save_form', 'save_form'); //adding reply mail $user_reply_info = api_get_user_info($message_reply_info['user_sender_id']); $default['content'] = '<p><br/></p>' . sprintf(get_lang('XWroteY'), $user_reply_info['complete_name'], Security::filter_terms($message_reply_info['content'])); } if (empty($group_id)) { $form->addElement('label', '', '<div id="filepaths" class="form-group"> <div id="filepath_1"> <label>' . get_lang('FilesAttachment') . '</label> <input type="file" name="attach_1"/> <label>' . get_lang('Description') . '</label> <input id="file-descrtiption" type="text" name="legend[]" class="form-control"/> </div> </div>'); $form->addElement('label', '', '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</a></span> (' . sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message.message_max_upload_filesize'))) . ')'); } $form->addButtonSend(get_lang('SendMessage'), 'compose'); $form->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); if (!empty($group_id) && !empty($message_id)) { $message_info = MessageManager::get_message_by_id($message_id); $default['title'] = get_lang('MailSubjectReplyShort') . " " . $message_info['title']; } $form->setDefaults($default); $html = ''; if ($form->validate()) { $check = Security::check_token('post'); if ($check) { $user_list = $default['users']; $file_comments = $_POST['legend']; $title = $default['title']; $content = $default['content']; $group_id = isset($default['group_id']) ? $default['group_id'] : null; $parent_id = isset($default['parent_id']) ? $default['parent_id'] : null; if (is_array($user_list) && count($user_list) > 0) { //all is well, send the message foreach ($user_list as $user) { $res = MessageManager::send_message($user, $title, $content, $_FILES, $file_comments, $group_id, $parent_id); if ($res) { $html .= MessageManager::display_success_message($user); } } } else { Display::display_error_message('ErrorSendingMessage'); } } Security::clear_token(); } else { $token = Security::get_token(); $form->addElement('hidden', 'sec_token'); $form->setConstants(array('sec_token' => $token)); $html .= $form->returnForm(); } return $html; }
$this_section = SECTION_COURSES; $current_course_tool = TOOL_COURSE_MAINTENANCE; api_protect_course_script(true); $_course = api_get_course_info(); $current_course_code = $_course['official_code']; $current_course_name = $_course['name']; if (!api_is_allowed_to_edit()) { api_not_allowed(true); } $tool_name = get_lang('DelCourse'); if (isset($_GET['delete']) && $_GET['delete'] == 'yes') { CourseManager::delete_course($_course['sysCode']); $obj_cat = new Category(); $obj_cat->update_category_delete($_course['sysCode']); // DELETE CONFIRMATION MESSAGE Session::erase('_cid'); Session::erase('_real_cid'); $noPHP_SELF = true; $message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>'; $message .= get_lang('HasDel'); $message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . ' ' . api_get_setting('platform.site_name') . '</a>'; } else { $message = '<h3>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h3>'; $message .= '<p>' . get_lang('ByDel') . '</p>'; $message .= '<p><a class="btn btn-primary" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/maintenance.php?' . api_get_cidreq() . '">' . get_lang('No') . '</a> <a class="btn" href="' . api_get_self() . '?delete=yes&' . api_get_cidreq() . '">' . get_lang('Yes') . '</a></p>'; $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); } Display::display_header($tool_name, 'Settings'); echo Display::page_header($tool_name); Display::display_warning_message($message, false); Display::display_footer();
$extraContentForm = new FormValidator('block_extra_data', 'post', '#', null, array('id' => 'block-extra-data', 'class' => ''), FormValidator::LAYOUT_BOX_NO_LABEL); $extraContentFormRenderer = $extraContentForm->getDefaultRenderer(); if ($extraContentForm->validate()) { $extraData = $extraContentForm->getSubmitValues(); $extraData = array_map(['Security', 'remove_XSS'], $extraData); if (!empty($extraData['block'])) { if (!is_dir($adminExtraContentDir)) { mkdir($adminExtraContentDir, api_get_permissions_for_new_directories(), true); } if (!is_writable($adminExtraContentDir)) { die; } $fullFilePath = $adminExtraContentDir . $extraData['block']; $fullFilePath .= "_extra.html"; file_put_contents($fullFilePath, $extraData['extra_content']); Header::location(api_get_self()); } } $extraContentForm->addTextarea('extra_content', null, ['id' => 'extra_content']); $extraContentFormRenderer->setElementTemplate('<div class="form-group">{element}</div>', 'extra_content'); $extraContentForm->addElement('hidden', 'block', null, array('id' => 'extra-block')); $extraContentForm->addButtonExport(get_lang('Save'), 'submit_extra_content'); $tpl->assign('extraDataForm', $extraContentForm->returnForm()); } // The template contains the call to the AJAX version checker $admin_template = $tpl->get_template('admin/settings_index.tpl'); $content = $tpl->fetch($admin_template); $tpl->assign('content', $content); $tpl->assign('message', $message); $tpl->display_one_col_template(); // Note: version checking mechanism has now been moved to main/inc/ajax/admin.ajax.php
} } $result = Database::query($sql); $db_courses = Database::store_result($result); unset($result); if (api_is_multiple_url_enabled()) { $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $sqlNbCours = "\tSELECT course_rel_user.course_code, course.title\n FROM {$tbl_course_user} as course_rel_user\n INNER JOIN {$tbl_course} as course\n ON course.code = course_rel_user.course_code\n INNER JOIN {$tbl_course_rel_access_url} course_rel_url\n ON (course_rel_url.course_code= course.code)\n WHERE\n access_url_id = {$access_url_id} AND\n course_rel_user.user_id='" . $_user['user_id'] . "' AND\n course_rel_user.status='1'\n ORDER BY course.title"; } } ?> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?> " style="margin:0px;"> <?php if (is_array($extra_field_list)) { if (is_array($new_field_list) && count($new_field_list) > 0) { echo '<h3>' . get_lang('FilterUsers') . '</h3>'; foreach ($new_field_list as $new_field) { echo $new_field['name']; $varname = 'field_' . $new_field['variable']; echo ' <select name="' . $varname . '">'; echo '<option value="0">--' . get_lang('Select') . '--</option>'; foreach ($new_field['data'] as $option) { $checked = ''; if (isset($_POST[$varname])) { if ($_POST[$varname] == $option[1]) {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); } if (!($is_allowed_to_edit || GroupManager::groupMemberWithUploadRights() || is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))) { api_not_allowed(true); } Event::event_access_tool(TOOL_DOCUMENT); $display_dir = $dir; if (isset($group_properties)) { $display_dir = explode('/', $dir); unset($display_dir[0]); unset($display_dir[1]); $display_dir = implode('/', $display_dir); } $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null; // Create a new form $form = new FormValidator('create_document', 'post', api_get_self() . '?' . api_get_cidreq() . '&dir=' . Security::remove_XSS(urlencode($dir)) . '&selectcat=' . $select_cat, null, array('class' => 'form-horizontal')); // form title $form->addElement('header', $nameTools); if ($is_certificate_mode) { //added condition for certicate in gradebook $form->addElement('hidden', 'certificate', 'true', array('id' => 'certificate')); if (isset($_GET['selectcat'])) { $form->addElement('hidden', 'selectcat', $select_cat); } } // Hidden element with current directory $form->addElement('hidden', 'id'); $defaults = array(); $defaults['id'] = $folder_id; // Filename $form->addElement('hidden', 'title_edited', 'false', 'id="title_edited"');
* Template (view in MVC pattern) used for displaying blocks for dashboard * @author Christian Fasanando <*****@*****.**> * @package chamilo.dashboard */ // protect script api_block_anonymous_users(); // menu actions for dashboard views $views = array('blocks', 'list'); if (isset($_GET['view']) && in_array($_GET['view'], $views)) { $dashboard_view = $_GET['view']; } $link_blocks_view = $link_list_view = null; if (isset($dashboard_view) && $dashboard_view == 'list') { $link_blocks_view = '<a href="' . api_get_self() . '?view=blocks">' . Display::return_icon('blocks.png', get_lang('DashboardBlocks'), '', ICON_SIZE_MEDIUM) . '</a>'; } else { $link_list_view = '<a href="' . api_get_self() . '?view=list">' . Display::return_icon('edit.png', get_lang('EditBlocks'), '', ICON_SIZE_MEDIUM) . '</a>'; } $configuration_link = null; if (api_is_platform_admin()) { $configuration_link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins">' . Display::return_icon('settings.png', get_lang('ConfigureDashboardPlugin'), '', ICON_SIZE_MEDIUM) . '</a>'; } echo '<div class="actions">'; echo $link_blocks_view . $link_list_view . $configuration_link; echo '</div>'; // block dashboard view if (isset($dashboard_view) && $dashboard_view == 'blocks') { if (count($blocks) > 0) { $columns = array(); // group content html by number of column if (is_array($blocks)) { $tmp_columns = array();
$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();
$menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), "index.php?view=drh_students&display=yourstudents"); $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'); $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'); $menu_items[] = Display::url(Display::return_icon('session_na.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), '#'); } $actionsLeft = ''; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { $actionsLeft .= $item; } } $actionsRight = ''; if (count($a_sessions) > 0) { $actionsRight = Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick' => 'javascript: window.print();')); $actionsRight .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self() . '?export=csv'); } $toolbar = Display::toolbarAction('toolbar-session', $content = array(0 => $actionsLeft, 1 => $actionsRight)); echo $toolbar; echo Display::page_header(get_lang('YourSessionsList')); } else { $a_sessions = Tracking::get_sessions_coached_by_user($id_coach); } $form = new FormValidator('search_course', 'get', api_get_path(WEB_CODE_PATH) . 'mySpace/session.php'); $form->addElement('text', 'keyword', get_lang('Keyword')); $form->addButtonSearch(get_lang('Search')); $keyword = ''; if ($form->validate()) { $keyword = $form->getSubmitValue('keyword'); } $form->setDefaults(array('keyword' => $keyword));