$user_email_status = get_mail_ver_status($uid); if ($user_email_status == EMAIL_VERIFICATION_REQUIRED or $user_email_status == EMAIL_UNVERIFIED) { $link = "<a href = '../auth/mail_verify_change.php?from_profile=TRUE'>{$langHere}</a>."; $tool_content .= "<div class='alert alert-warning'>{$langMailNotVerified} {$link}</div>"; } } if (!get_user_email_notification_from_courses($uid)) { $head_content .= '<script type="text/javascript">$(control_deactivate);</script>'; $tool_content .= "<div class='alert alert-info'>{$langEmailUnsubscribeWarning}</div>\n <input type='checkbox' id='unsub' name='unsub' value='1'> {$langEmailFromCourses}"; } $tool_content .= "<div class='alert alert-info'>{$langInfoUnsubscribe}</div>\n <div id='unsubscontrols'>"; if (isset($_POST['cid'])) { // one course only $cid = intval($_POST['cid']); $course_title = course_id_to_title($cid); $selected = get_user_email_notification($uid, $cid) ? 'checked' : ''; $tool_content .= "<input type='checkbox' name='c_unsub' value='1' {$selected}> " . q($course_title) . "<br />"; $tool_content .= "<input type='hidden' name='cid' value='{$cid}'>"; } else { // displays all courses foreach ($_SESSION['courses'] as $code => $status) { $title = course_code_to_title($code); $cid = course_code_to_id($code); $selected = get_user_email_notification($uid, $cid) ? 'checked' : ''; $tool_content .= "<input type='checkbox' name='c_unsub[{$code}]' value='1' {$selected}> " . q($title) . "<br />"; } } $tool_content .= "</div>\n <br>\n <input class='btn btn-primary' type='submit' name='submit' value='{$langSubmit}'>\n <a class='btn btn-default' href='display_profile.php'>{$langCancel}<a>"; $tool_content .= "</form>"; } draw($tool_content, 1, null, $head_content);
* be useful (without any warranty), under the terms of the GNU (General * Public License) as published by the Free Software Foundation. * The full license can be read in "/info/license/license_gpl.txt". * * Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ $require_login = TRUE; $guest_allowed = FALSE; include '../../include/baseTheme.php'; if (isset($_POST['course'])) { if ($_POST['course'] != -1) { $jsonarr = array(); $cid = course_code_to_id($_POST['course']); $student_to_student_allow = get_config('dropbox_allow_student_to_student'); $sql = "SELECT COUNT(*) as c FROM course_user WHERE course_id = ?d AND user_id = ?d AND (status = ?d OR editor = ?d)"; $res = Database::get()->querySingle($sql, $cid, $uid, USER_TEACHER, 1); if ($res->c != 0) { $is_editor = true; } else { $is_editor = false; } if ($is_editor || $student_to_student_allow == 1) { $sql = "SELECT DISTINCT u.id user_id, CONCAT(u.surname,' ', u.givenname) AS name, u.username\r\n FROM user u, course_user cu\r\n \t\t WHERE cu.course_id = ?d\r\n AND cu.user_id = u.id\r\n AND cu.status != ?d\r\n AND u.id != ?d\r\n ORDER BY UPPER(u.surname), UPPER(u.givenname)"; $res = Database::get()->queryArray($sql, $cid, USER_GUEST, $uid); if ($is_editor) { $sql_g = "SELECT id, name FROM `group` WHERE course_id = ?d ORDER BY id DESC"; $result_g = Database::get()->queryArray($sql_g, $cid); } else {
/** * draws statistics graph * @global type $uid * @global type $langCourseVisits s * @return type */ function courseVisitsPlot() { global $uid, $langCourseVisits, $langNoStats; $totalHits = 0; $totalDuration = 0; $result = Database::get()->queryArray("SELECT a.code code, a.title title\n FROM course AS a LEFT JOIN course_user AS b\n ON a.id = b.course_id\n WHERE b.user_id = ?d\n AND a.visible != " . COURSE_INACTIVE . "\n ORDER BY a.title", $uid); if (count($result) > 0) { // found courses ? foreach ($result as $row) { $course_codes[] = $row->code; $course_names[$row->code] = $row->title; } foreach ($course_codes as $code) { $cid = course_code_to_id($code); $row = Database::get()->querySingle("SELECT SUM(hits) AS cnt FROM actions_daily\n WHERE user_id = ?d\n AND course_id =?d", $uid, $cid); if ($row) { $totalHits += $row->cnt; $hits[$code] = $row->cnt; } $result = Database::get()->querySingle("SELECT SUM(duration) AS duration FROM actions_daily\n WHERE user_id = ?d\n AND course_id = ?d", $uid, $cid); $duration[$code] = $result->duration; $totalDuration += $duration[$code]; } $chart = new Plotter(600, 300); $chart->setTitle($langCourseVisits); foreach ($hits as $code => $count) { if ($count > 0) { $chart->addPoint($course_names[$code], $count); $chart->modDimension(7, 0); } } return $chart->plot(); } else { return "{$langNoStats}"; } }
} } if ($u_interval != "monthly") { ksort($point); } $chart = new Plotter(); $chart->setTitle($langVisits); //add points to chart while ($newp = current($point)) { $chart->growWithPoint(key($point), $newp); next($point); } } else { //show chart for a specific course $cid = course_code_to_id($u_course_id); $result = Database::get()->queryArray("SELECT " . $date_what . " SUM(hits) AS cnt FROM actions_daily WHERE course_id = $cid AND $date_where $date_group ORDER BY day ASC"); $chart = new Plotter(); $chart->setTitle($langVisits); switch ($u_interval) { case "summary": foreach ($result as $$row) { $chart->growWithPoint($langSummary, $row->cnt); } break; case "daily": foreach ($result as $$row) {
* @brief edit basic course information */ $require_departmentmanage_user = true; require_once '../../include/baseTheme.php'; if (!isset($_GET['c'])) { die; } require_once 'include/lib/hierarchy.class.php'; require_once 'include/lib/course.class.php'; require_once 'include/lib/user.class.php'; require_once 'hierarchy_validations.php'; $tree = new Hierarchy(); $course = new Course(); $user = new User(); // validate course Id $cId = course_code_to_id($_GET['c']); validateCourseNodes($cId, isDepartmentAdmin()); load_js('jstree'); $toolName = $langCourseInfo; $navigation[] = array('url' => 'index.php', 'name' => $langAdmin); $navigation[] = array('url' => 'editcours.php?c=' . q($_GET['c']), 'name' => $langCourseEdit); if (isset($_GET['c'])) { $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "editcours.php?c={$_GET['c']}", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { $tool_content .= action_bar(array(array('title' => $langBackAdmin, 'url' => "index.php", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } // Update course basic information if (isset($_POST['submit'])) { $departments = isset($_POST['department']) ? $_POST['department'] : array(); // if depadmin then diff new/old deps and if new or deleted deps are out of juristinction, then error if (isDepartmentAdmin()) {
$groupset = ''; $base_url = $_SERVER['SCRIPT_NAME'] . '?'; $upload_target_url = 'index.php'; $group_id = ''; $group_sql = "subsystem = $subsystem AND subsystem_id = $uid"; $group_hidden_input = ''; $basedir = $webDir . '/courses/mydocs/' . $uid; if (!is_dir($basedir)) { mkdir($basedir, 0775, true); } $pageName = $langMyDocs; // Saved course code so that file picker menu doesn't lose // the current course if we're in a course if (isset($_GET['course']) and $_GET['course']) { define('SAVED_COURSE_CODE', $_GET['course']); define('SAVED_COURSE_ID', course_code_to_id(SAVED_COURSE_CODE)); $base_url = $_SERVER['SCRIPT_NAME'] . '?course=' . SAVED_COURSE_CODE . '&'; } $course_id = -1; $course_code = ''; $can_upload = $session->user_id == $uid; } else { $subsystem = MAIN; $base_url = $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&'; $upload_target_url = 'index.php?course=' . $course_code; $subsystem_id = 'NULL'; $group_id = ''; $groupset = ''; $group_sql = "course_id = $course_id AND subsystem = $subsystem"; $group_hidden_input = ''; $basedir = $webDir . '/courses/' . $course_code . '/document';
function rss_check_access() { global $course_code, $course_id, $course_status, $module_id; if (isset($_GET['c'])) { $course_code = $_GET['c']; $course_id = course_code_to_id($course_code); $course_status = course_status($course_id); } else { $course_code = ''; $course_id = false; } if ($course_id === false) { header("HTTP/1.0 404 Not Found"); echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head>', '<title>404 Not Found</title></head><body>', '<h1>Not Found</h1><p>The requested course "', htmlspecialchars($course_code), '" does not exist.</p></body></html>'; exit; } if ($course_status == COURSE_INACTIVE or !visible_module($module_id) or $course_status != COURSE_OPEN and !(isset($_GET['token']) and isset($_GET['uid']) and rss_token_valid($_GET['token'], $_GET['uid']))) { forbidden($_SERVER['REQUEST_URI']); } }
Database::get()->queryFunc("SELECT SUM(hits) AS cnt FROM actions_daily WHERE course_id = ?d" , function ($row) use(&$totalHits) { $totalHits += $row->cnt; }, course_code_to_id($course_code)); Database::get()->queryFunc("SELECT UNIX_TIMESTAMP(MIN(day)) AS first FROM actions_daily WHERE course_id = ?d" , function($row) use(&$first_date_time) { $tmp = $row->first; if (!empty($tmp)) { if ($tmp < $first_date_time) { $first_date_time = $tmp; } } }, course_code_to_id($course_code)); } $uptime = date("d-m-Y", $first_date_time); $tool_content .= "<div class='row'> <div class='col-sm-12'> <h3 class='content-title'>$langNbLogin</h3> <ul class='list-group'> <li class='list-group-item'><label>$langFrom " . nice_format(Database::get()->querySingle("SELECT loginout.when AS `when` FROM loginout ORDER BY loginout.when LIMIT 1")->when, true) . " </label> <span class='badge'>" . Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM loginout WHERE loginout.action ='LOGIN'")->cnt . "</span> </li> <li class='list-group-item'><label>$langLast30Days</label> <span class='badge'>" . Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM loginout
/** * Display a textarea with name $name using the rich text editor * Apply automatically various fixes for the text to be edited * @global type $head_content * @global type $language * @global type $purifier * @global type $urlAppend * @global type $course_code * @global type $langPopUp * @global type $langPopUpFrame * @global type $is_editor * @global type $is_admin * @param type $name * @param type $rows * @param type $cols * @param type $text * @param type $extra * @return type */ function rich_text_editor($name, $rows, $cols, $text, $onFocus = false) { global $head_content, $language, $urlAppend, $course_code, $langPopUp, $langPopUpFrame, $is_editor, $is_admin; static $init_done = false; if (!$init_done) { $init_done = true; $filebrowser = $url = ''; $activemodule = 'document/index.php'; if (isset($course_code) && !empty($course_code)) { $filebrowser = "file_browser_callback : openDocsPicker,"; if (!$is_editor) { $cid = course_code_to_id($course_code); $module = Database::get()->querySingle("SELECT * FROM course_module\n WHERE course_id = ?d\n AND (module_id =" . MODULE_ID_DOCS . " OR module_id =" . MODULE_ID_VIDEO . " OR module_id =" . MODULE_ID_LINKS . ")\n AND VISIBLE = 1 ORDER BY module_id", $cid); if ($module === false) { $filebrowser = ''; } else { switch ($module->module_id) { case MODULE_ID_LINKS: $activemodule = 'link/index.php'; break; case MODULE_ID_DOCS: $activemodule = 'document/index.php'; break; case MODULE_ID_VIDEO: $activemodule = 'video/index.php'; break; default: $filebrowser = ''; break; } } } $url = $urlAppend . "modules/{$activemodule}?course={$course_code}&embedtype=tinymce&docsfilter="; } elseif ($is_admin) { /* special case for admin announcements */ $filebrowser = "file_browser_callback : openDocsPicker,"; $url = $urlAppend . "modules/admin/commondocs.php?embedtype=tinymce&docsfilter="; } if ($onFocus) { $focus_init = ",\n menubar: false,\n statusbar: false, \n setup: function (theEditor) {\n theEditor.on('focus', function () {\n \$(this.contentAreaContainer.parentElement).find('div.mce-toolbar-grp').show();\n });\n theEditor.on('blur', function () {\n \$(this.contentAreaContainer.parentElement).find('div.mce-toolbar-grp').hide();\n });\n theEditor.on('init', function() {\n \$(this.contentAreaContainer.parentElement).find('div.mce-toolbar-grp').hide();\n });\n }"; } else { $focus_init = ''; } load_js('tinymce/tinymce.gzip.js'); $head_content .= "\n<script type='text/javascript'>\n\nfunction openDocsPicker(field_name, url, type, win) {\n tinymce.activeEditor.windowManager.open({\n file: '{$url}' + type,\n title: 'Resources Browser',\n width: 800,\n height: 600,\n resizable: 'yes',\n inline: 'yes',\n close_previous: 'no',\n popup_css: false\n }, {\n window: win,\n input: field_name\n });\n return false;\n}\n\ntinymce.init({\n // General options\n selector: 'textarea.mceEditor',\n language: '{$language}',\n theme: 'modern',\n image_class_list: [\n {title: 'Responsive', value: 'img-responsive'},\n {title: 'None', value: ''}\n ],\n plugins: 'pagebreak,save,image,link,media,eclmedia,print,contextmenu,paste,noneditable,visualchars,nonbreaking,template,wordcount,advlist,emoticons,preview,searchreplace,table,insertdatetime,code',\n entity_encoding: 'raw',\n relative_urls: false,\n image_advtab: true,\n link_class_list: [\n {title: 'None', value: ''},\n {title: '{$langPopUp}', value: 'colorbox'},\n {title: '{$langPopUpFrame}', value: 'colorboxframe'}\n ],\n {$filebrowser}\n\n // Toolbar options\n toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image eclmedia code',\n // Replace values for the template plugin\n template_replace_values: {\n username : '******',\n staffid : '991234'\n }\n {$focus_init}\n});\n</script>"; } /* $text = str_replace(array('<m>', '</m>', '<M>', '</M>'), array('[m]', '[/m]', '[m]', '[/m]'), $text); */ return "<textarea class='mceEditor' name='{$name}' rows='{$rows}' cols='{$cols}'>" . q(str_replace('{', '{', $text)) . "</textarea>\n"; }
$tree = new Hierarchy(); $course = new Course(); $user = new User(); if (isset($_GET['c'])) { $c = q($_GET['c']); $_SESSION['c_temp'] = $c; } if (!isset($c)) { $c = $_SESSION['c_temp']; } // validate course Id $cId = course_code_to_id($c); validateCourseNodes($cId, isDepartmentAdmin()); $toolName = $langCourseEdit; $navigation[] = array('url' => 'index.php', 'name' => $langAdmin); $navigation[] = array('url' => 'listcours.php', 'name' => $langListCours); $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "searchcours.php", 'icon' => 'fa-reply', 'level' => 'primary-label'))); // A course has been selected if (isset($c)) { // Get information about selected course
/** * Function lessonToolsMenu * * Creates a multi-dimensional array of the user's tools * in regard to the user's user level * (student | professor | platform administrator) * * @return array */ function lessonToolsMenu() { global $uid, $is_editor, $is_course_admin; global $course_code, $langAdministrationTools, $langExternalLinks; global $modules, $admin_modules, $urlAppend; $sideMenuGroup = array(); $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $sideMenuID = array(); $arrMenuType = array(); $arrMenuType['type'] = 'none'; if ($is_editor) { $tools_sections = array(array('type' => 'Public', 'title' => $GLOBALS['langActiveTools'], 'iconext' => '_on.png', 'class' => 'active'), array('type' => 'PublicButHide', 'title' => $GLOBALS['langInactiveTools'], 'iconext' => '_off.png', 'class' => 'inactive')); } else { $tools_sections = array(array('type' => 'Public', 'title' => $GLOBALS['langCourseOptions'], 'iconext' => '_on.png', 'class' => 'active')); } foreach ($tools_sections as $section) { $result = getToolsArray($section['type']); $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $sideMenuID = array(); $arrMenuType = array('type' => 'text', 'text' => $section['title'], 'class' => $section['class']); array_push($sideMenuSubGroup, $arrMenuType); foreach ($result as $toolsRow) { $mid = $toolsRow->module_id; if ($mid == MODULE_ID_DROPBOX) { require_once 'modules/dropbox/class.mailbox.php'; $mbox = new Mailbox($uid, course_code_to_id($course_code)); $new_msgs = $mbox->unreadMsgsNumber(); if ($new_msgs != 0) { array_push($sideMenuText, "<b>" . q($modules[$mid]['title']) . " (" . $new_msgs . ")</b>"); } else { array_push($sideMenuText, q($modules[$mid]['title'])); } } else { array_push($sideMenuText, q($modules[$mid]['title'])); } array_push($sideMenuLink, q($urlAppend . 'modules/' . $modules[$mid]['link'] . '/?course=' . $course_code)); array_push($sideMenuImg, $modules[$mid]['image'] . $section['iconext']); array_push($sideMenuID, $mid); } array_push($sideMenuSubGroup, $sideMenuText); array_push($sideMenuSubGroup, $sideMenuLink); array_push($sideMenuSubGroup, $sideMenuImg); array_push($sideMenuSubGroup, $sideMenuID); array_push($sideMenuGroup, $sideMenuSubGroup); } $result2 = getExternalLinks(); if ($result2) { // display external link (if any) $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $arrMenuType = array('type' => 'text', 'text' => $langExternalLinks, 'class' => 'external'); array_push($sideMenuSubGroup, $arrMenuType); foreach ($result2 as $ex_link) { array_push($sideMenuText, q($ex_link->title)); array_push($sideMenuLink, q($ex_link->url)); array_push($sideMenuImg, "external_link" . $section['iconext']); } array_push($sideMenuSubGroup, $sideMenuText); array_push($sideMenuSubGroup, $sideMenuLink); array_push($sideMenuSubGroup, $sideMenuImg); array_push($sideMenuGroup, $sideMenuSubGroup); } if ($is_course_admin) { // display course admin tools $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $sideMenuID = array(); $arrMenuType = array('type' => 'text', 'text' => $langAdministrationTools, 'class' => 'course_admin'); array_push($sideMenuSubGroup, $arrMenuType); foreach ($admin_modules as $adm_mod) { array_push($sideMenuText, $adm_mod['title']); array_push($sideMenuLink, q($urlAppend . 'modules/' . $adm_mod['link'] . '/?course=' . $course_code)); array_push($sideMenuImg, $adm_mod['image'] . $section['iconext']); } array_push($sideMenuSubGroup, $sideMenuText); array_push($sideMenuSubGroup, $sideMenuLink); array_push($sideMenuSubGroup, $sideMenuImg); array_push($sideMenuSubGroup, $sideMenuID); array_push($sideMenuGroup, $sideMenuSubGroup); } return $sideMenuGroup; }
/** * Function lessonToolsMenu * * Creates a multi-dimensional array of the user's tools * in regard to the user's user level * (student | professor | platform administrator) * * @return array */ function lessonToolsMenu() { global $uid, $is_editor, $is_course_admin, $courses, $course_code, $langAdministrationTools, $langExternalLinks, $modules, $admin_modules, $urlAppend, $status, $course_id; $sideMenuGroup = array(); $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $sideMenuID = array(); $arrMenuType = array(); $arrMenuType['type'] = 'none'; if ($is_editor || $is_course_admin) { $tools_sections = array(array('type' => 'Public', 'title' => $GLOBALS['langActiveTools'], 'iconext' => '_on.png', 'class' => 'active'), array('type' => 'PublicButHide', 'title' => $GLOBALS['langInactiveTools'], 'iconext' => '_off.png', 'class' => 'inactive')); } else { $tools_sections = array(array('type' => 'Public', 'title' => $GLOBALS['langCourseOptions'], 'iconext' => '_on.png', 'class' => 'active')); } foreach ($tools_sections as $section) { $result = getToolsArray($section['type']); $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $sideMenuID = array(); $mail_status = ''; $arrMenuType = array('type' => 'text', 'text' => $section['title'], 'class' => $section['class']); array_push($sideMenuSubGroup, $arrMenuType); setlocale(LC_COLLATE, $GLOBALS['langLocale']); usort($result, function ($a, $b) { global $modules; return strcoll($modules[$a->module_id]['title'], $modules[$b->module_id]['title']); }); // check if we have define mail address and want to receive messages if ($uid and $status != USER_GUEST and !get_user_email_notification($uid, $course_id)) { $mail_status = ' ' . icon('fa-exclamation-triangle'); } foreach ($result as $toolsRow) { $mid = $toolsRow->module_id; // hide groups for unregistered users if ($mid == MODULE_ID_GROUPS and !$courses[$course_code]) { continue; } // hide teleconference when no BBB servers are enabled if ($mid == MODULE_ID_BBB and !get_total_bbb_servers()) { continue; } // if we are in dropbox or announcements add (if needed) mail address status if ($mid == MODULE_ID_DROPBOX or $mid == MODULE_ID_ANNOUNCE) { if ($mid == MODULE_ID_DROPBOX) { $mbox = new Mailbox($uid, course_code_to_id($course_code)); $new_msgs = $mbox->unreadMsgsNumber(); if ($new_msgs != 0) { array_push($sideMenuText, '<b>' . q($modules[$mid]['title']) . " $mail_status<span class='badge pull-right'>$new_msgs</span></b>"); } else { array_push($sideMenuText, q($modules[$mid]['title']).' '.$mail_status); } } else { array_push($sideMenuText, q($modules[$mid]['title']).' '.$mail_status); } } elseif ($mid == MODULE_ID_DOCS and ($new_docs = get_new_document_count($course_id))) { array_push($sideMenuText, '<b>' . q($modules[$mid]['title']) . "<span class='badge pull-right'>$new_docs</span></b>"); } else { array_push($sideMenuText, q($modules[$mid]['title'])); } array_push($sideMenuLink, q($urlAppend . 'modules/' . $modules[$mid]['link'] . '/?course=' . $course_code)); array_push($sideMenuImg, $modules[$mid]['image'] . $section['iconext']); array_push($sideMenuID, $mid); } array_push($sideMenuSubGroup, $sideMenuText); array_push($sideMenuSubGroup, $sideMenuLink); array_push($sideMenuSubGroup, $sideMenuImg); array_push($sideMenuSubGroup, $sideMenuID); array_push($sideMenuGroup, $sideMenuSubGroup); } $result2 = getExternalLinks(); if ($result2) { // display external link (if any) $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $arrMenuType = array('type' => 'text', 'text' => $langExternalLinks, 'class' => 'external'); array_push($sideMenuSubGroup, $arrMenuType); foreach ($result2 as $ex_link) { array_push($sideMenuText, q($ex_link->title)); array_push($sideMenuLink, q($ex_link->url)); array_push($sideMenuImg, 'fa-external-link'); } array_push($sideMenuSubGroup, $sideMenuText); array_push($sideMenuSubGroup, $sideMenuLink); array_push($sideMenuSubGroup, $sideMenuImg); array_push($sideMenuGroup, $sideMenuSubGroup); } if ($is_course_admin) { // display course admin tools $sideMenuSubGroup = array(); $sideMenuText = array(); $sideMenuLink = array(); $sideMenuImg = array(); $sideMenuID = array(); $arrMenuType = array('type' => 'text', 'text' => $langAdministrationTools, 'class' => 'course_admin'); array_push($sideMenuSubGroup, $arrMenuType); foreach ($admin_modules as $adm_mod) { array_push($sideMenuText, $adm_mod['title']); array_push($sideMenuLink, q($urlAppend . 'modules/' . $adm_mod['link'] . '/?course=' . $course_code)); array_push($sideMenuImg, $adm_mod['image'] . $section['iconext']); } array_push($sideMenuSubGroup, $sideMenuText); array_push($sideMenuSubGroup, $sideMenuLink); array_push($sideMenuSubGroup, $sideMenuImg); array_push($sideMenuSubGroup, $sideMenuID); array_push($sideMenuGroup, $sideMenuSubGroup); } return $sideMenuGroup; }
/** * Injects all commenting module code in other subsystems * @param courseCode the course code * @param $isEditor * @param $uid the user id * @return string */ public function put($courseCode, $isEditor, $uid, $always_open = false) { global $langComments, $langBlogPostUser, $langSubmit, $themeimg, $langModify, $langDelete, $langCommentsDelConfirm, $langCommentsSaveConfirm, $urlServer, $head_content; //$head_content .= '<link rel="stylesheet" type="text/css" href="'.$urlServer.'modules/comments/style.css">'; $commentsNum = $this->getCommentsNum(); if (!$always_open) { $comments_title = "<button type='button' class='btn btn-primary' data-toggle='modal' data-target='#commentArea-$this->rid'>$langComments (<span id='commentsNum-$this->rid'>$commentsNum</span>)</button>"; $out = "$comments_title <div class='modal fade' id='commentArea-$this->rid' role='dialog'> <div class='modal-dialog modal-lg'> <div class='modal-content' style='padding:1%'> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal'>×</button> <h4 class='modal-title'>$langComments</h4> </div> <div class='modal-body' id='comments-$this->rid'>"; } else { $comments_title = "<h3 id='comments_title'>$langComments (<span id='commentsNum-$this->rid'>$commentsNum</span>)</h3><br>"; $out = "<div class='commenting'> $comments_title <div class='commentArea' id='commentArea-$this->rid'> <div id='comments-$this->rid'>"; } if ($commentsNum != 0) { //retrieve comments $comments = $this->getCommentsDB(); foreach ($comments as $comment) { if (is_null($courseCode)) { //for the case of personal blog posts comments if (isset($_SESSION['uid']) && ($isEditor || ($comment->getAuthor() == $uid))) { //$isEditor corresponds to blog editor $post_actions = '<div class="pull-right">'; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'editLoad\', '.$this->rid.', \''.$this->rtype.'\', \'\', '.$comment->getId().')">'; $post_actions .= icon('fa-edit', $langModify).'</a> '; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'delete\', '.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsDelConfirm.'\', '.$comment->getId().')">'; $post_actions .= icon('fa-times', $langDelete).'</a>'; $post_actions .='</div>'; } else { $post_actions = ''; } } else { if ($comment->permEdit($isEditor, $uid)) { $post_actions = '<div class="pull-right">'; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$courseCode.'\', \'editLoad\', '.$this->rid.', \''.$this->rtype.'\', \'\', '.$comment->getId().')">'; $post_actions .= icon('fa-edit', $langModify).'</a> '; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$courseCode.'\', \'delete\', '.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsDelConfirm.'\', '.$comment->getId().')">'; $post_actions .= icon('fa-times', $langDelete).'</a>'; if (abuse_report_show_flag('comment', $comment->getId(), course_code_to_id($courseCode), $isEditor)) { $post_actions .= abuse_report_icon_flag ('comment', $comment->getId(), course_code_to_id($courseCode)); } $post_actions .='</div>'; } else { if (abuse_report_show_flag('comment', $comment->getId(), course_code_to_id($courseCode), $isEditor)) { $post_actions = '<div class="pull-right">'.abuse_report_icon_flag ('comment', $comment->getId(), course_code_to_id($courseCode)).'</div>'; } else { $post_actions = ''; } } } $out .= "<div class='row margin-bottom-thin margin-top-thin comment' id='comment-".$comment->getId()."'> <div class='col-xs-12'> <div class='media'> <a class='media-left' href='#'> ". profile_image($comment->getAuthor(), IMAGESIZE_SMALL) ." </a> <div class='media-body bubble'> <div class='label label-success media-heading'>".nice_format($comment->getTime(), true).'</div>'. "<small>".$langBlogPostUser.display_user($comment->getAuthor(), false, false)."</small>". $post_actions ."<div class='margin-top-thin' id='comment_content-".$comment->getId()."'>". q($comment->getContent()) ."</div> </div> </div> </div> </div>"; } } $out .= "</div>"; if (is_null($courseCode)) { //for the case of personal blog posts comments if (isset($_SESSION['uid'])) { $out .= '<form action="" onsubmit="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'new\','.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsSaveConfirm.'\'); return false;">'; $out .= '<textarea class="form-control" name="textarea" id="textarea-'.$this->rid.'" rows="5"></textarea><br/>'; $out .= '<input class="btn btn-primary" name="send_button" type="submit" value="'.$langSubmit.'" />'; $out .= '</form>'; } } else { if (Commenting::permCreate($isEditor, $uid, course_code_to_id($courseCode))) { $out .= '<form action="" onsubmit="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$courseCode.'\', \'new\','.$this->rid.', \''.$this->rtype.'\', \''.$langCommentsSaveConfirm.'\'); return false;">'; $out .= '<textarea class="form-control" name="textarea" id="textarea-'.$this->rid.'" rows="5"></textarea><br/>'; $out .= '<input class="btn btn-primary" name="send_button" type="submit" value="'.$langSubmit.'" />'; $out .= '</form>'; } } if (!$always_open) { $out .= '<div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div>'; $out .= '</div>'; } $out .= '</div>'; $out .= '</div>'; return $out; }
/** * Injects all commenting module code in other subsystems * @param courseCode the course code * @param $isEditor * @param $uid the user id * @return string */ public function put($courseCode, $isEditor, $uid, $always_open = false) { global $langComments, $langBlogPostUser, $langSubmit, $themeimg, $langModify, $langDelete, $langCommentsDelConfirm, $langCommentsSaveConfirm, $urlServer, $head_content; //$head_content .= '<link rel="stylesheet" type="text/css" href="'.$urlServer.'modules/comments/style.css">'; $commentsNum = $this->getCommentsNum(); if (!$always_open) { $comments_title = "<a id='comments_title' href='javascript:void(0)' onclick='showComments(\"{$this->rid}\")'>{$langComments} (<span id='commentsNum-{$this->rid}'>{$commentsNum}</span>)</a><br>"; $comments_display = "style='display:none'"; } else { $comments_title = "<h3 id='comments_title'>{$langComments} (<span id='commentsNum-{$this->rid}'>{$commentsNum}</span>)</h3><br>"; $comments_display = ""; } //the array is declared in commenting.js $out = "<script type='text/javascript'>showCommentArea[{$this->rid}] = false;</script>\r\n <div class='commenting'>\r\n {$comments_title}\r\n <div class='commentArea' id='commentArea-{$this->rid}' {$comments_display}>\r\n <div id='comments-{$this->rid}'>"; if ($commentsNum != 0) { //retrieve comments $comments = $this->getCommentsDB(); foreach ($comments as $comment) { if ($comment->permEdit($isEditor, $uid)) { $post_actions = '<div class="pull-right">'; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\'' . $urlServer . 'modules/comments/comments.php?course=' . $courseCode . '\', \'editLoad\', ' . $this->rid . ', \'' . $this->rtype . '\', \'\', ' . $comment->getId() . ')">'; $post_actions .= icon('fa-edit', $langModify) . '</a> '; $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\'' . $urlServer . 'modules/comments/comments.php?course=' . $courseCode . '\', \'delete\', ' . $this->rid . ', \'' . $this->rtype . '\', \'' . $langCommentsDelConfirm . '\', ' . $comment->getId() . ')">'; $post_actions .= icon('fa-times', $langDelete) . '</a>'; $post_actions .= '</div>'; } else { $post_actions = ''; } $out .= "<div class='row margin-bottom-thin margin-top-thin comment' id='comment-" . $comment->getId() . "'>\r\n <div class='col-xs-12'>\r\n <div class='media'>\r\n <a class='media-left' href='#'>\r\n " . profile_image($comment->getAuthor(), IMAGESIZE_SMALL) . "\r\n </a>\r\n <div class='media-body bubble'>\r\n <div class='label label-success media-heading'>" . nice_format($comment->getTime(), true) . '</div>' . "<small>" . $langBlogPostUser . display_user($comment->getAuthor(), false, false) . "</small>" . $post_actions . "<div class='margin-top-thin' id='comment_content-" . $comment->getId() . "'>" . q($comment->getContent()) . "</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>"; } } $out .= "</div>"; if (Commenting::permCreate($isEditor, $uid, course_code_to_id($courseCode))) { $out .= '<form action="" onsubmit="xmlhttpPost(\'' . $urlServer . 'modules/comments/comments.php?course=' . $courseCode . '\', \'new\',' . $this->rid . ', \'' . $this->rtype . '\', \'' . $langCommentsSaveConfirm . '\'); return false;">'; $out .= '<textarea class="form-control" name="textarea" id="textarea-' . $this->rid . '" rows="5"></textarea><br/>'; $out .= '<input class="btn btn-primary" name="send_button" type="submit" value="' . $langSubmit . '" />'; $out .= '</form>'; } $out .= '</div>'; $out .= '</div>'; return $out; }
* be useful (without any warranty), under the terms of the GNU (General * Public License) as published by the Free Software Foundation. * The full license can be read in "/info/license/license_gpl.txt". * * Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ /** * @file link.php * @brief redirect user to external link */ $require_current_course = TRUE; $require_help = true; $helpTopic = 'Link'; $guest_allowed = true; require_once '../../include/baseTheme.php'; $course_id = course_code_to_id($_GET['course']); $id = $_GET['id']; if ($course_id !== false) { Database::get()->query("UPDATE link SET hits = hits + 1 WHERE course_id = ?d AND id = ?d", $course_id, $id); $q = Database::get()->querySingle("SELECT url FROM link WHERE course_id = ?d AND id = ?d", $course_id, $id); if ($q) { $url = $q->url; header('Location: ' . $url); exit; } } Session::Messages($langAccountResetInvalidLink, 'alert-danger'); header('Location: ' . $urlServer);