/** * Returns an HTML Form for editing the XML. * * @global string $course_code * @global string $langSubmit * @global string $langRequiredFields * @param array $data - array containing data to preload the form with * @return string */ public function asForm($data = null) { global $course_code, $langSubmit, $langRequiredFields, $langBack;; $out = action_bar(array( array('title' => $langBack, 'url' => "index.php", 'icon' => 'fa-reply', 'level' => 'primary-label')),false); $out .= "<div class='right smaller'>$langRequiredFields</div>"; $out .= " <form class='form-horizontal' role='form' method='post' enctype='multipart/form-data' action='" . $_SERVER['SCRIPT_NAME'] . "?course=$course_code'> <ul class='nav nav-tabs' role='tablist'> <li class='active'><a href='#tabs-1' role='tab' data-toggle='tab'>" . $GLOBALS['langCMeta']['courseGroup'] . "</a></li> <li><a href='#tabs-2' role='tab' data-toggle='tab'>" . $GLOBALS['langCMeta']['instructorGroup'] . "</a></li> <li><a href='#tabs-3' role='tab' data-toggle='tab'>" . $GLOBALS['langCMeta']['curriculumGroup'] . "</a></li> <li><a href='#tabs-4' role='tab' data-toggle='tab'>" . $GLOBALS['langCMeta']['unitsGroup'] . "</a></li> </ul> <div class='tab-content'> <div class='tab-pane fade in active' id='tabs-1' style='padding-top:20px'>"; if ($data != null) { $this->populate($data); } $out .= $this->populateForm(); $out .= "</div> <p class='right'><input class='btn btn-primary' type='submit' name='submit' value='$langSubmit'></p> </div> </form> <div class='right smaller'>$langRequiredFields</div>"; return $out; }
function statistics_tools($course_code, $self_link = "", $relative_path = "") { global $tool_content, $langStat, $langUsersLog, $langFavourite, $langUserLogins, $langUserDuration, $langLearningPaths, $langGroupUsage, $langOldStats, $langAccept, $langOldStatsExpireConfirm; return $tool_content .= action_bar(array( array('title' => $langStat, 'url' => $relative_path . "index.php?course=$course_code", 'icon' => 'fa-bar-chart', 'show' => $self_link != "index", 'level' => 'primary-label'), array('title' => $langUsersLog, 'url' => $relative_path . "displaylog.php?course=$course_code", 'icon' => 'fa-user', 'show' => $self_link != "displaylog", 'level' => 'primary'), array('title' => $langFavourite, 'url' => $relative_path . "favourite.php?course=$course_code&first=", 'icon' => 'fa-gear', 'show' => $self_link != "favourite", 'level' => 'primary'), array('title' => $langUserLogins, 'url' => $relative_path . "userlogins.php?course=$course_code&first=", 'icon' => ' fa-comments-o', 'show' => $self_link != "userlogins", 'level' => 'primary'), array('title' => $langUserDuration, 'url' => $relative_path . "userduration.php?course=$course_code", 'icon' => 'fa-clock-o', 'show' => $self_link != "userduration", 'level' => 'primary'), array('title' => $langLearningPaths, 'url' => $relative_path . "../learnPath/detailsAll.php?course=$course_code&from_stats=1", 'icon' => 'fa-ellipsis-h', 'show' => $self_link != "detailsAll"), array('title' => $langGroupUsage, 'url' => $relative_path . "group.php?course=$course_code", 'icon' => 'fa-users', 'show' => $self_link != "group"), array('title' => $langOldStats, 'url' => $relative_path . 'oldStats.php?course=' . $course_code, 'icon' => 'fa-calendar', 'confirm_title' => $langOldStats, 'confirm_button' => $langAccept, 'confirm' => $langOldStatsExpireConfirm, 'show' => $self_link != "oldStats"), )); }
function admin_statistics_tools($self_link = "") { global $tool_content, $langPlatformGenStats, $langVisitsStats, $langVisitsCourseStats, $langBack, $langOldStats, $langAccept, $langOldStatsExpireConfirm, $langMonthlyReport; $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "", 'icon' => 'fa-reply', 'level' => 'primary-label'), array('title' => $langPlatformGenStats, 'url' => "stateclass.php", 'icon' => 'fa-bar-chart', 'show' => $self_link != "stateclass", 'level' => 'primary-label'), array('title' => $langVisitsStats, 'url' => "platformStats.php?first=", 'icon' => 'fa-sign-in', 'show' => $self_link != "platformStats", 'level' => 'primary'), array('title' => $langVisitsCourseStats, 'url' => "visitsCourseStats.php?first=", 'icon' => 'fa-user', 'show' => $self_link != "visitsCourseStats", 'level' => 'primary'), array('title' => $langOldStats, 'url' => "oldStats.php", 'icon' => 'fa-file-text-o', 'level' => 'primary', 'confirm_title' => $langOldStats, 'confirm_button' => $langAccept, 'show' => $self_link != "oldStats", 'confirm' => $langOldStatsExpireConfirm), array('title' => $langMonthlyReport, 'url' => "monthlyReport.php", 'icon' => 'fa-calendar', 'show' => $self_link != "monthlyReport", 'level' => 'primary'), )); }
require_once 'archive_functions.php'; $toolName = $langCourseInfo; $pageName = $langArchiveCourse; $navigation[] = array('url' => "index.php?course=$course_code", 'name' => $langCourseInfo); if (!isset($_GET['token']) || !validate_csrf_token($_GET['token'])) csrf_token_error(); doArchive($course_id, $course_code); $tool_content .= " <div class='alert alert-info'> <ol> <li>$langBUCourseDataOfMainBase $course_code</li> <li>$langBackupOfDataBase $course_code</li> </ol> </div> <div class='alert alert-success'>$langBackupSuccesfull</div>" . action_bar(array( array('title' => $langDownloadIt, 'url' => $urlAppend . "courses/archive/$course_code/$course_code-" . date('Ymd') . ".zip", 'icon' => 'fa-download', 'button-class' => 'btn-success', 'level' => 'primary-label'), array('title' => $langBack, 'url' => "index.php?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label')), false); draw($tool_content, 2);
$forum_name = $myrow->name; $forum_id = $myrow->id; if (isset($_GET['empty'])) { // if we come from newtopic.php $tool_content .= "<div class='alert alert-warning'>$langEmptyNewTopic</div>"; } $pageName = q($forum_name); if ($can_post) { $tool_content .= action_bar(array( array('title' => $langNewTopic, 'url' => "newtopic.php?course=$course_code&forum=$forum_id", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langBack, 'url' => "index.php?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label') )); } /* * Retrieve and present data from course's forum */ $total_topics = Database::get()->querySingle("SELECT num_topics FROM forum WHERE id = ?d AND course_id = ?d", $forum_id, $course_id)->num_topics;
$form_action_url .= isset($_GET['modifyCat']) ? "&modifyCat=" . intval($_GET['modifyCat']) : "&newCat=yes"; if (isset($_GET['modifyCat'])) { $q_cat = Database::get()->querySingle("SELECT * FROM exercise_question_cats WHERE question_cat_id = ?d", $_GET['modifyCat']); } $questionCatName = Session::has('questionCatName') ? Session::get('questionCatName') : (isset($q_cat) ? $q_cat->question_cat_name : ''); $tool_content .= action_bar(array(array('title' => $langBack, 'level' => 'primary-label', 'icon' => 'fa-reply', 'url' => "question_categories.php?course={$course_code}"))); $tool_content .= "\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form' action='{$form_action_url}' method='post'>\n <div class='form-group " . (Session::getError('questionCatName') ? "has-error" : "") . "'>\n <label for='questionCatName' class='col-sm-2 control-label'>{$langTitle}:</label>\n <div class='col-sm-10'>\n <input name='questionCatName' type='text' class='form-control' id='questionCatName' placeholder='{$langTitle}' value='{$questionCatName}'>\n <span class='help-block'>" . Session::getError('questionCatName') . "</span>\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-10 col-sm-offset-2'>\n <input class='btn btn-primary' name='submitCat' type='submit' value='{$langSubmit}'>\n <a href='question_categories.php?course={$course_code}' class='btn btn-default'>{$langCancel}</a>\n </div>\n </div> \n </form>\n </div>"; } elseif (isset($_GET['deleteCat'])) { $q_cat_id = $_GET['deleteCat']; if (Database::get()->query("DELETE FROM exercise_question_cats WHERE question_cat_id = ?d AND course_id = ?d", $q_cat_id, $course_id)->affectedRows > 0) { Database::get()->query("UPDATE exercise_question SET category = ?d WHERE category = ?d AND course_id = ?d", 0, $q_cat_id, $course_id); Session::Messages($langDelCatSuccess, 'alert-success'); } redirect_to_home_page("modules/exercise/question_categories.php?course={$course_code}"); } else { $pageName = $langQuestionCats; $navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langExercices); $tool_content .= action_bar(array(array('title' => $langNewCat, 'level' => 'primary-label', 'icon' => 'fa-plus-circle', 'url' => "question_categories.php?course={$course_code}&newCat=yes", 'button-class' => 'btn-success'), array('title' => $langBack, 'level' => 'primary', 'icon' => 'fa-reply', 'url' => "index.php?course={$course_code}"))); $q_cats = Database::get()->queryArray("SELECT * FROM exercise_question_cats WHERE course_id = ?d", $course_id); if (count($q_cats) > 0) { $tool_content .= "\n <div class='table-responsive'>\n <table class='table-default'>\n <tbody>\n <tr>\n <th>{$langTitle}</th>\n <th class='text-center'>" . icon('fa-gears') . "</th>\n </tr> \n "; foreach ($q_cats as $q_cat) { $action_button = action_button(array(array('title' => $langEdit, 'url' => "question_categories.php?course={$course_code}&modifyCat={$q_cat->question_cat_id}", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "question_categories.php?course={$course_code}&deleteCat={$q_cat->question_cat_id}", 'icon' => 'fa-times', 'confirm' => $langQuestionCatDelConfirrm, 'class' => 'delete'))); $tool_content .= "\n <tr>\n <td>{$q_cat->question_cat_name}</td>\n <td class='option-btn-cell'>{$action_button}</td>\n </tr>"; } $tool_content .= " \n </tbody>\n </table>\n </div>"; } else { $tool_content .= "<div class='alert alert-warning'>{$langNoQuestionCats}</div>"; } } draw($tool_content, 2, null, $head_content);
Database::get()->query('DELETE FROM module_disable'); if (isset($_POST['moduleDisable'])) { $optArray = implode(', ', array_fill(0, count($_POST['moduleDisable']), '(?d)')); Database::get()->query('INSERT INTO module_disable (module_id) VALUES ' . $optArray, array_keys($_POST['moduleDisable'])); } Session::Messages($langWikiEditionSucceed, 'alert-success'); redirect_to_home_page('modules/admin/modules.php'); } else { $disabled = array(); foreach (Database::get()->queryArray('SELECT module_id FROM module_disable') as $item) { $disabled[] = $item->module_id; } $tool_content .= action_bar(array( array('title' => $langBack, 'url' => $urlAppend . 'modules/admin/index.php', 'icon' => 'fa-reply', 'level' => 'primary-label')), false) . "<div class='alert alert-warning'>$langDisableModulesHelp</div> <div class='form-wrapper'> <form class='form-horizontal' role='form' action='modules.php' method='post'>"; $alwaysEnabled = array(MODULE_ID_AGENDA, MODULE_ID_DOCS, MODULE_ID_ANNOUNCE, MODULE_ID_DROPBOX, MODULE_ID_DESCRIPTION); foreach ($modules as $mid => $minfo) { if (in_array($mid, $alwaysEnabled)) { continue; } $checked = in_array($mid, $disabled)? ' checked': ''; $icon = $minfo['image']; if (isset($theme_settings['icon_map'][$icon])) { $icon = $theme_settings['icon_map'][$icon];
function create_restored_course(&$tool_content, $restoreThis, $course_code, $course_lang, $course_title, $course_desc, $course_vis, $course_prof) { global $webDir, $urlServer, $urlAppend, $langEnter, $langBack, $currentCourseCode; require_once 'modules/create_course/functions.php'; require_once 'modules/course_info/restorehelper.class.php'; require_once 'include/lib/fileManageLib.inc.php'; $new_course_code = null; $new_course_id = null; Database::get()->transaction(function() use (&$new_course_code, &$new_course_id, $restoreThis, $course_code, $course_lang, $course_title, $course_desc, $course_vis, $course_prof, $webDir, &$tool_content, $urlServer, $urlAppend) { $departments = array(); if (isset($_POST['department'])) { foreach ($_POST['department'] as $did) { $departments[] = intval($did); } } else { $minDep = Database::get()->querySingle("SELECT MIN(id) AS min FROM hierarchy"); if ($minDep) { $departments[0] = $minDep->min; } } $r = $restoreThis . '/html'; list($new_course_code, $new_course_id) = create_course($course_code, $course_lang, $course_title, $course_desc, $departments, $course_vis, $course_prof); if (!$new_course_code) { $tool_content = "<div class='alert alert-warning'>" . $GLOBALS['langError'] . "</div>"; draw($tool_content, 3); exit; } if (!file_exists($restoreThis)) { redirect_to_home_page('modules/course_info/restore_course.php'); } $config_data = unserialize(file_get_contents($restoreThis . '/config_vars')); // If old $urlAppend didn't end in /, add it if (substr($config_data['urlAppend'], -1) !== '/') { $config_data['urlAppend'] .= '/'; } $eclass_version = (isset($config_data['version'])) ? $config_data['version'] : null; $backupData = null; if (file_exists($restoreThis . '/backup.php')) { $backupData = parse_backup_php($restoreThis . '/backup.php'); $eclass_version = $backupData['eclass_version']; } $restoreHelper = new RestoreHelper($eclass_version); $course_file = $restoreThis . '/' . $restoreHelper->getFile('course'); if (file_exists($course_file)) { $course_dataArr = unserialize(file_get_contents($course_file)); $course_data = $course_dataArr[0]; // update course query $upd_course_sql = "UPDATE course SET keywords = ?s, doc_quota = ?f, video_quota = ?f, " . " group_quota = ?f, dropbox_quota = ?f, glossary_expand = ?d "; $upd_course_args = array( $course_data[$restoreHelper->getField('course', 'keywords')], floatval($course_data['doc_quota']), floatval($course_data['video_quota']), floatval($course_data['group_quota']), floatval($course_data['dropbox_quota']), intval($course_data[$restoreHelper->getField('course', 'glossary_expand')]) ); if (isset($course_data['home_layout']) and isset($course_data['course_image'])) { $upd_course_sql .= ', home_layout = ?d, course_image = ?s '; $upd_course_args[] = $course_data['home_layout']; $upd_course_args[] = $course_data['course_image']; } // Set keywords to '' if NULL if (!isset($upd_course_args[0])) { $upd_course_args[0] = ''; } // handle course weekly if exists if (isset($course_data['view_type']) && isset($course_data['start_date']) && isset($course_data['finish_date'])) { $upd_course_sql .= " , view_type = ?s, start_date = ?t, finish_date = ?t "; array_push($upd_course_args, $course_data['view_type'], $course_data['start_date'], $course_data['finish_date'] ); } $upd_course_sql .= " WHERE id = ?d "; array_push($upd_course_args, intval($new_course_id)); Database::get()->query($upd_course_sql, $upd_course_args); } $userid_map = array(); $user_file = $restoreThis . '/user'; if (file_exists($user_file)) { $cours_user = unserialize(file_get_contents($restoreThis . '/' . $restoreHelper->getFile('course_user'))); $userid_map = restore_users(unserialize(file_get_contents($user_file)), $cours_user, $departments, $restoreHelper); register_users($new_course_id, $userid_map, $cours_user, $restoreHelper); } $userid_map[0] = 0; $userid_map[-1] = -1; $coursedir = "${webDir}/courses/$new_course_code"; $videodir = "${webDir}/video/$new_course_code"; move_dir($r, $coursedir); if (is_dir($restoreThis . '/video_files')) { move_dir($restoreThis . '/video_files', $videodir); } course_index($new_course_code); $tool_content .= "<div class='alert alert-info'>" . $GLOBALS['langCopyFiles'] . " $coursedir</div>"; require_once 'upgrade/functions.php'; load_global_messages(); $url_prefix_map = array( $config_data['urlServer'] . 'modules/ebook/show.php/' . $course_data['code'] => $urlServer . 'modules/ebook/show.php/' . $new_course_code, $config_data['urlAppend'] . 'modules/ebook/show.php/' . $course_data['code'] => $urlAppend . 'modules/ebook/show.php/' . $new_course_code, $config_data['urlServer'] . 'modules/document/file.php/' . $course_data['code'] => $urlServer . 'modules/document/file.php/' . $new_course_code, $config_data['urlAppend'] . 'modules/document/file.php/' . $course_data['code'] => $urlAppend . 'modules/document/file.php/' . $new_course_code, $config_data['urlServer'] . 'courses/' . $course_data['code'] => $urlServer . 'courses/' . $new_course_code, $config_data['urlAppend'] . 'courses/' . $course_data['code'] => $urlAppend . 'courses/' . $new_course_code, $course_data['code'] => $new_course_code); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_3X) { restore_table($restoreThis, 'course_module', array('set' => array('course_id' => $new_course_id), 'delete' => array('id')), $url_prefix_map, $backupData, $restoreHelper); } else if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X) { create_modules($new_course_id); foreach (get_tabledata_from_parsed('accueil', $backupData, $restoreHelper) as $accueil) { Database::get()->query('UPDATE course_module SET visible = ?d WHERE course_id = ?d AND module_id = ?d', $accueil['visible'], $new_course_id, $accueil['id']); } } restore_table($restoreThis, 'announcement', array('set' => array('course_id' => $new_course_id), 'delete' => array('id', 'preview')), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'group_properties', array('set' => array('course_id' => $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); $group_map = restore_table($restoreThis, 'group', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'group_members', array('map' => array('group_id' => $group_map, 'user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Forums Restore $forum_category_map = restore_table($restoreThis, 'forum_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $forum_category_map[0] = 0; $forum_map = restore_table($restoreThis, 'forum', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id', 'map' => array('cat_id' => $forum_category_map)), $url_prefix_map, $backupData, $restoreHelper); $forum_map[0] = 0; $forum_topic_map = restore_table($restoreThis, 'forum_topic', array('return_mapping' => 'id', 'map' => array('forum_id' => $forum_map, 'poster_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); $forum_topic_map[0] = 0; $forum_post_options = array('return_mapping' => 'id', 'map' => array('topic_id' => $forum_topic_map, 'poster_id' => $userid_map)); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X) { $forum_post_options['set'] = array('post_text' => ''); } $forum_post_map = restore_table($restoreThis, 'forum_post', $forum_post_options, $url_prefix_map, $backupData, $restoreHelper); $forum_post_map[0] = 0; restore_table($restoreThis, 'forum_notify', array('set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map, 'cat_id' => $forum_category_map, 'forum_id' => $forum_map, 'topic_id' => $forum_topic_map), 'delete' => array('id')), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'forum_user_stats', array('set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X && isset($backupData) && is_array($backupData) && isset($backupData['query']) && is_array($backupData['query'])) { $postsText = get_tabledata_from_parsed('posts_text', $backupData, $restoreHelper); foreach ($postsText as $ptData) { if (array_key_exists($ptData['post_id'], $forum_post_map)) { Database::get()->query("UPDATE forum_post SET post_text = ?s WHERE id = ?d", $ptData['post_text'], intval($forum_post_map[$ptData['post_id']])); } } } $forumLastPosts = Database::get()->queryArray("SELECT DISTINCT last_post_id FROM forum WHERE course_id = ?d ", intval($new_course_id)); if (is_array($forumLastPosts) && count($forumLastPosts) > 0) { foreach ($forumLastPosts as $lastPost) { if (isset($forum_post_map[$lastPost->last_post_id])) { Database::get()->query("UPDATE forum SET last_post_id = ?d WHERE course_id = ?d AND last_post_id = ?d", intval($forum_post_map[$lastPost->last_post_id]), intval($new_course_id), intval($lastPost->last_post_id)); } } } $topicLastPosts = Database::get()->queryArray("SELECT DISTINCT last_post_id FROM forum_topic WHERE forum_id IN (SELECT id FROM forum WHERE course_id = ?d)", intval($new_course_id)); if (is_array($topicLastPosts) && count($topicLastPosts) > 0) { foreach ($topicLastPosts as $lastPost) { if (isset($forum_post_map[$lastPost->last_post_id])) { Database::get()->query("UPDATE forum_topic SET last_post_id = ?d WHERE last_post_id = ?d", intval($forum_post_map[$lastPost->last_post_id]), intval($lastPost->last_post_id)); } } } $parentPosts = Database::get()->queryArray("SELECT DISTINCT parent_post_id FROM forum_post WHERE topic_id IN (SELECT id FROM forum_topic WHERE forum_id IN (SELECT id FROM forum WHERE course_id = ?d))", intval($new_course_id)); if (is_array($parentPosts) && count($parentPosts) > 0) { foreach ($parentPosts as $parentPost) { if (isset($forum_post_map[$parentPost->parent_post_id])) { Database::get()->query("UPDATE forum_post SET parent_post_id = ?d WHERE parent_post_id = ?d", intval($forum_post_map[$parentPost->parent_post_id]), intval($parentPost->parent_post_id)); } } } // Forums Restore End // Glossary Restore $glossary_category_map = restore_table($restoreThis, 'glossary_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $glossary_category_map[0] = 0; restore_table($restoreThis, 'glossary', array('set' => array('course_id' => $new_course_id), 'delete' => array('id'), 'map' => array('category_id' => $glossary_category_map)), $url_prefix_map, $backupData, $restoreHelper); // Glossary Restore End $link_category_map = restore_table($restoreThis, 'link_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $link_category_map[0] = 0; $link_category_map[-1] = -1; $link_category_map[-2] = -2; $link_map = restore_table($restoreThis, 'link', array('set' => array('course_id' => $new_course_id), 'map' => array('category' => $link_category_map, 'user_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_map = restore_table($restoreThis, 'ebook', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); foreach ($ebook_map as $old_id => $new_id) { // new and old id might overlap as the map contains multiple values! rename("$coursedir/ebook/$old_id", "$coursedir/ebook/__during_restore__$new_id"); } foreach ($ebook_map as $old_id => $new_id) { // better to use an intermediary rename step rename("$coursedir/ebook/__during_restore__$new_id", "$coursedir/ebook/$new_id"); } $document_map = restore_table($restoreThis, 'document', array('set' => array('course_id' => $new_course_id), 'map_function' => 'document_map_function', 'map_function_data' => array(1 => $group_map, 2 => $ebook_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_section_map = restore_table($restoreThis, 'ebook_section', array('map' => array('ebook_id' => $ebook_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_subsection_map = restore_table($restoreThis, 'ebook_subsection', array('map' => array('section_id' => $ebook_section_map, 'file_id' => $document_map), 'delete' => array('file'), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); // Video $videocat_map = restore_table($restoreThis, 'video_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $videocat_map[''] = ''; $videocat_map[0] = 0; $video_map = restore_table($restoreThis, 'video', array( 'map' => array('category' => $videocat_map), 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $videolink_map = restore_table($restoreThis, 'videolink', array( 'map' => array('category' => $videocat_map), 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); // Dropbox $dropbox_map = restore_table($restoreThis, 'dropbox_msg', array('set' => array('course_id' => $new_course_id), 'map' => array('author_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'dropbox_attachment', array('map' => array('msg_id' => $dropbox_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'dropbox_index', array('map' => array('msg_id' => $dropbox_map, 'recipient_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Learning Path $lp_learnPath_map = restore_table($restoreThis, 'lp_learnPath', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'learnPath_id'), $url_prefix_map, $backupData, $restoreHelper); $lp_module_map = restore_table($restoreThis, 'lp_module', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'module_id'), $url_prefix_map, $backupData, $restoreHelper); $lp_asset_map = restore_table($restoreThis, 'lp_asset', array('map' => array('module_id' => $lp_module_map), 'return_mapping' => 'asset_id'), $url_prefix_map, $backupData, $restoreHelper); // update lp_module startAsset_id with new asset_id from map foreach ($lp_asset_map as $key => $value) { Database::get()->query("UPDATE lp_module SET `startAsset_id` = ?d " . "WHERE `course_id` = ?d " . "AND `startAsset_id` = ?d", intval($value), intval($new_course_id), intval($key)); } $lp_rel_learnPath_module_map = restore_table($restoreThis, 'lp_rel_learnPath_module', array('map' => array('learnPath_id' => $lp_learnPath_map, 'module_id' => $lp_module_map), 'return_mapping' => 'learnPath_module_id'), $url_prefix_map, $backupData, $restoreHelper); // update parent foreach ($lp_rel_learnPath_module_map as $key => $value) { Database::get()->query("UPDATE lp_rel_learnPath_module SET `parent` = ?d " . "WHERE `learnPath_id` IN (SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d) " . "AND `parent` = ?d", intval($value), intval($new_course_id), intval($key)); } restore_table($restoreThis, 'lp_user_module_progress', array('delete' => array('user_module_progress_id'), 'map' => array('user_id' => $userid_map, 'learnPath_module_id' => $lp_rel_learnPath_module_map, 'learnPath_id' => $lp_learnPath_map)), $url_prefix_map, $backupData, $restoreHelper); foreach ($lp_learnPath_map as $old_id => $new_id) { // new and old id might overlap as the map contains multiple values! $old_dir = "$coursedir/scormPackages/path_$old_id"; if (file_exists($old_dir) && is_dir($old_dir)) { rename($old_dir, "$coursedir/scormPackages/__during_restore__$new_id"); } } foreach ($lp_learnPath_map as $old_id => $new_id) { // better to use an intermediary rename step $tempLPDir = "$coursedir/scormPackages/__during_restore__$new_id"; if (file_exists($tempLPDir) && is_dir($tempLPDir)) { rename($tempLPDir, "$coursedir/scormPackages/path_$new_id"); } } // Wiki $wiki_map = restore_table($restoreThis, 'wiki_properties', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'wiki_acls', array('map' => array('wiki_id' => $wiki_map)), $url_prefix_map, $backupData, $restoreHelper); $wiki_pages_map = restore_table($restoreThis, 'wiki_pages', array('map' => array('wiki_id' => $wiki_map, 'owner_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'wiki_pages_content', array('delete' => array('id'), 'map' => array('pid' => $wiki_pages_map, 'editor_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Blog if (file_exists("$restoreThis/blog_post")) { $blog_map = restore_table($restoreThis, 'blog_post', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); } // Comments if (file_exists("$restoreThis/comments")) { $comment_map = restore_table($restoreThis, 'comments', array('delete' => array('id'), 'map' => array('user_id' => $userid_map), 'map_function' => 'comments_map_function', 'map_function_data' => array($blog_map, $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); } //Abuse Report if (file_exists("$restoreThis/abuse_report")) { restore_table($restoreThis, 'abuse_report', array('delete' => array('id'), 'set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map), 'map_function' => 'abuse_report_map_function', 'map_function_data' => array($forum_post_map, $comment_map, $link_map)), $url_prefix_map, $backupData, $restoreHelper); } // Rating if (file_exists("$restoreThis/rating")) { restore_table($restoreThis, 'rating', array('delete' => array('rate_id'), 'map' => array('user_id' => $userid_map), 'map_function' => 'ratings_map_function', 'map_function_data' => array($blog_map, $forum_post_map, $link_map, $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } if (file_exists("$restoreThis/rating_cache")) { restore_table($restoreThis, 'rating_cache', array('delete' => array('rate_cache_id'), 'map_function' => 'ratings_map_function', 'map_function_data' => array($blog_map, $forum_post_map, $link_map, $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } // Course_settings if (file_exists("$restoreThis/course_settings")) { restore_table($restoreThis, 'course_settings', array('set' => array('course_id' => $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } // Polls $poll_map = restore_table($restoreThis, 'poll', array('set' => array('course_id' => $new_course_id), 'map' => array('creator_id' => $userid_map), 'return_mapping' => 'pid', 'delete' => array('type')), $url_prefix_map, $backupData, $restoreHelper); $poll_question_map = restore_table($restoreThis, 'poll_question', array('map' => array('pid' => $poll_map), 'return_mapping' => 'pqid'), $url_prefix_map, $backupData, $restoreHelper); $poll_answer_map = restore_table($restoreThis, 'poll_question_answer', array('map' => array('pqid' => $poll_question_map), 'return_mapping' => 'pqaid'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'poll_answer_record', array('delete' => array('arid'), 'map' => array('pid' => $poll_map, 'qid' => $poll_question_map, 'aid' => $poll_answer_map, 'user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Assignments if (!isset($group_map[0])) { $group_map[0] = 0; } $assignments_map = restore_table($restoreThis, 'assignment', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $assignments_map[0] = 0; restore_table($restoreThis, 'assignment_submit', array('delete' => array('id'), 'map' => array('uid' => $userid_map, 'assignment_id' => $assignments_map, 'group_id' => $group_map)), $url_prefix_map, $backupData, $restoreHelper); // Agenda $agenda_map = restore_table($restoreThis, 'agenda', array( 'return_mapping' => 'id', 'set' => array('course_id' => $new_course_id) ), $url_prefix_map, $backupData, $restoreHelper); $agenda_map[0] = 0; // Exercises $exercise_map = restore_table($restoreThis, 'exercise', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $exercise_map[0] = 0; restore_table($restoreThis, 'exercise_user_record', array( 'delete' => array('eurid'), 'map' => array('eid' => $exercise_map, 'uid' => $userid_map) ), $url_prefix_map, $backupData, $restoreHelper); $question_category_map = restore_table($restoreThis, 'exercise_question_cats', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'question_cat_id' ), $url_prefix_map, $backupData, $restoreHelper); $question_category_map[0] = 0; $question_map = restore_table($restoreThis, 'exercise_question', array( 'set' => array('course_id' => $new_course_id), 'init' => array('category' => 0), 'map' => array('category' => $question_category_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_answer', array( 'delete' => array('id'), 'map' => array('question_id' => $question_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_answer_record', array( 'delete' => array('answer_record_id'), 'map' => array('question_id' => $question_map, 'eurid' => $userid_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_with_questions', array( 'map' => array('question_id' => $question_map, 'exercise_id' => $exercise_map) ), $url_prefix_map, $backupData, $restoreHelper); $sql = "SELECT asset.asset_id, asset.path FROM `lp_module` AS module, `lp_asset` AS asset WHERE module.startAsset_id = asset.asset_id AND course_id = ?d AND contentType = 'EXERCISE' AND path <> '' AND path IS NOT NULL"; $rows = Database::get()->queryArray($sql, intval($new_course_id)); if (is_array($rows) && count($rows) > 0) { foreach ($rows as $row) { Database::get()->query("UPDATE `lp_asset` SET path = ?s WHERE asset_id = ?d", $exercise_map[$row->path], intval($row->asset_id)); } } // Attendance $attendance_map = restore_table($restoreThis, 'attendance', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $attendance_activities_map = restore_table($restoreThis, 'attendance_activities', array( 'map' => array('attendance_id' => $attendance_map), 'map_function' => 'attendance_gradebook_activities_map_function', 'map_function_data' => array($assignments_map, $exercise_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'attendance_book', array( 'map' => array( 'attendance_activity_id' => $attendance_activities_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'attendance_users', array( 'map' => array( 'attendance_id' => $attendance_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Gradebook $gradebook_map = restore_table($restoreThis, 'gradebook', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $gradebook_activities_map = restore_table($restoreThis, 'gradebook_activities', array( 'map' => array('gradebook_id' => $gradebook_map), 'map_function' => 'attendance_gradebook_activities_map_function', 'map_function_data' => array($assignments_map, $exercise_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'gradebook_book', array( 'map' => array( 'gradebook_activity_id' => $gradebook_activities_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'gradebook_users', array( 'map' => array( 'gradebook_id' => $gradebook_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Notes restore_table($restoreThis, 'note', array( 'set' => array('reference_obj_course' => $new_course_id), 'map' => array('user_id' => $userid_map), 'map_function' => 'notes_map_function', 'map_function_data' => array($new_course_id, $agenda_map, $document_map, $link_map, $video_map, $videolink_map, $assignments_map, $exercise_map, $ebook_map, $lp_learnPath_map), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Units $unit_map = restore_table($restoreThis, 'course_units', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'unit_resources', array('delete' => array('id'), 'map' => array('unit_id' => $unit_map), 'map_function' => 'unit_map_function', 'map_function_data' => array($document_map, $link_category_map, $link_map, $ebook_map, $ebook_section_map, $ebook_subsection_map, $video_map, $videolink_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map) ), $url_prefix_map, $backupData, $restoreHelper); // Weekly $weekly_map = restore_table($restoreThis, 'course_weekly_view', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'course_weekly_view_activities', array( 'delete' => array('id'), 'map' => array('course_weekly_view_id' => $weekly_map), 'map_function' => 'unit_map_function', 'map_function_data' => array($document_map, $link_category_map, $link_map, $ebook_map, $ebook_section_map, $ebook_subsection_map, $video_map, $videolink_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'course_description', array( 'set' => array('course_id' => $new_course_id), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); removeDir($restoreThis); // index course after restoring require_once 'modules/search/indexer.class.php'; Indexer::queueAsync(Indexer::REQUEST_REMOVEALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id); Indexer::queueAsync(Indexer::REQUEST_STOREALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id); }); // check/cleanup video files after restore transaction if ($new_course_code != null && $new_course_id != null) { $videodir = $webDir . "/video/" . $new_course_code; $videos = scandir($videodir); foreach ($videos as $videofile) { if (is_dir($videofile)) { continue; } $vlike = '/' . $videofile; if (!isWhitelistAllowed($videofile)) { unlink($videodir . "/" . $videofile); Database::get()->query("DELETE FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike); continue; } $vcnt = Database::get()->querySingle("SELECT count(id) AS count FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike)->count; if ($vcnt <= 0) { unlink($videodir . "/" . $videofile); } } $backUrl = $urlAppend . (isset($currentCourseCode)? "courses/$currentCourseCode/": 'modules/admin/'); $tool_content .= action_bar(array( array('title' => $langEnter, 'url' => $urlAppend . "courses/$new_course_code/", 'icon' => 'fa-arrow-right', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langBack, 'url' => $backUrl, 'icon' => 'fa-reply', 'level' => 'primary-label')), false); } }
* End of prof only * ------------------------------------------- */ // display action bar if (!isset($_GET['addEvent']) && !isset($_GET['edit'])) { $tool_content .= action_bar(array( array('title' => $langAddEvent, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&addEvent=1", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success', 'show' => $is_editor), array('title' => $langListCalendar, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'icon' => 'fa-list', 'level' => 'primary-label', 'button-class' => 'btn-default', 'show' => (($view == EVENT_LIST_VIEW) and (!isset($id)))), array('title' => $langListAll, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&v=1", 'icon' => 'fa-list', 'level' => 'primary-label', 'button-class' => 'btn-default', 'show' => ($view == EVENT_CALENDAR_VIEW or isset($id))), array('title' => $langiCalExport, 'url' => "icalendar.php?c=$course_id", 'icon' => 'fa-calendar', 'level' => 'primary') )); if (isset($_GET['id'])) { $cal_content_list = event_list_view($id); } else { $cal_content_list = event_list_view();
/** * @brief A page that shows a table with statistic data and a gauge bar * @global type $langQuotaUsed * @global type $langQuotaPercentage * @global type $langQuotaTotal * @global type $langBack * @global type $langQuotaBar * @global type $course_code * @global type $subsystem * @global type $group_id * @global type $ebook_id * @param type $quota * @param type $used * @return string */ function showquota($quota, $used) { global $langQuotaUsed, $langQuotaPercentage, $langQuotaTotal, $langBack, $langQuotaBar, $course_code, $subsystem, $group_id, $ebook_id, $pageName; $retstring = ''; // pososto xrhsimopoioumenou xorou se % $diskUsedPercentage = round($used / $quota * 100) . "%"; // morfopoihsh tou synolikou diathesimou megethous tou quota $quota = format_bytesize($quota / 1024); // morfopoihsh tou synolikou megethous pou xrhsimopoieitai $used = format_bytesize($used / 1024); // telos diamorfwshs ths grafikh mparas kai twn arithmitikwn statistikwn stoixeiwn // ektypwsh pinaka me arithmitika stoixeia + thn grafikh bara if ($subsystem == GROUP) { $link = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&group_id={$group_id}"; } elseif ($subsystem == EBOOK) { $link = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&ebook_id={$ebook_id}"; } else { $link = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}"; } $pageName = $langQuotaBar; $retstring .= action_bar(array(array('title' => $langBack, 'url' => $link, 'icon' => 'fa-reply', 'level' => 'primary-label'))); $retstring .= "\n <div class='row'><div class='col-sm-12'>\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form'>\n <div class='form-group'>\n <label class='col-sm-2'>{$langQuotaUsed}:</label>\n <div class='col-sm-10'>\n <p class='form-control-static'>{$used}</p>\n </div>\n </div>\n <div class='form-group'>\n <label class='col-sm-2'>{$langQuotaPercentage}:</label>\n <div class='col-sm-10'>\n <div class='progress'>\n <p class='progress-bar progress-bar-striped active from-control-static' role='progressbar' aria-valuenow='" . str_replace('%', '', $diskUsedPercentage) . "' aria-valuemin='0' aria-valuemax='100' style='width: {$diskUsedPercentage};'>\n {$diskUsedPercentage}\n </p>\n </div>\n </div>\n </div>\n <div class='form-group'>\n <label class='col-sm-2'>{$langQuotaTotal}:</label>\n <div class='col-sm-10'>\n <p class='form-control-static'>{$quota}</p>\n </div>\n </div> \n </form>\n </div></div></div>"; $tmp_cwd = getcwd(); return $retstring; }
action_bar(array( array('title' => $langEditUnitSection, 'url' => "info.php?course=$course_code&edit=$id&cnt=$cnt", 'icon' => 'fa fa-edit', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langAdd.' '.$langInsertExercise, 'url' => $base_url . 'exercise', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertDoc, 'url' => $base_url . 'doc', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertText, 'url' => $base_url . 'text', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertLink, 'url' => $base_url . 'link', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langLearningPath1, 'url' => $base_url . 'lp', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertVideo, 'url' => $base_url . 'video', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertForum, 'url' => $base_url . 'forum', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertEBook, 'url' => $base_url . 'ebook', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertWork, 'url' => $base_url . 'work', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertPoll, 'url' => $base_url . 'poll', 'icon' => 'fa fa-paste', 'level' => 'secondary'), array('title' => $langAdd.' '.$langInsertWiki, 'url' => $base_url . 'wiki', 'icon' => 'fa fa-paste', 'level' => 'secondary'), )) .
'level' => 'primary-label'), array('title' => $langEmailUnsubscribe, 'url' => "emailunsubscribe.php", 'icon' => 'fa-envelope', 'level' => 'primary'), array('title' => $langUnregUser, 'url' => "../unreguser.php", 'icon' => 'fa-times', 'level' => 'primary') )); } else { if (get_config('dropbox_allow_personal_messages')) { $tool_content .= action_bar(array( array('title' => $langProfileSendMail, 'url' => "../../modules/dropbox/index.php?upload=1&id=$id", 'icon' => 'fa-envelope', 'level' => 'primary-label') )); } } // hybridauth providers information. available only for the current user. $providers = ''; if ($id == $uid) { $providers_text = ''; $extAuthList = Database::get()->queryArray("SELECT auth.auth_id, auth_name FROM auth, user_ext_uid WHERE auth.auth_id = user_ext_uid.auth_id AND user_ext_uid.user_id = ?d", $id); foreach ($extAuthList as $item) { $fullName = q($authFullName[$item->auth_id]); $providers_text .= " <span class='tag-value'><img src='$themeimg/{$item->auth_name}.png' alt=''> $fullName</span>"; }
WHERE ebook_id = ?d ORDER BY CONVERT(public_id, UNSIGNED), public_id", $info->id); $sections = array('' => '---'); foreach ($q as $section) { $sid = $section->id; $qsid = q($section->public_id); $qstitle = q($section->title); $sections[$sid] = $qsid . '. ' . ellipsize($section->title, 25); } $pageName = $langEBookPages; $tool_content .= action_bar(array( array('title' => $langNewEBookPage, 'url' => "new.php?course=$course_code&ebook_id=$ebook_id&from=ebookEdit", 'icon' => 'fa-plus-circle', 'button-class' => 'btn-success', 'level' => 'primary-label'), array('title' => $langFileAdmin, 'url' => "document.php?course=$course_code&ebook_id=$ebook_id", 'icon' => 'fa-hdd-o', 'level' => 'primary-label') )); // Form #3 - edit subsection file assignment $q = Database::get()->queryArray("SELECT ebook_section.id AS sid, ebook_section.id AS psid, ebook_section.title AS section_title, ebook_subsection.id AS ssid, ebook_subsection.public_id AS pssid, ebook_subsection.title AS subsection_title, ebook_subsection.file_id as file_id FROM ebook_section, ebook_subsection WHERE ebook_section.ebook_id = $info->id AND
// adds the exercise ID into the list of exercises for the current question $objQuestionTmp->addToList($fromExercise); } // destruction of the Question object unset($objQuestionTmp); // adds the question ID into the list of questions for the current exercise $objExercise->addToList($recup); Session::Messages($langQuestionReused, 'alert-success'); redirect_to_home_page("modules/exercise/question_pool.php?course={$course_code}" . (isset($fromExercise) ? "&fromExercise={$fromExercise}" : "") . "&exerciseId={$exerciseId}"); } if (isset($fromExercise)) { $action_bar_options[] = array('title' => $langGoBackToEx, 'url' => "admin.php?course={$course_code}&exerciseId={$fromExercise}", 'icon' => 'fa-reply', 'level' => 'primary-label'); } else { $action_bar_options = array(array('title' => $langNewQu, 'url' => "admin.php?course={$course_code}&newQuestion=yes", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langImportQTI, 'url' => "admin.php?course={$course_code}&importIMSQTI=yes", 'icon' => 'fa-download', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langExportQTI, 'url' => "question_pool.php?" . $_SERVER['QUERY_STRING'] . "&exportIMSQTI=yes", 'icon' => 'fa-upload', 'level' => 'primary-label', 'button-class' => 'btn-success')); } $tool_content .= action_bar($action_bar_options); if (isset($fromExercise)) { $result = Database::get()->queryArray("SELECT id, title FROM `exercise` WHERE course_id = ?d AND id <> ?d ORDER BY id", $course_id, $fromExercise); } else { $result = Database::get()->queryArray("SELECT id, title FROM `exercise` WHERE course_id = ?d ORDER BY id", $course_id); } $exercise_options = "<option value = '0'>-- {$langAllExercises} --</option>\n\n <option value = '-1' " . (isset($exerciseId) && $exerciseId == -1 ? "selected='selected'" : "") . ">-- {$langOrphanQuestions} --</option>\n"; foreach ($result as $row) { $exercise_options .= "\n <option value='" . $row->id . "' " . (isset($exerciseId) && $exerciseId == $row->id ? "selected='selected'" : "") . ">{$row->title}</option>\n"; } //Create exercise category options $q_cats = Database::get()->queryArray("SELECT * FROM exercise_question_cats WHERE course_id = ?d", $course_id); $q_cat_options = "<option value='-1' " . (isset($categoryId) && $categoryId == -1 ? "selected" : "") . ">-- {$langQuestionAllCats} --</option>\\m\n <option value='0' " . (isset($categoryId) && $categoryId == 0 ? "selected" : "") . ">-- {$langQuestionWithoutCat} --</option>\n"; foreach ($q_cats as $q_cat) { $q_cat_options .= "<option value='" . $q_cat->question_cat_id . "' " . (isset($categoryId) && $categoryId == $q_cat->question_cat_id ? "selected" : "") . ">{$q_cat->question_cat_name}</option>\n"; }
$base = $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&' . $module . 'group_id=' . $group_id . ''; if (isset($_POST['user_date_start']) or isset($_POST['user_date_end'])) { $append_url_link = "&u_date_start=$_POST[user_date_start]&u_date_end=$_POST[user_date_end]"; } else { $append_url_link = ''; } $tool_content .= action_bar(array( array('title' => $langLearningPaths, 'url' => "$base&type=lp", 'icon' => 'fa-bar-chart', 'show' => $type == "duration", 'level' => 'primary'), array('title' => $langUsage, 'url' => "$base&type=duration", 'icon' => 'fa-bar-chart', 'show' => $type == "lp", 'level' => 'primary'), array('title' => "$langDumpUserDurationToFile ($langCodeUTF)", 'url' => "dumpgroupduration.php?course=$course_code&group_id=$group_id$append_url_link", 'icon' => 'fa-file-archive-o', 'level' => 'primary'), array('title' => "$langDumpUserDurationToFile ($langCodeWin)", 'url' => "dumpgroupduration.php?course=$course_code&group_id=$group_id$append_url_link", 'icon' => 'fa-file-archive-o', 'level' => 'primary'))); if ($type == 'duration') { $label = $langDuration; $min_date = Database::get()->querySingle("SELECT MIN(day) AS minday FROM actions_daily WHERE course_id = ?d", $course_id)->minday;
the_enclosure(); ?> </span> <?php } ?> <div class="excerpt"> <?php the_content(); ?> </div> <?php do_action('river_entry'); ?> <?php action_bar('before=&after= | '); ?> </div><?php $num++; } } elseif (!has_feeds()) { ?> <div style="border:1px solid #e7dc2b;background: #fff888;margin:15px;padding:10px;"><?php printf(_r('You haven\'t added any feeds yet. Add them from <a href="%s">your admin panel</a>'), 'admin/'); ?> </div> <?php } else { ?> <div style="border:1px solid #e7dc2b;background: #fff888;margin:15px;padding:10px;">No items available in the last <?php echo get_offset(true);
$tool_content .= " </fieldset> </form> </div> </div> </div>"; } else { $tool_content .= action_bar(array( array( 'title' => $langNewGradeScale, 'level' => 'primary-label', 'icon' => 'fa-plus-circle', 'url' => "grading_scales.php?course=$course_code&scale_id=0", 'button-class' => 'btn-success' ), array( 'title' => $langBack, 'level' => 'primary-label', 'icon' => 'fa-reply', 'url' => "index.php?course=$course_code" ), ),false); $grading_scales = Database::get()->queryArray("SELECT * FROM grading_scale WHERE course_id = ?d", $course_id); if ($grading_scales) { $table_content = ""; foreach ($grading_scales as $grading_scale) { $scales = unserialize($grading_scale->scales); $scales_list = ""; foreach ($scales as $scale) {
</div> ". generate_csrf_token_form_field() ." </form> </div>"; } $total_glossary_terms = Database::get()->querySingle("SELECT COUNT(*) AS count FROM glossary WHERE course_id = ?d", $course_id)->count; if ($expand_glossary and $total_glossary_terms > $max_glossary_terms) { $tool_content .= sprintf("<div class='alert alert-warning'>$langGlossaryOverLimit</div>", "<b>$max_glossary_terms</b>"); } } else { // Show categories link for students if needed if ($categories) { $tool_content .= action_bar(array( array('title' => $langCategories, 'url' => "categories.php?course=$course_code", 'icon' => 'fa-tasks', 'level' => 'primary-label'))); } } /* * *********************************************** // display glossary * *********************************************** */ $where = ''; $terms = array(); if (isset($_GET['edit'])) { $where = "AND id = ?d"; $terms[] = intval($id);
} if (@count($registration_errors) != 0) { // errors exist (from hybridauth) - show message $tool_content .= "<div class='alert alert-danger'>"; foreach ($registration_errors as $error) { $tool_content .= " $error"; } $tool_content .= "</div>"; $provider_name = ''; $provider_id =''; } $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "{$urlAppend}modules/auth/registration.php", 'icon' => 'fa-reply', 'level' => 'primary-label')), false); $tool_content .= @"<div class='form-wrapper'> <form class='form-horizontal' role='form' action='$_SERVER[REQUEST_URI]' method='post' onsubmit='return validateNodePickerForm();'> <fieldset> <div class='form-group'> <label for='Name' class='col-sm-2 control-label'>$langName:</label> <div class='col-sm-10'> <input class='form-control' type='text' name='givenname_form' size='30' maxlength='100'" . ($user_data? (" value='" . q($user_data->firstName) . "'"): '') . " placeholder='$langName'> </div> </div> <div class='form-group'> <label for='SurName' class='col-sm-2 control-label'>$langSurname:</label> <div class='col-sm-10'>
if (isset($_GET['addAnnounce'])) { $pageName = $langAdminAddAnn; } else { $pageName = $langAdminModifAnn; } $tool_content .= action_bar(array( array('title' => $langBack, 'url' => $_SERVER['SCRIPT_NAME'], 'icon' => 'fa-reply', 'level' => 'primary-label') )); } else { $tool_content .= action_bar(array( array('title' => $langAdminAddAnn, 'url' => $_SERVER['SCRIPT_NAME'] . "?addAnnounce=1", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success') )); } // modify visibility if (isset($_GET['vis'])) { $id = q($_GET['id']); $vis = q($_GET['vis']); Database::get()->query("UPDATE admin_announcement SET visible = ?b WHERE id = ?d", $vis, $id); } if (isset($_GET['delete'])) { // delete announcement command
$myrow = Database::get()->querySingle("SELECT id, name FROM forum WHERE id = ?d AND course_id = ?d", $forum, $course_id); $forum_name = $myrow->name; $forum_id = $myrow->id; $is_member = false; $group_id = init_forum_group_info($forum_id); $pageName = $langNewTopic; $navigation[] = array('url' => "index.php?course={$course_code}", 'name' => $langForums); $navigation[] = array('url' => "viewforum.php?course={$course_code}&forum={$forum_id}", 'name' => q($forum_name)); if (!does_exists($forum_id, "forum")) { $tool_content .= "<div class='alert alert-danger'>{$langErrorPost}</div>"; draw($tool_content, 2); exit; } if (!isset($_POST['submit'])) { $dynbar = array(array('title' => $langBack, 'url' => "viewforum.php?course={$course_code}&forum={$forum_id}", 'icon' => 'fa-reply', 'level' => 'primary-label')); $tool_content .= action_bar($dynbar); } if (isset($_POST['submit'])) { $subject = trim($_POST['subject']); $message = trim($_POST['message']); if (empty($message) or empty($subject)) { header("Location: viewforum.php?course={$course_code}&forum={$forum_id}&empty=true"); exit; } $message = purify($message); $poster_ip = $_SERVER['REMOTE_ADDR']; $time = date("Y-m-d H:i:s"); $topic_id = Database::get()->query("INSERT INTO forum_topic (title, poster_id, forum_id, topic_time) VALUES (?s, ?d, ?d, ?t)", $subject, $uid, $forum_id, $time)->lastInsertID; Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_FORUMTOPIC, $topic_id); $post_id = Database::get()->query("INSERT INTO forum_post (topic_id, post_text, poster_id, post_time, poster_ip) VALUES (?d, ?s, ?d, ?t, ?s)", $topic_id, $message, $uid, $time, $poster_ip)->lastInsertID; Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_FORUMPOST, $post_id);
* ======================================================================== */ $mail_ver_excluded = true; require_once '../include/baseTheme.php'; $pageName = $langManuals; $addon = ''; if (!in_array($language, array('el', 'en'))) { $language = 'en'; $addon = " ($langOnlyInEnglish)"; } $tool_content .= action_bar(array( array('title' => $langBack, 'url' => $urlServer, 'icon' => 'fa-reply', 'level' => 'primary-label', 'button-class' => 'btn-default') ),false); $tool_content .= "<table class='table table-striped table-bordered table-hover'> <tr> <th width='16'>".icon('fa-globe')."</th> <td>" . manlink($langFinalDesc, 'detail_descr', $language) . "</td> </tr> <tr> <th width='16'>".icon('fa-globe')."</th> <td> " . manlink($langShortDesc, 'short_descr', $language) . "</td> </tr> <tr> <th width='16'>".icon('fa-globe')."</th> <td>" . manlink($langManT, 'mant', $language) . "</td>
$course->refresh($new_course_id, $departments); // create courses/<CODE>/index.php course_index($code); // add a default forum category Database::get()->query("INSERT INTO forum_category SET cat_title = ?s, course_id = ?d", $langForumDefaultCat, $new_course_id); $_SESSION['courses'][$code] = USER_TEACHER; $tool_content .= "<div class='alert alert-success'><b>$langJustCreated:</b> " . q($title) . "<br> <span class='smaller'>$langEnterMetadata</span></div>"; $tool_content .= action_bar(array( array('title' => $langEnter, 'url' => $urlAppend . "courses/$code/", 'icon' => 'fa-arrow-right', 'level' => 'primary-label', 'button-class' => 'btn-success'))); // logging Log::record(0, 0, LOG_CREATE_COURSE, array('id' => $new_course_id, 'code' => $code, 'title' => $title, 'language' => $language, 'visible' => $_POST['formvisible'])); } // end of submit draw($tool_content, 1, null, $head_content);
} if (!empty($message)) { $tool_content .= "<div class='alert {$style}'>{$message}</div>"; } // user is not allowed to read this page if (!$is_allowedToRead) { $tool_content .= $langWikiNotAllowedToRead; draw($tool_content, 2, null, $head_content); die; } if ($action != "edit" && $action != "history" && $action != "diff") { // Wiki navigation bar $tool_content .= action_bar(array(array('title' => $langWikiMainPage, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&wikiId=" . $wiki->getWikiId() . "&action=show&title=__MainPage__", 'icon' => 'fa-wikipedia', 'level' => 'primary-label'), array('title' => $langWikiRecentChanges, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&wikiId=" . $wiki->getWikiId() . "&action=recent", 'icon' => 'fa-history', 'level' => 'primary'), array('title' => $langWikiAllPages, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&wikiId=" . $wiki->getWikiId() . "&action=all", 'icon' => 'fa-files-o', 'level' => 'primary'), array('title' => $langSearch, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&wikiId=" . $wiki->getWikiId() . "&action=rqSearch", 'icon' => 'fa-search', 'level' => 'primary'), array('title' => $langWikiList, 'url' => "index.php?course={$course_code}&gid={$groupId}", 'icon' => 'fa-list', 'level' => 'primary'))); } if ($action == "edit" || $action == "diff" || $action == "history" || $action == "conflict") { $tool_content .= action_bar(array(array('title' => $langWikiBackToPage, 'level' => 'primary-label', 'icon' => 'fa-reply', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&wikiId=" . $wiki->getWikiId() . "&action=show&title=" . rawurlencode($wiki_title)))); } switch ($action) { case "diff": $oldTime = nice_format($oldTime, true); $userInfo = user_get_data($oldEditor); $oldEditorStr = q($userInfo->givenname) . " " . q($userInfo->surname); $newTime = nice_format($newTime, TRUE); $userInfo = user_get_data($newEditor); $newEditorStr = q($userInfo->givenname) . " " . q($userInfo->surname); $tool_content .= "<div class='alert alert-info'>\n " . sprintf($langWikiDifferencePattern, $oldTime, $oldEditorStr, $newTime, $newEditorStr) . "\n </div>\n <strong>{$langWikiDifferenceKeys}</strong>"; $tool_content .= '<div class="diff">' . "\n"; $tool_content .= '= <span class="diffEqual" >' . $langWikiDiffUnchangedLine . '</span><br />'; $tool_content .= '+ <span class="diffAdded" >' . $langWikiDiffAddedLine . '</span><br />'; $tool_content .= '- <span class="diffDeleted" >' . $langWikiDiffDeletedLine . '</span><br />'; $tool_content .= 'M <span class="diffMoved" >' . $langWikiDiffMovedLine . '</span><br />';
$pageName = $langRename; } if (isset($_GET['move'])) { $pageName = $langMove; } if (isset($_GET['createDir'])) { $pageName = $langCreateDir; } if (isset($_GET['comment'])) { $pageName = $langAddComment; } if (isset($_GET['replace'])) { $pageName = $langReplace; } $diskQuotaDocument = $diskQuotaDocument * 1024 / 1024; $tool_content .= action_bar(array(array('title' => $langDownloadFile, 'url' => "upload.php?course={$course_code}&{$groupset}uploadPath={$curDirPath}", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langCreateDir, 'url' => "{$base_url}createDir={$cmdCurDirPath}", 'icon' => 'fa-folder', 'level' => 'primary'), array('title' => $langQuotaBar, 'url' => "{$base_url}showQuota=true", 'icon' => 'fa-pie-chart'), array('title' => $langExternalFile, 'url' => "upload.php?course={$course_code}&{$groupset}uploadPath={$curDirPath}&ext=true", 'icon' => 'fa-external-link'), array('title' => $langCommonDocs, 'url' => "../units/insert.php?course={$course_code}&dir={$curDirPath}&type=doc&id=-1", 'icon' => 'fa-plus-circle', 'show' => !defined('COMMON_DOCUMENTS') && get_config('enable_common_docs')))); } // Dialog Box if (!empty($dialogBox)) { $tool_content .= $dialogBox; } } // check if there are documents $doc_count = Database::get()->querySingle("SELECT COUNT(*) as count FROM document WHERE {$group_sql} {$filter}" . ($can_upload ? '' : " AND visible=1"))->count; if ($doc_count == 0) { $tool_content .= "<div class='alert alert-warning'>{$langNoDocuments}</div>"; } else { // Current Directory Line $tool_content .= "\n <div class='row'>\n <div class='col-md-12'>\n <div class='panel'>\n <div class='panel-body'>"; if ($can_upload) { $cols = 4;
$moduleNb = 0; $globalProg = 0; $global_time = "0000:00:00"; // look for maxDeep $maxDeep = 1; // used to compute colspan of <td> cells for ($i = 0; $i < sizeof($flatElementList); $i++) { if ($flatElementList[$i]['children'] > $maxDeep) { $maxDeep = $flatElementList[$i]['children']; } } $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "detailsUser.php?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label')),false); $tool_content .= " <div class='row margin-bottom-thin'> <div class='col-xs-12'> <div> <b>$langLearnPath:</b> <span class='text-muted'>$LPname</span> </div> <div> <b>$langStudent:</b> <span class='text-muted'>".q($uDetails->surname) . " " . q($uDetails->givenname) . " (" . q($uDetails->email).")</span> </div> </div> </div> ";
$_SESSION['cas_do'] = true; } if (!empty($_SESSION['cas_warn'])) { $_SESSION['cas_do'] = false; } if (empty($ldap_login_attr)) { $ldap_login_attr = 'uid'; } $tool_content .= action_bar(array( array( 'title' => $langBack, 'icon' => 'fa-reply', 'level' => 'primary-label', 'url' => 'auth.php' ))); // You have to logout from CAS and preferably close your browser // to change CAS settings if (!empty($_SESSION['cas_warn']) and $auth == 7) { $tool_content .= "<div class='alert alert-warning'>$langCASnochange</div>"; } if ($submit or ! empty($_SESSION['cas_do'])) { if (!empty($_SESSION['cas_do']) and empty($_SESSION['cas_warn'])) { // test new CAS settings $cas_ret = cas_authenticate(7, true, $_SESSION['cas_host'], $_SESSION['cas_port'], $_SESSION['cas_context'], $_SESSION['cas_cachain']); if (phpCAS::checkAuthentication()) {
} $course_title = course_id_to_title($cid); $tool_content .= "<div class='alert alert-success'>" . q(sprintf($course_title, $langEmailUnsubSuccess)) . "</div>"; } else { // change email subscription for all courses foreach ($_SESSION['courses'] as $course_code => $c_value) { if (@array_key_exists($course_code, $_POST['c_unsub'])) { Database::get()->query("UPDATE course_user SET receive_mail = 1\n WHERE user_id = ?d AND course_id = " . course_code_to_id($course_code), $uid); } else { Database::get()->query("UPDATE course_user SET receive_mail = 0\n WHERE user_id = ?d AND course_id = " . course_code_to_id($course_code), $uid); } } $tool_content .= "<div class='alert alert-success'>{$langWikiEditionSucceed}. <br /></div>" . action_bar(array(array('title' => $langBack, 'url' => "../profile/profile.php", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } } else { $tool_content .= action_bar(array(array('title' => $langBack, 'url' => 'display_profile.php', 'icon' => 'fa-reply', 'level' => 'primary-label'))); $tool_content .= "<form action='{$_SERVER['SCRIPT_NAME']}' method='post'>"; if (get_config('email_verification_required') && get_config('dont_mail_unverified_mails')) { $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
if (!$errorFound) { $tool_content .= "\n<br /><center><b>" . $langInstalled . "</b></center>"; $tool_content .= "\n<br /><br ><center><a href=\"learningPathAdmin.php?course={$course_code}&path_id=" . $tempPathId . "\">" . $lpName . "</a></center>"; } else { $tool_content .= "\n<br /><center><b>" . $langNotInstalled . "</b></center>"; } $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "index.php?course={$course_code}", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { // if method == 'post' // don't display the form if user already sent it /* -------------------------------------- UPLOAD FORM -------------------------------------- */ // Action_bar section $tool_content .= "\n <div class='row'>\n <div class='col-sm-12'>"; $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "index.php?course={$course_code}", 'icon' => 'fa-reply', 'level' => 'primary-label'))); $tool_content .= "</div>\n </div>\n "; // Upload Form section $tool_content .= "\n <div class='row'>\n <div class='col-sm-12'>\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form' method='post' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' enctype='multipart/form-data'>\n <fieldset>\n <legend>{$langImport}</legend>\n <div class='form-group'>\n <label for='uploadedPackage' class='col-sm-2 control-label'>Εισαγωγή αρχείου</label>\n <div class='col-sm-10'>\n <input type='hidden' name='claroFormId' value='" . uniqid('') . "' >\n <input id='uploadedPackage' type='file' name='uploadedPackage'>\n <span class='smaller'>{$langLearningPathUploadFile}</span>\n <span class='smaller'>{$langMaxFileSize} " . ini_get('upload_max_filesize') . "</span>\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-offset-2 col-sm-10'>\n <input class='btn btn-primary' type='submit' value='{$langImport}' >\n </div>\n </div>\n </fieldset>\n </form>\n </div>\n </div>\n </div>\n "; /* * *************************************** * IMPORT SCORM DIRECTLY FROM DOCUMENTS * *************************************** */ $basedir = $webDir . '/courses/' . $course_code . '/document'; /* * * Retrieve file info for current directory from database and disk ** */ $documents = Database::get()->queryArray("SELECT * FROM document WHERE format= 'zip' AND course_id = ?d ORDER BY filename", $course_id); $fileinfo = array(); foreach ($documents as $row) { $fileinfo[] = array('is_dir' => is_dir($basedir . $row->path), 'size' => filesize($basedir . $row->path), 'title' => $row->title, 'filename' => $row->filename, 'format' => $row->format, 'path' => $row->path, 'visible' => $row->visible == 1, 'comment' => $row->comment, 'copyrighted' => $row->copyrighted, 'date' => $row->date_modified); } $tool_content .= "\n<div class=\"fileman\">"; $tool_content .= "\n<form action='importFromDocument.php?course={$course_code}' method='post'>";
load_js('select2'); $head_content .= "<script type='text/javascript'>\r\n \$(document).ready(function () {\r\n \$('#select-groups').select2(); \r\n \$('#selectAll').click(function(e) {\r\n e.preventDefault();\r\n var stringVal = [];\r\n \$('#select-groups').find('option').each(function(){\r\n stringVal.push(\$(this).val());\r\n });\r\n \$('#select-groups').val(stringVal).trigger('change');\r\n });\r\n \$('#removeAll').click(function(e) {\r\n e.preventDefault();\r\n var stringVal = [];\r\n \$('#select-groups').val(stringVal).trigger('change');\r\n }); \r\n });\r\n\r\n </script>\r\n"; $head_content .= "\r\n<script type='text/javascript'>\r\n\t\tfunction onAddTag(tag) {\r\n\t\t\talert('Added a tag: ' + tag);\r\n\t\t}\r\n\t\tfunction onRemoveTag(tag) {\r\n\t\t\talert('Removed a tag: ' + tag);\r\n\t\t}\r\n\t\t\r\n\t\tfunction onChangeTag(input,tag) {\r\n\t\t\talert('Changed a tag: ' + tag);\r\n\t\t}\r\n\t\t\r\n\t\t\$(function() {\r\n\t\t\t\$('#tags_1').tagsInput({width:'auto'});\r\n\t\t});\r\n</script>\r\n"; if ($is_editor) { if (isset($_GET['add']) or isset($_GET['choice'])) { if (isset($_GET['add'])) { $pageName = $langNewBBBSession; } elseif (isset($_GET['choice']) and $_GET['choice'] == 'edit') { $pageName = $langModify; } $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { if (isset($_GET['id'])) { $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { $tool_content .= action_bar(array(array('title' => $langNewBBBSession, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&add=1", 'icon' => 'fa-calendar', 'level' => 'primary-label'))); } } } if (isset($_GET['add'])) { $navigation[] = array('url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}", 'name' => $langBBB); new_bbb_session(); } elseif (isset($_POST['update_bbb_session'])) { $startDate_obj = DateTime::createFromFormat('d-m-Y H:i', $_POST['start_session']); $start = $startDate_obj->format('Y-m-d H:i:s'); update_bbb_session($_GET['id'], $_POST['title'], $_POST['desc'], $start, $_POST['type'], $_POST['status'], isset($_POST['notifyUsers']) ? '1' : '0', $_POST['minutes_before'], $_POST['external_users'], $_POST['record'], $_POST['sessionUsers']); Session::Messages($langBBBAddSuccessful, 'alert-success'); redirect("index.php?course={$course_code}"); } elseif (isset($_GET['choice'])) { $navigation[] = array('url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}", 'name' => $langBBB); switch ($_GET['choice']) {