/** * Shows question title an description * * @param int $feedback_type * @param int $counter * @param array $score * @param bool $show_media * @param int $hideTitle * * @return string */ public function return_header($feedbackType = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { $counterLabel = null; if (!empty($counter)) { $counterLabel = $counter; } $score_label = get_lang('Wrong'); $class = 'error'; if ($score['pass'] == true) { $score_label = get_lang('Correct'); $class = 'success'; } if ($this->type == FREE_ANSWER || $this->type == ORAL_EXPRESSION) { if ($score['revised'] == true) { $score_label = get_lang('Revised'); $class = ''; } else { $score_label = get_lang('NotRevised'); $class = 'error'; } } $header = null; // Display question category, if any if ($show_media) { $header .= $this->show_media_content(); } if ($hideTitle == 1) { $header .= Display::page_subheader2($counterLabel); } else { $header .= Display::page_subheader2($counterLabel . ". " . $this->question); } $header .= Display::div('<div class="rib rib-' . $class . '"><h3>' . $score_label . '</h3></div><h4>' . $score['result'] . ' </h4>', array('class' => 'ribbon')); $header .= Display::div($this->description, array('id' => 'question_description')); return $header; }
/** * @param $userId * @param $courseInfo * @param int $sessionId * @return array */ public static function getToolInformation($userId, $courseInfo, $sessionId = 0) { $csvContent = array(); $courseToolInformation = null; $headerTool = array(array(get_lang('Title')), array(get_lang('CreatedAt')), array(get_lang('UpdatedAt'))); $headerListForCSV = array(); foreach ($headerTool as $item) { $headerListForCSV[] = $item[0]; } $courseForumInformationArray = getForumCreatedByUser($userId, $courseInfo['real_id'], $sessionId); if (!empty($courseForumInformationArray)) { $csvContent[] = array(); $csvContent[] = get_lang('Forums'); $csvContent[] = $headerListForCSV; foreach ($courseForumInformationArray as $row) { $csvContent[] = $row; } $courseToolInformation .= Display::page_subheader2(get_lang('Forums')); $courseToolInformation .= Display::return_sortable_table($headerTool, $courseForumInformationArray); } $courseWorkInformationArray = getWorkCreatedByUser($userId, $courseInfo['real_id'], $sessionId); if (!empty($courseWorkInformationArray)) { $csvContent[] = null; $csvContent[] = get_lang('Works'); $csvContent[] = $headerListForCSV; foreach ($courseWorkInformationArray as $row) { $csvContent[] = $row; } $csvContent[] = null; $courseToolInformation .= Display::page_subheader2(get_lang('Works')); $courseToolInformation .= Display::return_sortable_table($headerTool, $courseWorkInformationArray); } $courseToolInformationTotal = null; if (!empty($courseToolInformation)) { $sessionTitle = null; if (!empty($sessionId)) { $sessionTitle = ' (' . api_get_session_name($sessionId) . ')'; } $courseToolInformationTotal .= Display::page_subheader($courseInfo['title'] . $sessionTitle); $courseToolInformationTotal .= $courseToolInformation; } return array('array' => $csvContent, 'html' => $courseToolInformationTotal); }
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' ); $options = array ( 2 => '2 '.get_lang('Days'), 3 => '3 '.get_lang('Days'), 4 => '4 '.get_lang('Days'),
/** * Shows question title an description * * @param string $feedback_type * @param int $counter * @param float $score */ function return_header($feedback_type = null, $counter = null, $score = null) { $counter_label = ''; if (!empty($counter)) { $counter_label = intval($counter); } $score_label = get_lang('Wrong'); $class = 'error'; if ($score['pass'] == true) { $score_label = get_lang('Correct'); $class = 'success'; } if ($this->type == FREE_ANSWER || $this->type == ORAL_EXPRESSION) { $score['revised'] = isset($score['revised']) ? $score['revised'] : false; if ($score['revised'] == true) { $score_label = get_lang('Revised'); $class = ''; } else { $score_label = get_lang('NotRevised'); $class = 'error'; } } $question_title = $this->question; // display question category, if any $header = TestCategory::returnCategoryAndTitle($this->id); $show_media = null; if ($show_media) { $header .= $this->show_media_content(); } $header .= Display::page_subheader2($counter_label . ". " . $question_title); $header .= Display::div("<div class=\"rib rib-{$class}\"><h3>{$score_label}</h3></div> <h4>{$score['result']}</h4>", array('class' => 'ribbon')); $header .= Display::div($this->description, array('id' => 'question_description')); return $header; }
} $form = new FormValidator('search_user', 'get', api_get_path(WEB_CODE_PATH) . 'mySpace/student.php'); $form = Tracking::setUserSearchForm($form); $form->setDefaults($params); if ($export_csv) { // send the csv file if asked $content = $table->get_table_data(); foreach ($content as &$row) { unset($row[4]); } $csv_content = array_merge($csv_header, $content); ob_end_clean(); Export::arrayToCsv($csv_content, 'reporting_student_list'); exit; } else { Display::display_header($nameTools); echo $actions; $page_title = get_lang('Students'); echo Display::page_subheader($page_title); if (isset($active)) { if ($active) { $activeLabel = get_lang('ActiveUsers'); } else { $activeLabel = get_lang('InactiveUsers'); } echo Display::page_subheader2($activeLabel); } $form->display(); $table->display(); } Display::display_footer();
/** * * @param int Transaction id of the third party * */ function load_transaction_by_third_party_id($transaction_external_id, $branch_id, $forced = false) { //Asking for 2 transactions by getting 1 $params = array('ultimo' => $transaction_external_id, 'cantidad' => 1, 'intIdSede' => $branch_id); $result = self::soap_call($this->web_service_connection_info, 'transacciones', $params); //Hacking webservice default result if ($result && isset($result[0])) { //Getting 1 transaction $result = $result[0]; $transaction_external_id++; if ($result['idt'] == $transaction_external_id) { $message = Display::return_message('Transaction id found in third party', 'info'); //Adding third party transaction to Chamilo $transaction_result = MigrationCustom::process_transaction($result, null, $forced); $transaction_chamilo_info = array(); if ($transaction_result['error'] == false) { $chamilo_transaction_id = $transaction_result['id']; $message .= Display::return_message($transaction_result['message'], 'info'); $transaction_chamilo_info = self::get_transaction_by_params(array('Where' => array('id = ?' => $chamilo_transaction_id), 'first')); if (isset($transaction_chamilo_info) && isset($transaction_chamilo_info[$chamilo_transaction_id])) { $transaction_chamilo_info = $transaction_chamilo_info[$chamilo_transaction_id]; } else { $transaction_chamilo_info = null; } } else { $message .= Display::return_message("Transaction NOT added to Chamilo. {$transaction_result['message']}", 'warning'); } if (!empty($transaction_chamilo_info)) { $transaction_result = $this->execute_transaction($transaction_chamilo_info); if ($transaction_result) { $message .= Display::page_subheader("Transaction result:"); $message .= nl2br($transaction_result['message']); $message .= "<br />"; if (isset($transaction_result['entity']) && !empty($transaction_result['entity'])) { $message .= Display::page_subheader2("Entity {$transaction_result['entity']} before:"); $message .= "<pre>" . print_r($transaction_result['before'], 1) . "</pre>"; $message .= "<br />"; $message .= Display::page_subheader2("Entity {$transaction_result['entity']} after:"); $message .= "<pre>" . print_r($transaction_result['after'], 1) . "</pre>"; $message .= "<br />"; } } else { $message .= Display::return_message("Transaction failed", 'error'); } } return array('message' => $message, 'raw_reponse' => Display::page_subheader3("Chamilo transaction info:") . "<pre>" . print_r($transaction_chamilo_info, true) . "</pre>" . Display::page_subheader3("Webservice transaction reponse:") . "<pre>" . print_r($result, true) . "</pre>"); } } return array('message' => Display::return_message("Transaction NOT found in third party", 'warning')); }
/** * Displays announcements as an slideshow * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER * @param int $id The identifier of the announcement to display * @param string $type * @return string */ public static function displayAnnouncementsList($visible, $id = null, $type = 'resumed') { $announcements = self::getAnnouncements($visible, $id, $type); $html = null; if (!empty($announcements)) { $html .= Display::page_header(get_lang('SystemAnnouncements')); foreach ($announcements as $announcement) { $html .= Display::page_subheader2($announcement['title']); $html .= "<p> " . $announcement['content'] . "</p>"; } } return $html; }
$interbreadcrumb[] = array("url" => "exercice.php?gradebook={$gradebook}", "name" => get_lang('Exercices')); if ($origin != 'learnpath') { //so we are not in learnpath tool Display::display_header($nameTools, get_lang('Exercise')); } else { Display::display_reduced_header(); } /* DISPLAY AND MAIN PROCESS */ // I'm in a preview mode as course admin. Display the action menu. if (api_is_course_admin() && $origin != 'learnpath') { echo '<div class="actions">'; echo '<a href="admin.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32) . '</a>'; echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32) . '</a>'; echo '</div>'; } echo Display::page_subheader2(get_lang('QuestionsToReview')); if ($time_control) { echo $objExercise->returnTimeLeftDiv(); } echo Display::div('', array('id' => 'message')); $urlMainExercise = api_get_path(WEB_CODE_PATH) . 'exercice/'; echo $objExercise->returnWarningJs($urlMainExercise . 'exercise_result.php?origin=' . $origin . '&exe_id=' . $exe_id); echo '<script> lp_data = $.param({"learnpath_id": ' . $learnpath_id . ', "learnpath_item_id" : ' . $learnpath_item_id . ', "learnpath_item_view_id": ' . $learnpath_item_view_id . '}); function final_submit() { $("#dialog-confirm").dialog("open"); } function review_questions() { var is_checked = 1;
$temp = array($row['down_doc_path'], $row['count_down'] . ' ' . get_lang('Clicks', '')); $csv_content[] = $temp; } } } else { echo '<tr><td>' . get_lang('NoDocumentDownloaded') . '</td></tr>'; if ($export_csv) { $temp = array(get_lang('NoDocumentDownloaded', ''), ''); $csv_content[] = $temp; } } echo '</table></div>'; echo '<div class="clear"></div>'; // links tracking echo '<div class="report_section"> ' . Display::page_subheader2(Display::return_icon('link.gif', get_lang('LinksMostClicked')) . ' ' . get_lang('LinksMostClicked')) . ' <table class="data_table">'; $links_most_visited = Tracking::get_links_most_visited_by_course($courseId, $session_id, $filter_by_users); if ($export_csv) { $temp = array(get_lang('LinksMostClicked'), ''); $csv_content[] = array('', ''); $csv_content[] = $temp; } if (!empty($links_most_visited)) { foreach ($links_most_visited as $row) { echo ' <tr> <td>' . Display::url($row['title'] . ' (' . $row['url'] . ')', $row['url']) . '</td> <td align="right">' . $row['count_visits'] . ' ' . get_lang('Clicks') . '</td> </tr>'; if ($export_csv) { $temp = array($row['title'], $row['count_visits'] . ' ' . get_lang('Clicks', ''));
require_once 'config.php'; Display::display_header(); $form = new FormValidator('transaction_tester'); $form->addElement('header', 'Transaction tester'); $form->addElement('text', 'transaction_id', get_lang('TransactionId')); $form->addElement('text', 'branch_id', get_lang('BranchId')); $form->addRule('transaction_id', get_lang('ThisFieldShouldBeNumeric'), 'numeric'); $form->addRule('branch_id', get_lang('ThisFieldShouldBeNumeric'), 'numeric'); $form->addElement('checkbox', 'forced', null, get_lang('ForceTransactionCreation')); $form->addElement('button', 'add', get_lang('Send')); $response = null; if ($form->validate()) { $values = $form->getSubmitValues(); $transaction_id = $values['transaction_id']; $branch_id = $values['branch_id']; $response = Display::page_subheader2("Executing transaction #{$transaction_id} in branch_id: {$branch_id}"); require_once 'migration.class.php'; require_once 'migration.custom.class.php'; //harcoded db_matches require_once 'db_matches.php'; $migration = new Migration(); $migration->set_web_service_connection_info($matches); $forced = isset($values['forced']) && $values['forced'] == 1 ? true : false; //This is the fault of the webservice $transaction_id--; $result = $migration->load_transaction_by_third_party_id($transaction_id, $branch_id, $forced); $response .= $result['message']; if (isset($result['raw_reponse'])) { $response .= $result['raw_reponse']; } }
$moveUpUrl = 'lp_controller.php?' . api_get_cidreq() . '&action=move_up_category&id=' . $item->getId(); $moveDownUrl = 'lp_controller.php?' . api_get_cidreq() . '&action=move_down_category&id=' . $item->getId(); if ($counterCategories == 1) { $moveUpLink = Display::url(Display::return_icon('up_na.png', get_lang('Move')), '#'); } else { $moveUpLink = Display::url(Display::return_icon('up.png', get_lang('Move')), $moveUpUrl); } if ($total - 1 == $counterCategories) { $moveDownLink = Display::url(Display::return_icon('down_na.png', get_lang('Move')), '#'); } else { $moveDownLink = Display::url(Display::return_icon('down.png', get_lang('Move')), $moveDownUrl); } $delete_link = Display::url(Display::return_icon('delete.png', get_lang('Delete')), $delete_url); $counterCategories++; } echo Display::page_subheader2($item->getName() . $edit_link . $moveUpLink . $moveDownLink . $delete_link); if (!empty($flat_list)) { echo '<table class="data_table">'; echo '<tr>'; if ($is_allowed_to_edit) { echo '<th width="50%">' . get_lang('Title') . '</th>'; echo '<th>' . get_lang('PublicationDate') . '</th>'; echo '<th>' . get_lang('ExpirationDate') . '</th>'; echo '<th>' . get_lang('Progress') . "</th>"; echo '<th width="240px">' . get_lang('AuthoringOptions') . "</th>"; } else { echo '<th width="50%">' . get_lang('Title') . '</th>'; echo '<th>' . get_lang('Progress') . "</th>"; echo '<th>' . get_lang('Actions') . "</th>"; } echo '</tr>';
/** * Displays messages of a group with nested view * @param int group id */ public static function display_message_for_group($group_id, $topic_id, $is_member, $message_id) { global $my_group_role; $main_message = self::get_message_by_id($topic_id); if (empty($main_message)) { return false; } $rows = self::get_messages_by_group_by_message($group_id, $topic_id); $rows = self::calculate_children($rows, $topic_id); $current_user_id = api_get_user_id(); $items_per_page = 50; $query_vars = array('id' => $group_id, 'topic_id' => $topic_id, 'topics_page_nr' => 0); // Main message $links = ''; $main_content = ''; $items_page_nr = null; $html = ''; $delete_button = ''; if (api_is_platform_admin()) { $delete_button = Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), 'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id); } $html .= Display::page_subheader2(Security::remove_XSS($main_message['title'] . $delete_button, STUDENT, true)); $user_sender_info = UserManager::get_user_info_by_id($main_message['user_sender_id']); $files_attachments = self::get_links_message_attachment_files($main_message['id']); $name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']); $topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null; $links .= '<div id="message-reply-link">'; if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR || $main_message['user_sender_id'] == $current_user_id) { $links .= '<a class="ajax btn" href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $main_message['id'] . '&action=edit_message_group&anchor_topic=topic_' . $main_message['id'] . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $main_message['id'] . '" class="group_message_popup" title="' . get_lang('Edit') . '">'; $links .= get_lang('Edit') . '</a>'; } $links .= ' <a class="ajax btn btn-primary" href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $main_message['id'] . '&action=reply_message_group&anchor_topic=topic_' . $main_message['id'] . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $main_message['id'] . '" class="group_message_popup" title="' . get_lang('Reply') . '">'; $links .= get_lang('Reply') . '</a>'; $links .= '</div>'; $image_path = UserManager::get_user_picture_path_by_id($main_message['user_sender_id'], 'web', false, true); $image_repository = $image_path['dir']; $existing_image = $image_path['file']; $main_content .= '<div class="message-group-author"><img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="32" height="32" title="' . $name . '" /></div>'; $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . ' </a>'; $date = ''; if ($main_message['send_date'] != $main_message['update_date']) { if (!empty($main_message['update_date']) && $main_message['update_date'] != '0000-00-00 00:00:00') { $date = '<div class="message-group-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>'; } } else { $date = '<div class="message-group-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>'; } $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; $main_content .= '<div class="message-group-content">' . $links . $user_link . ' ' . $date . $main_message['content'] . $attachment . '</div>'; $main_content = Security::remove_XSS($main_content, STUDENT, true); $html .= Display::div(Display::div(Display::div($main_content, array('class' => 'group_social_sub_item', 'style' => 'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid')); $topic_id = $main_message['id']; if (is_array($rows) && count($rows) > 0) { $topics = $rows; $array_html_items = array(); foreach ($topics as $index => $topic) { if (empty($topic['id'])) { continue; } $items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null; $user_link = ''; $links = ''; $html_items = ''; $user_sender_info = UserManager::get_user_info_by_id($topic['user_sender_id']); $files_attachments = self::get_links_message_attachment_files($topic['id']); $name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']); $links .= '<div id="message-reply-link">'; if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR || $topic['user_sender_id'] == $current_user_id) { $links .= '<a class="btn ajax" href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="group_message_popup" title="' . get_lang('Edit') . '">' . get_lang('Edit') . '</a>'; } $links .= ' <a class="btn btn-primary ajax" href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="group_message_popup" title="' . get_lang('Reply') . '">'; $links .= get_lang('Reply') . '</a>'; $links .= '</div>'; $image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true); $image_repository = $image_path['dir']; $existing_image = $image_path['file']; $html_items .= '<div class="message-group-author"><img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="32" height="32" title="' . $name . '" /></div>'; $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . ' </a>'; $date = ''; if ($topic['send_date'] != $topic['update_date']) { if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00') { $date = '<div class="message-group-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>'; } } else { $date = '<div class="message-group-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>'; } $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; $html_items .= '<div class="message-group-content">' . $links . $user_link . ' ' . $date . Security::remove_XSS($topic['content'], STUDENT, true) . $attachment . '</div>'; $base_padding = 20; if ($topic['indent_cnt'] == 0) { $indent = $base_padding; } else { $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding; } $class = 'group_social_sub_item'; if (isset($message_id) && $message_id == $topic['id']) { $class .= ' group_social_sub_item_highlight'; } $html_items = Display::div($html_items, array('class' => $class, 'id' => 'msg_' . $topic['id'])); $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px')); $array_html_items[] = array($html_items); } // grids for items with paginations $options = array('hide_navigation' => false, 'per_page' => $items_per_page); $visibility = array(true, true, true, false); $style_class = array('item' => array('class' => 'group_social_item'), 'main' => array('class' => 'group_social_grid')); if (!empty($array_html_items)) { $html .= Display::return_sortable_grid('items_' . $topic['id'], array(), $array_html_items, $options, $query_vars, null, $visibility, false, $style_class); } } return $html; }