function openid_form() { $form = new FormValidator('openid_login', 'post', null, null, array('class' => 'form-vertical form_login')); $form->addElement('text', 'openid_url', array(get_lang('OpenIDURL'), Display::url(get_lang('OpenIDWhatIs'), 'main/auth/openid/whatis.php')), array('class' => 'openid_input')); $form->addElement('button', 'submit', get_lang('Login')); return $form->return_form(); }
function prepare_skill_box($skill, $position, $class) { $block_id = $skill['id']; $extra_class = 'third_window'; if ($skill['parent_id'] == 0) { $extra_class = 'second_window'; } $this->html .= '<div id="block_' . $block_id . '" class = "open_block window ' . $extra_class . ' ' . $class . '" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">'; /*$gradebook_string = ''; if (!empty($skill['gradebooks'])) { foreach ($skill['gradebooks'] as $gradebook) { //uncomment this to show the gradebook tags $gradebook_string .= Display::span($gradebook['name'], array('class'=>'label_tag gradebook','style'=>'width:50px')).'<br />'; } } */ $content = $skill['name']; $content .= '<div class="btn-group">'; $content .= Display::url(get_lang('Edit'), '#', array('id' => 'edit_block_' . $block_id, 'class' => 'edit_block btn')); $content .= Display::url('+', '#', array('id' => 'edit_block_' . $block_id, 'class' => 'edit_block btn')); $content .= '</div>'; $this->html .= $content . ' ' . $gradebook_string; if ($this->type == 'edit' && $skill['parent_id'] != 0) { //$this->html .= Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), '#', array('id'=>'edit_block_'.$block_id,'class'=>'edit_block')); //$this->html .= Display::url(Display::return_icon('add.png', get_lang('Add'), array(), ICON_SIZE_SMALL), '#', array('id'=>'edit_block_'.$block_id,'class'=>'edit_block')); //$this->html .= Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), '#', array('id=>"edit_block_'.$block_id,'class'=>'edit_block')); //$this->html .= Display::url(Display::return_icon('up.png', get_lang('Close'), array(), ICON_SIZE_SMALL), '#', array('id'=>'close_block_'.$block_id,'class'=>'close_block')); //$this->html .= Display::url(Display::return_icon('down.png', get_lang('Open'), array(), ICON_SIZE_SMALL), '#', array('id'=>'open_block_'.$block_id,'class'=>'open_block')); } $this->html .= '</div>'; }
/** * 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'); }
public static function getTopMenu() { $menu_items = array(); $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"); $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH) . 'mySpace/?view=teacher'); $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), '#'); $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH) . 'tracking/exams.php'); $menu = null; foreach ($menu_items as $item) { $menu .= $item; } $menu .= '<br />'; return $menu; }
function openid_form() { //get_lang('OpenIdAuthentication') $form = new FormValidator('openid_login', 'post', null, null, array('class' => 'form-vertical form_login')); $form->addElement('text', 'openid_url', array(get_lang('OpenIDURL'), Display::url(get_lang('OpenIDWhatIs'), 'main/auth/openid/whatis.php')), array('class' => 'openid_input')); $form->addElement('button', 'submit', get_lang('Login')); return $form->return_form(); /* return '<label for="openid_url">'.get_lang('OpenIDURL').' <a href="main/auth/openid/whatis.php" title="'.get_lang('OpenIDWhatIs').'">'.Display::return_icon('info3.gif',get_lang('Info')).'</a></label> <input type="text" id="openid_url" name="openid_url" style="background: url(main/img/openid_small_logo.png) no-repeat; background-color: #fff; background-position: 0 50%; padding-left:18px;" value="http://"></input> * <input type="submit" name="openid_login" value="'.get_lang('Enter').'" /><br /><br /></form></div>'; * */ }
function prepare_skill_box($skill, $position, $class) { $block_id = $skill['id']; $extra_class = 'third_window'; if ($skill['parent_id'] == 0) { $extra_class = 'second_window'; } $this->html .= '<div id="block_' . $block_id . '" class = "open_block window ' . $extra_class . ' ' . $class . '" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">'; $content = $skill['name']; $content .= '<div class="btn-group">'; $content .= Display::url(get_lang('Edit'), '#', array('id' => 'edit_block_' . $block_id, 'class' => 'edit_block btn')); $content .= Display::url('+', '#', array('id' => 'edit_block_' . $block_id, 'class' => 'edit_block btn')); $content .= '</div>'; $this->html .= $content . ' ' . $gradebook_string; if ($this->type == 'edit' && $skill['parent_id'] != 0) { //$this->html .= Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), '#', array('id'=>'edit_block_'.$block_id,'class'=>'edit_block')); //$this->html .= Display::url(Display::return_icon('add.png', get_lang('Add'), array(), ICON_SIZE_SMALL), '#', array('id'=>'edit_block_'.$block_id,'class'=>'edit_block')); //$this->html .= Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), '#', array('id=>"edit_block_'.$block_id,'class'=>'edit_block')); //$this->html .= Display::url(Display::return_icon('up.png', get_lang('Close'), array(), ICON_SIZE_SMALL), '#', array('id'=>'close_block_'.$block_id,'class'=>'close_block')); //$this->html .= Display::url(Display::return_icon('down.png', get_lang('Open'), array(), ICON_SIZE_SMALL), '#', array('id'=>'open_block_'.$block_id,'class'=>'open_block')); } $this->html .= '</div>'; }
/** * Get activities data to display */ static function get_activities_data($from, $number_of_items, $column, $direction) { global $dateTimeFormatLong; $track_e_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $table_user = Database::get_main_table(TABLE_MAIN_USER); $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $current_url_id = api_get_current_access_url_id(); $column = intval($column); $from = intval($from); $number_of_items = intval($number_of_items); if (!in_array($direction, array('ASC', 'DESC'))) { $direction = 'DESC'; } if (api_is_multiple_url_enabled()) { $sql = "SELECT " . "default_event_type as col0, " . "default_value_type as col1, " . "default_value as col2, " . "user.username as col3, " . "user.user_id as col4, " . "default_date as col5 " . "FROM {$track_e_default} as track_default, {$table_user} as user, {$access_url_rel_user_table} as url " . "WHERE track_default.default_user_id = user.user_id AND url.user_id=user.user_id AND access_url_id='" . $current_url_id . "'"; } else { $sql = "SELECT " . "default_event_type as col0, " . "default_value_type as col1, " . "default_value as col2, " . "user.username as col3, " . "user.user_id as col4, " . "default_date as col5 " . "FROM {$track_e_default} track_default, {$table_user} user " . "WHERE track_default.default_user_id = user.user_id "; } if (isset($_GET['keyword'])) { $keyword = Database::escape_string(trim($_GET['keyword'])); $sql .= " AND (user.username LIKE '%" . $keyword . "%' OR default_event_type LIKE '%" . $keyword . "%' OR default_value_type LIKE '%" . $keyword . "%' OR default_value LIKE '%" . $keyword . "%') "; } if (!empty($column) && !empty($direction)) { $sql .= " ORDER BY col{$column} {$direction}"; } else { $sql .= " ORDER BY col5 DESC "; } $sql .= " LIMIT {$from}, {$number_of_items} "; $res = Database::query($sql); $activities = array(); while ($row = Database::fetch_row($res)) { if (strpos($row[1], '_object') === false) { $row[2] = $row[2]; } else { if (!empty($row[2])) { $row[2] = unserialize($row[2]); if (is_array($row[2]) && !empty($row[2])) { $row[2] = Text::implode_with_key(', ', $row[2]); } } } if (!empty($row['default_date']) && $row['default_date'] != '0000-00-00 00:00:00') { $row['default_date'] = api_get_local_time($row['default_date']); } else { $row['default_date'] = '-'; } if (!empty($row[4])) { //user ID $row[3] = Display::url($row[3], api_get_path(WEB_CODE_PATH) . 'admin/user_information?user_id=' . $row[5], array('title' => get_lang('UserInfo'))); $row[4] = TrackingUserLog::get_ip_from_user_event($row[4], $row[5], true); if (empty($row[4])) { $row[4] = get_lang('Unknown'); } } $activities[] = $row; } return $activities; }
/** * Get all questions * @param Application $app * @param int $categoryId * @param int $exerciseId * @param int $courseId * @param array $options * @param bool $get_count * @return array */ public static function getQuestions($app, $categoryId, $exerciseId, $courseId, $options, $get_count = false) { $questionTable = Database::get_course_table(TABLE_QUIZ_QUESTION); $questionPoolFields = array('question_session_id' => array('innerjoin' => " INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST_QUESTION) . " as quiz_rel_question_session ON (quiz_rel_question_session.question_id = s.iid)\n INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST) . " as quizsession ON (quizsession.iid = quiz_rel_question_session.exercice_id)\n INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . " session ON (session.id = quizsession.session_id)", 'where' => 'session_id', 'inject_fields' => 'session.name as question_session_id, '), 'question_category_id' => array('innerjoin' => " INNER JOIN " . Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY) . " as quiz_rel_cat ON (quiz_rel_cat.question_id = s.iid)\n INNER JOIN " . Database::get_course_table(TABLE_QUIZ_CATEGORY) . " as cat ON (cat.iid = quiz_rel_cat.category_id)", 'where' => 'quiz_rel_cat.category_id', 'inject_fields' => 'cat.title as question_category_id, '), 'question_exercise_id' => array('innerjoin' => " INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST_QUESTION) . " as quiz_rel_question ON (quiz_rel_question.question_id = s.iid)\n INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST) . " as quizexercise ON (quizexercise.iid = quiz_rel_question.exercice_id) ", 'where' => 'quiz_rel_question.exercice_id', 'inject_fields' => 'quizexercise.title as question_exercise_id, '), 'question_c_id' => array('where' => 's.c_id', 'innerjoin' => " INNER JOIN " . Database::get_main_table(TABLE_MAIN_COURSE) . " as course ON (course.id = s.c_id) ", 'inject_fields' => 'course.title as question_c_id, '), 'question_question_type' => array('where' => 's.type ', 'inject_fields' => 's.type as question_question_type,'), 'question_difficulty' => array('where' => 's.level', 'inject_fields' => 's.level as question_difficulty, ')); // Checking if you're looking for orphan questions. $isOrphanQuestion = false; if (isset($options['question'])) { foreach ($options['question'] as $option) { if (isset($option['field']) && $option['field'] == 'question_exercise_id') { if ($option['data'] == 0) { $isOrphanQuestion = true; break; } } } } // Special case for orphan questions. if ($isOrphanQuestion) { $questionPoolFields['question_exercise_id'] = array('innerjoin' => " LEFT JOIN " . Database::get_course_table(TABLE_QUIZ_TEST_QUESTION) . " as quiz_rel_question ON (quiz_rel_question.question_id = s.iid)\n LEFT JOIN " . Database::get_course_table(TABLE_QUIZ_TEST) . " as quizexercise ON (quizexercise.iid = quiz_rel_question.exercice_id) ", 'where' => 'quiz_rel_question.exercice_id', 'inject_fields' => 'quizexercise.title as question_exercise_id, '); } $inject_extra_fields = null; $inject_joins = null; $where = $options['where']; $newQuestionPoolField = array(); if (isset($options['question'])) { foreach ($options['question'] as $question) { if (isset($questionPoolFields[$question['field']])) { $newQuestionPoolField[$question['field']] = $questionPoolFields[$question['field']]; } } } $inject_question_fields = null; $questionPoolFields = $newQuestionPoolField; // Injecting inner joins. foreach ($questionPoolFields as $field => $option) { $where = str_replace($field, $option['where'], $where); if (isset($option['innerjoin']) && !empty($option['innerjoin'])) { $inject_joins .= $option['innerjoin']; } if (isset($option['inject_fields']) && !empty($option['inject_fields'])) { $inject_question_fields .= $option['inject_fields']; } } $options['where'] = $where; $extra_field = new ExtraField('question'); $conditions = $extra_field->parseConditions($options); $inject_joins .= $conditions['inject_joins']; $where = $conditions['where']; $inject_where = $conditions['inject_where']; $inject_extra_fields = $conditions['inject_extra_fields']; $order = $conditions['order']; $limit = $conditions['limit']; if ($get_count == true) { $select = " SELECT count(*) as total_rows"; } else { $select = " SELECT s.*, {$inject_extra_fields} {$inject_question_fields} 1 "; } $extraCondition = null; // Used by the question manager if (!empty($categoryId)) { $categoryRelQuestionTable = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY); $extraCondition = " INNER JOIN {$categoryRelQuestionTable} c ON (s.iid = c.question_id)"; $categoryId = intval($categoryId); $where .= " AND category_id = {$categoryId} "; } /*if (!empty($exerciseId)) { $exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); $extraCondition .= " INNER JOIN $exerciseRelQuestionTable e ON (s.iid = e.question_id)"; $exerciseId = intval($exerciseId); $where .= " AND exercice_id = $exerciseId "; }*/ // Orphan questions if ($isOrphanQuestion) { //$exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); //$extraCondition .= " INNER JOIN $exerciseRelQuestionTable e ON (s.iid = e.question_id)"; $where .= " OR quizexercise.active = -1 OR quiz_rel_question.exercice_id IS NULL"; } if (!empty($courseId)) { $courseId = intval($courseId); $where .= " AND s.c_id = {$courseId} "; } if (isset($options['question'])) { $courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id()); foreach ($options['question'] as $questionOption) { if ($questionOption['field'] == 'question_c_id') { if (isset($questionOption['data'])) { if (!isset($courseList[$questionOption['data']])) { return array(); } } } } } //var_dump(CourseManager::get_teacher_list_from_course_code()) //var_dump($inject_joins); $query = " {$select} FROM {$questionTable} s {$inject_joins} {$extraCondition} WHERE 1=1 {$where} {$inject_where} {$order} {$limit}"; //echo $query.'<br />'; //var_dump($extraCondition); //var_dump($where); $result = Database::query($query); $questions = array(); $exerciseList = null; if (!empty($exerciseId)) { $exercise = new Exercise(); $exercise->read($exerciseId); $exerciseList = $exercise->questionList; } if (Database::num_rows($result)) { $questions = Database::store_result($result, 'ASSOC'); if ($get_count) { return $questions[0]['total_rows']; } $previewIcon = Display::return_icon('preview.gif', get_lang('View'), array(), ICON_SIZE_SMALL); $copyIcon = Display::return_icon('copy.png', get_lang('Copy'), array(), ICON_SIZE_SMALL); $reuseIcon = Display::return_icon('view_more_stats.gif', get_lang('InsertALinkToThisQuestionInTheExercise'), array(), ICON_SIZE_SMALL); $editIcon = Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); //$deleteIcon = Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); //var_dump($exerciseId); // Including actions foreach ($questions as &$question) { $type = self::get_question_type($question['type']); $question['type'] = get_lang($type[1]); $question['question_question_type'] = get_lang($type[1]); if (empty($exerciseId)) { // View. $actions = Display::url($previewIcon, $app['url_generator']->generate('admin_questions_show', array('id' => $question['iid']))); // Edit. $actions .= Display::url($editIcon, $app['url_generator']->generate('admin_questions_edit', array('id' => $question['iid']))); } else { // View. $actions = Display::url($previewIcon, $app['url_generator']->generate('question_show', array('cidReq' => api_get_course_id(), 'id_session' => api_get_session_id(), 'exerciseId' => $exerciseId, 'id' => $question['iid']))); if (isset($exerciseList) && !empty($exerciseList) && in_array($question['iid'], $exerciseList)) { // Copy. //$actions .= $copyIconDisabled; } else { // Copy. $actions .= Display::url($copyIcon, 'javascript:void(0);', array('onclick' => 'ajaxAction(this);', 'data-url' => $app['url_generator']->generate('exercise_copy_question', array('cidReq' => api_get_course_id(), 'id_session' => api_get_session_id(), 'questionId' => $question['iid'], 'exerciseId' => $exerciseId)))); // Reuse. $actions .= Display::url($reuseIcon, 'javascript:void(0);', array('onclick' => 'ajaxAction(this);', 'data-url' => $app['url_generator']->generate('exercise_reuse_question', array('cidReq' => api_get_course_id(), 'id_session' => api_get_session_id(), 'questionId' => $question['iid'], 'exerciseId' => $exerciseId)))); } // Edit. $actions .= Display::url($editIcon, $app['url_generator']->generate('exercise_question_edit', array('cidReq' => api_get_course_id(), 'id_session' => api_get_session_id(), 'id' => $question['iid']))); } $question['actions'] = $actions; } } return $questions; }
/** * Show the monthcalender of the given month * @param array Agendaitems * @param int Month number * @param int Year number * @param array Array of strings containing long week day names (deprecated, you can send an empty array instead) * @param string The month name * @return void Direct output */ function display_mymonthcalendar($user_id, $agendaitems, $month, $year, $weekdaynames = array(), $monthName, $show_content = true) { 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'] : ''; $prev_icon = Display::return_icon('action_prev.png', get_lang('Previous')); $next_icon = Display::return_icon('action_next.png', get_lang('Next')); $next_month = $month == 1 ? 12 : $month - 1; $prev_month = $month == 12 ? 1 : $month + 1; $next_year = $month == 1 ? $year - 1 : $year; $prev_year = $month == 12 ? $year + 1 : $year; if ($show_content) { $back_url = Display::url($prev_icon, api_get_self() . "?coursePath=" . urlencode($course_path) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . $next_month . "&year=" . $next_year); $next_url = Display::url($next_icon, api_get_self() . "?coursePath=" . urlencode($course_path) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . $prev_month . "&year=" . $prev_year); } else { $back_url = Display::url($prev_icon, '', array('onclick' => "load_calendar('" . $user_id . "','" . $next_month . "', '" . $next_year . "'); ")); $next_url = Display::url($next_icon, '', array('onclick' => "load_calendar('" . $user_id . "','" . $prev_month . "', '" . $prev_year . "'); ")); } echo '<table id="agenda_list"><tr>'; echo '<th width="10%">' . $back_url . '</th>'; echo '<th width="80%" colspan="5"><br /><h3>' . $monthName . " " . $year . '</h3></th>'; echo '<th width="10%">' . $next_url . '</th>'; echo '</tr>'; echo '<tr>'; for ($ii = 1; $ii < 8; $ii++) { echo '<td class="weekdays">' . $DaysShort[$ii % 7] . '</td>'; } echo '</tr>'; $curday = -1; $today = getdate(); while ($curday <= $numberofdays[$month]) { echo "<tr>"; for ($ii = 0; $ii < 7; $ii++) { if ($curday == -1 && $ii == $startdayofweek) { $curday = 1; } if ($curday > 0 && $curday <= $numberofdays[$month]) { $bgcolor = $class = 'class="days_week"'; $dayheader = Display::div($curday, array('class' => 'agenda_day')); if ($curday == $today['mday'] && $year == $today['year'] && $month == $today['mon']) { $class = "class=\"days_today\" style=\"width:10%;\""; } echo "<td " . $class . ">" . $dayheader; if (!empty($agendaitems[$curday])) { $items = $agendaitems[$curday]; $items = ArrayClass::msort($items, 'start_date_tms'); foreach ($items as $value) { $value['title'] = Security::remove_XSS($value['title']); $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT); $end_time = ''; if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') { $end_time = '- <i>' . api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG) . '</i>'; } $complete_time = '<i>' . api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG) . '</i> ' . $end_time; $time = '<i>' . $start_time . '</i>'; switch ($value['calendar_type']) { case 'personal': $bg_color = '#D0E7F4'; $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL); break; case 'global': $bg_color = '#FFBC89'; $icon = Display::return_icon('view_remove.png', get_lang('GlobalEvent'), array(), ICON_SIZE_SMALL); break; case 'course': $bg_color = '#CAFFAA'; $icon_name = 'course.png'; if (!empty($value['session_id'])) { $icon_name = 'session.png'; } if ($show_content) { $icon = Display::url(Display::return_icon($icon_name, $value['course_name'] . ' ' . get_lang('Course'), array(), ICON_SIZE_SMALL), $value['url']); } else { $icon = Display::return_icon($icon_name, $value['course_name'] . ' ' . get_lang('Course'), array(), ICON_SIZE_SMALL); } break; default: break; } $result = '<div class="rounded_div_agenda" style="background-color:' . $bg_color . ';">'; if ($show_content) { //Setting a personal event to green $icon = Display::div($icon, array('style' => 'float:right')); $link = $value['calendar_type'] . '_' . $value['id'] . '_' . $value['course_id'] . '_' . $value['session_id']; //Link to bubble $url = Display::url(Text::cut($value['title'], 40), '#', array('id' => $link, 'class' => 'opener')); $result .= $time . ' ' . $icon . ' ' . Display::div($url); //Hidden content $content = Display::div($icon . Display::tag('h2', $value['course_name']) . '<hr />' . Display::tag('h3', $value['title']) . $complete_time . '<hr />' . Security::remove_XSS($value['content'])); //Main div $result .= Display::div($content, array('id' => 'main_' . $link, 'class' => 'dialog', 'style' => 'display:none')); $result .= '</div>'; echo $result; //echo Display::div($content, array('id'=>'main_'.$value['calendar_type'].'_'.$value['id'], 'class' => 'dialog')); } else { echo $result .= $icon . '</div>'; } } } echo "</td>"; $curday++; } else { echo "<td></td>"; } } echo "</tr>"; } echo "</table>"; }
/** * Set header parameters */ private function set_header_parameters() { global $httpHeadXtra, $_course, $interbreadcrumb, $language_file, $noPHP_SELF, $_configuration, $this_section; $help = $this->help; $nameTools = $this->title; $navigation = return_navigation_array(); $this->menu_navigation = $navigation['menu_navigation']; $this->assign('system_charset', api_get_system_encoding()); if (isset($httpHeadXtra) && $httpHeadXtra) { foreach ($httpHeadXtra as & $thisHttpHead) { header($thisHttpHead); } } $this->assign('online_button', Display::return_icon('online.png')); $this->assign('offline_button',Display::return_icon('offline.png')); // Get language iso-code for this page - ignore errors $this->assign('document_language', api_get_language_isocode()); $course_title = isset($_course['name']) ? $_course['name'] : null; $title_list = array(); $title_list[] = api_get_setting('Institution'); $title_list[] = api_get_setting('siteName'); if (!empty($course_title)) { $title_list[] = $course_title; } if ($nameTools != '') { $title_list[] = $nameTools; } $title_string = ''; for ($i = 0; $i < count($title_list); $i++) { $title_string .= $title_list[$i]; if (isset($title_list[$i + 1])) { $item = trim($title_list[$i + 1]); if (!empty($item)) { $title_string .= ' - '; } } } $this->assign('title_string', $title_string); //Setting the theme and CSS files $this->set_css_files(); $this->set_js_files(); //$this->set_js_files_post(); $browser = api_browser_support('check_browser'); if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') { $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />'; $this->assign('browser_specific_head', $browser_head); } // Implementation of prefetch. // See http://cdn.chamilo.org/main/img/online.png for details $prefetch = ''; if (!empty($_configuration['cdn_enable'])) { $prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">'; foreach ($_configuration['cdn'] as $host => $exts) { $prefetch .= '<link rel="dns-prefetch" href="'.$host.'">'; } } $this->assign('prefetch', $prefetch); $this->assign('text_direction', api_get_text_direction()); $this->assign('section_name', 'section-'.$this_section); $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />'; if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); $clean_url = replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path $icon_real_homep = api_get_path(SYS_PATH).'home/'.$clean_url; //we create the new dir for the new sites if (is_file($icon_real_homep.'favicon.ico')) { $favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />'; } } } $this->assign('favico', $favico); $this->set_help(); //@todo move this in the template $bug_notification_link = ''; if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { $bug_notification_link = '<li class="report"> <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> <img src="'.api_get_path(WEB_IMG_PATH).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang( 'ReportABug' ).'"/></a> </li>'; } $this->assign('bug_notification_link', $bug_notification_link); $notification = return_notification_menu(); $this->assign('notification_menu', $notification); //Preparing values for the menu //Logout link if (isset($_configuration['hide_logout_button']) && $_configuration['hide_logout_button'] == 'true') { $this->assign('logout_link', null); } else { $this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id()); } //Profile link if (api_get_setting('allow_social_tool') == 'true') { $profile_url = api_get_path(WEB_CODE_PATH).'social/home.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } else { $profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } $this->assign('profile_link', $profile_link); $this->assign('profile_url', $profile_url); //Message link $message_link = null; $message_url = null; if (api_get_setting('allow_message_tool') == 'true') { $message_url = api_get_path(WEB_CODE_PATH).'messages/inbox.php'; $message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>'; } $this->assign('message_link', $message_link); $this->assign('message_url', $message_url); $institution = api_get_setting('Institution'); $portal_name = empty($institution) ? api_get_setting('siteName') : $institution; $this->assign('portal_name', $portal_name); //Menu $menu = return_menu(); $this->assign('menu', $menu); //Setting notifications $count_unread_message = 0; if (api_get_setting('allow_message_tool') == 'true') { // get count unread message and total invitations $count_unread_message = MessageManager::get_number_of_messages(true); } $total_invitations = 0; if (api_get_setting('allow_social_tool') == 'true') { $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id( api_get_user_id() ); $group_pending_invitations = GroupPortalManager::get_groups_by_user( api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false ); $group_pending_invitations = 0; if (!empty($group_pending_invitations)) { $group_pending_invitations = count($group_pending_invitations); } $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval( $count_unread_message ); } $total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : null); $this->assign('user_notifications', $total_invitations); //Breadcrumb $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('breadcrumb', $breadcrumb); //Extra content $extra_header = null; if (!api_is_platform_admin()) { $extra_header = trim(api_get_setting('header_extra_content')); } $this->assign('header_extra_content', $extra_header); //if ($this->show_header == 1) { header('Content-Type: text/html; charset='.api_get_system_encoding()); header( 'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1) ); //} }
/** * Get array containing column header names (incl user columns) * @param int $items_start Start item offset * @param int $items_count Number of items to get * @param bool $show_detail whether to show the details or not * @return array List of headers */ public function get_header_names($items_start = 0, $items_count = null, $show_detail = false) { $headers = array(); if (isset($this->params['show_official_code']) && $this->params['show_official_code']) { $headers[] = get_lang('OfficialCode'); } if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { if (api_is_western_name_order()) { $headers[] = get_lang('FirstnameAndLastname'); } else { $headers[] = get_lang('LastnameAndFirstname'); } } else { if (api_is_western_name_order()) { $headers[] = get_lang('FirstName'); $headers[] = get_lang('LastName'); } else { $headers[] = get_lang('LastName'); $headers[] = get_lang('FirstName'); } } if (!isset($items_count)) { $items_count = count($this->evals_links) - $items_start; } $parent_id = $this->category->get_parent_id(); if ($parent_id == 0 or $this->params['only_subcat'] == $this->category->get_id()) { $main_weight = $this->category->get_weight(); $grade_model_id = $this->category->get_grade_model_id(); } else { $main_cat = Category::load($parent_id, null, null); $main_weight = $main_cat[0]->get_weight(); $grade_model_id = $main_cat[0]->get_grade_model_id(); } $use_grade_model = true; if (empty($grade_model_id) || $grade_model_id == -1) { $use_grade_model = false; } //@todo move these in a function $sum_categories_weight_array = array(); $mainCategoryId = null; $mainCourseCategory = $this->getMainCourseCategory(); if (!empty($mainCourseCategory)) { $mainCategoryId = $mainCourseCategory->get_id(); } if (isset($this->category) && !empty($this->category)) { $categories = Category::load(null, null, null, $this->category->get_id()); if (!empty($categories)) { foreach ($categories as $category) { $sum_categories_weight_array[$category->get_id()] = $category->get_weight(); } } else { $sum_categories_weight_array[$this->category->get_id()] = $this->category->get_weight(); } } //No category was added $course_code = api_get_course_id(); $session_id = api_get_session_id(); $allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id'); $evaluationsAdded = array(); if ($parent_id == 0 && !empty($allcat)) { //Means there are any subcategory foreach ($allcat as $sub_cat) { $sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1); $add_weight = " {$sub_cat_weight} %"; /*if (isset($this->params['export_pdf']) && $this->params['export_pdf']) { $add_weight = null; }*/ $headers[] = Display::url($sub_cat->get_name(), api_get_self() . '?selectcat=' . $sub_cat->get_id()) . $add_weight; } } else { if (!isset($this->params['only_total_category']) || isset($this->params['only_total_category']) && $this->params['only_total_category'] == false) { for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) { $item = $this->evals_links[$count + $items_start]; $weight = round(100 * $item->get_weight() / $main_weight, 1); $headers[] = $item->get_name() . ' ' . $weight . ' % '; $evaluationsAdded[] = $item->get_id(); } } } if (!empty($mainCategoryId)) { for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) { /** @var AbstractLink $item */ $item = $this->evals_links[$count + $items_start]; if ($mainCategoryId == $item->get_category_id() && !in_array($item->get_id(), $evaluationsAdded)) { $weight = round(100 * $item->get_weight() / $main_weight, 1); $headers[] = $item->get_name() . ' ' . $weight . ' % '; } } } $headers[] = api_strtoupper(get_lang('GradebookQualificationTotal')); return $headers; }
//Redirect to the reporting header('location: ../mySpace/myStudents.php?origin=' . $origin . '&student=' . $student_id . '&details=true&course=' . $course_id . '&session_id=' . $session_id); exit; } } } $actions = null; if ($is_allowedToEdit && $origin != 'learnpath') { // the form if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) { $actions .= '<a href="admin.php?exerciseId=' . intval($_GET['exerciseId']) . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>'; $actions .= '<a href="live_stats.php?' . api_get_cidreq() . '&exerciseId=' . $exercise_id . '">' . Display::return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM) . '</a>'; $actions .= '<a href="stats.php?' . api_get_cidreq() . '&exerciseId=' . $exercise_id . '">' . Display::return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM) . '</a>'; $actions .= '<a id="export_opener" href="' . api_get_self() . '?export_report=1&exerciseId=' . intval($_GET['exerciseId']) . '" >' . Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM) . '</a>'; // clean result before a selected date icon $actions .= Display::url(Display::return_icon('clean_before_date.png', get_lang('CleanStudentsResultsBeforeDate'), '', ICON_SIZE_MEDIUM), '#', array('onclick' => "javascript:display_date_picker()")); // clean result before a selected date datepicker popup $actions .= Display::span(Display::input('input', 'datepicker_start', get_lang('SelectADateOnTheCalendar'), array('onmouseover' => 'datepicker_input_mouseover()', 'id' => 'datepicker_start', 'onchange' => 'datepicker_input_changed()', 'readonly' => 'readonly')) . Display::button('delete', get_lang('Delete'), array('onclick' => 'submit_datepicker()')), array('style' => 'display:none', 'id' => 'datepicker_span')); } } else { $actions .= '<a href="exercise.php">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>'; } //Deleting an attempt if (($is_allowedToEdit || $is_tutor || api_is_coach()) && isset($_GET['delete']) && $_GET['delete'] == 'delete' && !empty($_GET['did']) && $locked == false) { $exe_id = intval($_GET['did']); if (!empty($exe_id)) { $sql = 'DELETE FROM ' . $TBL_TRACK_EXERCISES . ' WHERE exe_id = ' . $exe_id; Database::query($sql); $sql = 'DELETE FROM ' . $TBL_TRACK_ATTEMPT . ' WHERE exe_id = ' . $exe_id; Database::query($sql); header('Location: exercise_report.php?' . api_get_cidreq() . '&exerciseId=' . $exercise_id);
$session_id = api_get_session_id(); } // Breadcrumbs. if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') { $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_list.php', 'name' => get_lang('SessionList')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . api_get_session_id(), 'name' => get_lang('SessionOverview')); } $nameTools = get_lang('Tracking'); // Display the header. Display::display_header($nameTools, 'Tracking'); /* MAIN CODE */ echo '<div class="actions">'; echo Display::url(Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'tracking/courseLog.php?' . api_get_cidreq()); echo Display::url(Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), 'course_log_groups.php?' . api_get_cidreq(true, false)); echo Display::url(Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'tracking/course_log_tools.php?' . api_get_cidreq()); echo Display::return_icon('tools_na.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM); echo '<span style="float:right; padding-top:0px;">'; echo '<a href="javascript: void(0);" onclick="javascript: window.print();">' . Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>'; $addional_param = ''; if (isset($_GET['additional_profile_field'])) { $addional_param = 'additional_profile_field=' . intval($_GET['additional_profile_field']); } $users_tracking_per_page = ''; if (isset($_GET['users_tracking_per_page'])) { $users_tracking_per_page = '&users_tracking_per_page=' . intval($_GET['users_tracking_per_page']); } echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&export=csv&' . $addional_param . $users_tracking_per_page . '"> ' . Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</span>'; echo '</div>';
} } return $xajax_response; } $xajax->processRequests(); Display::display_header($tool_name); if ($add_type == 'multiple') { $link_add_type_unique = '<a href="' . api_get_self() . '?add=' . $add . '&add_type=unique">' . Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . '</a>'; $link_add_type_multiple = Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple'); } else { $link_add_type_unique = Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique'); $link_add_type_multiple = '<a href="' . api_get_self() . '?add=' . $add . '&add_type=multiple">' . Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . '</a>'; } echo '<div class="actions">'; echo '<a href="usergroups.php">' . Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM) . '</a>'; echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search')); echo '</div>'; echo '<div id="advanced_search_options" style="display:none">'; $searchForm->display(); echo '</div>'; ?> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?> ?id=<?php echo $id; if (!empty($_GET['add'])) { echo '&add=true'; } ?>
/** * Build the modify-column of the table * @param int $user_id The user id * @return string Some HTML-code */ function modify_filter($user_id, $row, $data) { global $is_allowed_to_track, $charset; $user_id = $data[0]; $course_info = $_course = api_get_course_info(); $current_user_id = api_get_user_id(); $sessionId = api_get_session_id(); $type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : STUDENT; $result = ""; if ($is_allowed_to_track) { $result .= '<a href="../mySpace/myStudents.php?' . api_get_cidreq() . '&student=' . $user_id . '&details=true&course=' . $_course['id'] . '&origin=user_course&id_session=' . api_get_session_id() . '" title="' . get_lang('Tracking') . '" > <img border="0" alt="' . get_lang('Tracking') . '" src="../img/icons/22/stats.png" /> </a>'; } // If platform admin, show the login_as icon (this drastically shortens // time taken by support to test things out) if (api_is_platform_admin()) { $result .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'admin/user_list.php?action=login_as&user_id=' . $user_id . '&sec_token=' . $_SESSION['sec_token'] . '">' . Display::return_icon('login_as.gif', get_lang('LoginAs')) . '</a> '; } if (api_is_allowed_to_edit(null, true)) { if (empty($sessionId)) { $isTutor = isset($data['is_tutor']) ? intval($data['is_tutor']) : 0; $isTutor = empty($isTutor) ? 1 : 0; $text = get_lang('RemoveTutorStatus'); if ($isTutor) { $text = get_lang('SetTutor'); } $disabled = ''; if ($data['user_status_in_course'] == STUDENT) { $result .= Display::url($text, 'user.php?' . api_get_cidreq() . '&action=set_tutor&is_tutor=' . $isTutor . '&user_id=' . $user_id . '&type=' . $type, array('class' => 'btn btn-default ' . $disabled)) . ' '; } } // edit if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) { // unregister if ($user_id != $current_user_id || api_is_platform_admin()) { $result .= '<a class="btn btn-small btn-danger" href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . $type . '&unregister=yes&user_id=' . $user_id . '" title="' . get_lang('Unreg') . ' " onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;">' . get_lang('Unreg') . '</a> '; } else { //$result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).'</a> '; } } } else { // Show buttons for unsubscribe if ($course_info['unsubscribe'] == 1) { if ($user_id == $current_user_id) { $result .= '<a class="btn btn-small btn-danger" href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . $type . '&unregister=yes&user_id=' . $user_id . '" title="' . get_lang('Unreg') . ' " onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;">' . get_lang('Unreg') . '</a> '; } } } return $result; }
echo '</td>'; echo '</tr>'; if (!empty($sessions)) { foreach ($sessions as $session) { $course_list = $session['courses']; $url = Display::url($session['data']['name'], '../session/resume_session.php?id_session=' . $session['data']['id']); echo '<tr>'; //Session name echo Display::tag('td', $url); echo '<td>'; //Courses echo '<table>'; if (!empty($course_list)) { foreach ($course_list as $course) { echo '<tr>'; $url = Display::url($course['title'], api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . $session['data']['id']); echo Display::tag('td', $url); echo '</tr>'; } echo '</table>'; echo '</td>'; echo '</tr>'; } } } } } } } echo '</table>'; Display::display_footer();
echo Display::page_subheader2(get_lang('Teachers')); echo $teacherList; } if (!empty($coaches)) { echo Display::page_subheader2(get_lang('Coaches')); echo $coaches; } $sessionList = SessionManager::get_session_by_course($courseInfo['code']); if (!empty($sessionList)) { echo Display::page_subheader2(get_lang('SessionList')); $sessionToShow = array(); foreach ($sessionList as $session) { $url = api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'].'&cidReq='.$courseInfo['code']; $sessionToShow[] = Display::url($session['name'], $url); } echo implode(', ', $sessionToShow); } echo Display::page_subheader2(get_lang('StudentList')); // PERSON_NAME_DATA_EXPORT is buggy $is_western_name_order = api_is_western_name_order(); if (count($a_students) > 0) { $form = new FormValidator('reminder_form', 'get', api_get_path(REL_CODE_PATH).'announcements/announcements.php'); $renderer = $form->defaultRenderer(); $renderer->setElementTemplate( '<span>{label} {element}</span> <button class="save" type="submit">'.get_lang('SendNotification').'</button>', 'since'
/** * Get li HTML of page number * @param $pageNumber * @param $pageLength * @param array $liAttributes * @param string $content * @return string */ function getPageNumberItem($pageNumber, $pageLength, $liAttributes = array(), $content = '') { // Get page URL $url = self::getCourseCategoryUrl($pageNumber, $pageLength); // If is current page ('active' class) clear URL if (isset($liAttributes) && is_array($liAttributes) && isset($liAttributes['class'])) { if (strpos('active', $liAttributes['class']) !== false) { $url = ''; } } $content = !empty($content) ? $content : $pageNumber; return Display::tag('li', Display::url($content, $url), $liAttributes); }
$table->setCellAttributes($row, $column, array('width' => '300px')); $column++; $table->setCellContents($row, $column, $userResult['sent_date']); $column++; $dateQualification = !empty($workExtraData['expires_on']) && $workExtraData['expires_on'] != '0000-00-00 00:00:00' ? api_get_local_time($workExtraData['expires_on']) : '-'; $table->setCellContents($row, $column, $dateQualification); $column++; $score = '-'; if (!empty($scoreWeight)) { $score = strip_tags($userResult['qualification']) . "/" . $scoreWeight; } $table->setCellContents($row, $column, $score); $column++; // Actions $links = null; // is a text $url = api_get_path(WEB_CODE_PATH) . 'work/view.php?' . api_get_cidreq() . '&id=' . $userResult['id']; $links .= Display::url(Display::return_icon('default.png'), $url); if (!empty($userResult['url'])) { $url = api_get_path(WEB_CODE_PATH) . 'work/download.php?' . api_get_cidreq() . '&id=' . $userResult['id']; $links .= Display::url(Display::return_icon('save.png', get_lang('Download')), $url); } $url = api_get_path(WEB_CODE_PATH) . 'work/edit.php?' . api_get_cidreq() . '&item_id=' . $userResult['id'] . '&id=' . $workId . '&parent_id=' . $workId; $links .= Display::url(Display::return_icon('edit.png', get_lang('Comment')), $url); $table->setCellContents($row, $column, $links); $row++; $column = 0; } } echo $table->toHtml(); Display::display_footer();
/** * Get activities data to display * @param int $from * @param int $numberOfItems * @param int $column * @param string $direction * @return array */ public static function getActivitiesData($from, $numberOfItems, $column, $direction) { $track_e_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $table_user = Database::get_main_table(TABLE_MAIN_USER); $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $current_url_id = api_get_current_access_url_id(); $column = intval($column); $from = intval($from); $numberOfItems = intval($numberOfItems); if (!in_array($direction, array('ASC', 'DESC'))) { $direction = 'DESC'; } if (api_is_multiple_url_enabled()) { $sql = "SELECT\n default_event_type as col0,\n default_value_type as col1,\n default_value as col2,\n c_id as col3,\n session_id as col4,\n user.username as col5,\n user.user_id as col6,\n default_date as col7\n FROM {$track_e_default} as track_default, {$table_user} as user, {$access_url_rel_user_table} as url\n WHERE\n track_default.default_user_id = user.user_id AND\n url.user_id = user.user_id AND\n access_url_id='" . $current_url_id . "'"; } else { $sql = "SELECT\n default_event_type as col0,\n default_value_type as col1,\n default_value as col2,\n c_id as col3,\n session_id as col4,\n user.username as col5,\n user.user_id as col6,\n default_date as col7\n FROM {$track_e_default} track_default, {$table_user} user\n WHERE track_default.default_user_id = user.user_id "; } if (isset($_GET['keyword'])) { $keyword = Database::escape_string(trim($_GET['keyword'])); $sql .= " AND (user.username LIKE '%" . $keyword . "%' OR\n default_event_type LIKE '%" . $keyword . "%' OR\n default_value_type LIKE '%" . $keyword . "%' OR\n default_value LIKE '%" . $keyword . "%') "; } if (!empty($column) && !empty($direction)) { $sql .= " ORDER BY col{$column} {$direction}"; } else { $sql .= " ORDER BY col5 DESC "; } $sql .= " LIMIT {$from},{$numberOfItems} "; $res = Database::query($sql); $activities = array(); while ($row = Database::fetch_row($res)) { if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) { $row[2] = $row[2]; } else { if (!empty($row[2])) { $originalData = str_replace('\\', '', $row[2]); $row[2] = unserialize($originalData); if (is_array($row[2]) && !empty($row[2])) { $row[2] = implode_with_key(', ', $row[2]); } else { $row[2] = $originalData; } } } if (!empty($row['default_date']) && $row['default_date'] != '0000-00-00 00:00:00') { $row['default_date'] = api_get_local_time($row['default_date']); } else { $row['default_date'] = '-'; } if (!empty($row[5])) { //course if (!empty($row[3])) { $row[3] = Display::url($row[3], api_get_path(WEB_CODE_PATH) . 'admin/course_edit.php?id=' . $row[3]); } else { $row[3] = '-'; } // session if (!empty($row[4])) { $row[4] = Display::url($row[4], api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $row[4]); } else { $row[4] = '-'; } // User id. $row[5] = Display::url($row[5], api_get_path(WEB_CODE_PATH) . 'admin/user_information.php?user_id=' . $row[6], array('title' => get_lang('UserInfo'))); $row[6] = TrackingUserLog::get_ip_from_user_event($row[6], $row[7], true); if (empty($row[6])) { $row[6] = get_lang('Unknown'); } } $activities[] = $row; } return $activities; }
echo $filterForm; if (count($certificate_list) == 0) { echo Display::display_warning_message(get_lang('NoResultsAvailable')); } else { echo '<br /><br /><table class="data_table">'; foreach ($certificate_list as $index => $value) { echo '<tr> <td width="100%" class="actions">' . get_lang('Student') . ' : ' . api_get_person_name($value['firstname'], $value['lastname']) . ' (' . $value['username'] . ')</td>'; echo '</tr>'; echo '<tr><td> <table class="data_table">'; $list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id); foreach ($list_certificate as $value_certificate) { echo '<tr>'; echo '<td width="50%">' . get_lang('Score') . ' : ' . $value_certificate['score_certificate'] . '</td>'; echo '<td width="30%">' . get_lang('Date') . ' : ' . api_convert_and_format_date($value_certificate['created_at']) . '</td>'; echo '<td width="20%">'; $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $value_certificate['id']; $certificates = Display::url(get_lang('Certificate'), $url, array('target' => '_blank', 'class' => 'btn btn-default')); echo $certificates; echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token=' . $token . '&cidReq=' . $course_code . '&action=delete&cat_id=' . $cat_id . '&certificate_id=' . $value_certificate['id'] . '"> ' . Display::return_icon('delete.png', get_lang('Delete')) . ' </a>'; echo '</td></tr>'; } echo '</table>'; echo '</td></tr>'; } echo '</table>'; } Display::display_footer();
echo '<td style="vertical-align:top">'; //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (api_is_allowed_to_edit(null, true)) { echo '<div style="text-align:right"><a href="index.php?' . api_get_cidreq() . '&action=thematic_advance_add&thematic_id=' . $thematic['id'] . '">' . Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM) . '</a></div>'; } //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (!empty($thematic_advance_data[$thematic['id']])) { echo '<table width="100%">'; foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { $thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']); $thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG); echo '<tr>'; echo '<td width="90%" class="thematic_advance_content" id="thematic_advance_content_id_' . $thematic_advance['id'] . '">'; $edit_link = ''; if (api_is_allowed_to_edit(null, true)) { $edit_link = Display::url(Display::return_icon('edit.png', get_lang('EditThematicAdvance'), [], ICON_SIZE_SMALL), 'index.php?' . api_get_cidreq() . '&' . http_build_query(['action' => 'thematic_advance_edit', 'thematic_id' => $thematic['id'], 'thematic_advance_id' => $thematic_advance['id'], 'display' => 'no_header']), ['class' => 'ajax', 'data-title' => get_lang('EditThematicAdvance')]); $edit_link .= '<a onclick="javascript:if(!confirm(\'' . get_lang('AreYouSureToDelete') . '\')) return false;" href="index.php?' . api_get_cidreq() . '&action=thematic_advance_delete&thematic_id=' . $thematic['id'] . '&thematic_advance_id=' . $thematic_advance['id'] . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a></center>'; //Links $edit_link = Display::div(Display::div($edit_link, array('id' => 'thematic_advance_tools_' . $thematic_advance['id'], 'class' => 'thematic_advance_actions')), array('style' => 'height:20px;')); } $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null; echo Display::div($thematic_advance_item, array('id' => 'thematic_advance_' . $thematic_advance['id'])); echo $edit_link; echo '</td>'; //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (api_is_allowed_to_edit(null, true)) { if (empty($thematic_id)) { $checked = ''; if ($last_done_thematic_advance == $thematic_advance['id']) { $checked = 'checked'; }
} } $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'); $url = '../newscorm/lp_controller.php?cidReq=' . api_get_course_id() . '&action=view&lp_id=' . $learnpath_id . '&lp_item_id=' . $learnpath_item_id . '&exeId=' . $exercise_stat_info['exe_id'] . '&fb_type=' . $objExercise->feedback_type; $href = $lp_mode == 'fullscreen' ? ' window.opener.location.href="' . $url . '" ' : ' top.location.href="' . $url . '"'; if (api_is_allowed_to_session_edit()) { Session::erase('objExercise'); Session::erase('exe_id'); } // Record the results in the learning path, using the SCORM interface (API) echo "<script>window.parent.API.void_save_asset('{$total_score}', '{$max_score}', 0, 'completed');</script>";
/** Return the <a> html code for delete, add, clone, edit a question in_action = the code of the action triggered by the button from_exercice = the id of the current exercice from which we click on question pool in_questionid = the id of the current question in_questiontype = the code of the type of the current question in_questionname = the name of the question in_selected_course = the if of the course chosen in the FILTERING MENU in_courseCategoryId = the id of the category chosen in the FILTERING MENU in_exerciseLevel = the level of the exercice chosen in the FILTERING MENU in_answerType = the code of the type of the question chosen in the FILTERING MENU in_session_id = the id of the session_id chosen in the FILTERING MENU in_exercice_id = the id of the exercice chosen in the FILTERING MENU */ function get_action_icon_for_question($in_action, $from_exercice, $in_questionid, $in_questiontype, $in_questionname, $in_selected_course, $in_courseCategoryId, $in_exerciseLevel, $in_answerType, $in_session_id, $in_exercice_id) { $res = ""; $getParams = "&selected_course={$in_selected_course}&courseCategoryId={$in_courseCategoryId}&exerciseId={$in_exercice_id}&exerciseLevel={$in_exerciseLevel}&answerType={$in_answerType}&session_id={$in_session_id}"; switch ($in_action) { case "delete": $res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . $getParams . "&delete={$in_questionid}' onclick='return confirm_your_choice()'>"; $res .= Display::return_icon("delete.png", get_lang('Delete')); $res .= "</a>"; break; case "edit": $res = get_a_tag_for_question(1, $from_exercice, $in_questionid, $in_questiontype, Display::return_icon("edit.png", get_lang('Modify')), $in_session_id); break; case "add": // add if question is not already in test $myObjEx = new Exercise(); $myObjEx->read($from_exercice); if (!$myObjEx->isInList($in_questionid)) { $res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . $getParams . "&recup={$in_questionid}&fromExercise={$from_exercice}'>"; $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise')); $res .= "</a>"; } else { $res = "-"; } unset($myObjEx); break; case "clone": $url = api_get_self() . "?" . api_get_cidreq() . $getParams . "&copy_question={$in_questionid}&course_id={$in_selected_course}&fromExercise={$from_exercice}"; $res = Display::url(Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')), $url); break; default: $res = $in_action; break; } return $res; }
$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));
$file = $_FILES['file']; $courseInfo = api_get_course_info(); $workInfo = get_work_data_by_id($itemId); $workInfoParent = get_work_data_by_id($workInfo['parent_id']); $resultUpload = uploadWork($workInfoParent, $courseInfo, true, $workInfo); $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); if (isset($resultUpload['url']) && !empty($resultUpload['url'])) { $title = isset($resultUpload['filename']) && !empty($resultUpload['filename']) ? $resultUpload['filename'] : get_lang('Untitled'); $url = Database::escape_string($resultUpload['url']); $title = Database::escape_string($title); $sql = "UPDATE {$work_table} SET\n url_correction = '" . $url . "',\n title_correction = '" . $title . "'\n WHERE iid = {$itemId}"; Database::query($sql); $result['title'] = $resultUpload['filename']; $result['url'] = 'view.php?' . api_get_cidreq() . '&id=' . $itemId; $json = array(); $json['name'] = Display::url(api_htmlentities($result['title']), api_htmlentities($result['url']), array('target' => '_blank')); $json['type'] = api_htmlentities($file['type']); $json['size'] = format_file_size($file['size']); } if (isset($result['url'])) { $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded')); } else { $json['result'] = Display::return_icon('exclamation.png', get_lang('Error')); } echo json_encode($json); } break; default: echo ''; break; }
$course_list_code = array_unique_dimensional($course_list_code); } //Social Block Menu $social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile); //Setting some session info $user_info = api_get_user_info($my_user_id); $sessionList = SessionManager::getSessionsFollowedByUser($my_user_id, $user_info['status']); // My friends $friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared, $show_full_profile); $wallSocialAddPost = SocialManager::getWallForm(); $social_wall_block = $wallSocialAddPost; // Social Post Wall $posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId); $posts = empty($posts) ? '<p>' . get_lang("NoPosts") . '</p>' : $posts; $social_post_wall_block = Display::panel($posts, get_lang('Posts')); $socialAutoExtendLink = Display::url(get_lang('SeeMore'), $socialAjaxUrl . '?u=' . $my_user_id . '&a=listWallMessage&start=10&length=5', array('class' => 'nextPage next')); // Added a Jquery Function to return the Preview of OpenGraph URL Content $htmlHeadXtra[] = '<script language="JavaScript"> $(document).ready(function() { $("label").remove(); $("[name=\'social_wall_new_msg_main\']").on("paste", function(e) { $.ajax({ contentType: "application/x-www-form-urlencoded", beforeSend: function() { $(".url_preview").html("<i class=\'fa fa-spinner fa-pulse fa-1x\'></i>"); }, type: "POST", url: "' . api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?a=readUrlWithOpenGraph", data: "social_wall_new_msg_main=" + e.originalEvent.clipboardData.getData("text"), success: function(response) { $(".url_preview").html(response);
} unset($users[$uid]); } unset($users); //clean to free memory } if ($add_type == 'multiple') { $link_add_type_unique = '<a href="' . api_get_self() . '?id_session=' . $id_session . '&add=' . $addProcess . '&add_type=unique">' . Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . '</a>'; $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple'), ''); } else { $link_add_type_unique = Display::url(Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique'), ''); $link_add_type_multiple = '<a href="' . api_get_self() . '?id_session=' . $id_session . '&add=' . $addProcess . '&add_type=multiple">' . Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . '</a>'; } $link_add_group = '<a href="usergroups.php">' . Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')) . get_lang('RegistrationByUsersGroups') . '</a>'; $newLinks = Display::url(get_lang('EnrollTrainersFromExistingSessions'), api_get_path(WEB_CODE_PATH) . 'admin/add_teachers_to_session.php'); $newLinks .= Display::url(get_lang('EnrollStudentsFromExistingSessions'), api_get_path(WEB_CODE_PATH) . 'admin/add_students_to_session.php'); ?> <div class="actions"> <?php echo $link_add_type_unique; echo $link_add_type_multiple; echo $link_add_group; echo $newLinks; ?> </div> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?> ?page=<?php echo $page; ?>
/** * @param int $courseId * @param int $sessionId * * @return string */ public function getCurrentFile($courseId, $sessionId) { $data = $this->getData($courseId, $sessionId); if (isset($data['filename']) && !empty($data['filename'])) { $course = api_get_course_info_by_id($courseId); $coursePath = api_get_path(SYS_COURSE_PATH) . $course['directory'] . '/courselegal'; $file = $coursePath . '/' . $data['filename']; if (file_exists($file)) { return Display::url($data['filename'], api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/courselegal/' . $data['filename'], array('target' => '_blank')); } } }
} else { $main_question_list[$question_id]->results = 0; } $main_question_list[$question_id]->quantity = $quantity_exercises; } } } } if (!$export_to_xls) { Display::display_header(get_lang("MySpace")); echo '<div class="actions" style ="font-size:10pt;" >'; if ($global) { $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"); $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH) . 'mySpace/?view=teacher'); $menu_items[] = Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32); $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH) . 'tracking/exams.php'); $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { echo $item; } } } else { echo '<div style="float:left; clear:left"> <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> | ';