Example #1
0
require_once 'functions.php';
require_once 'modules/document/doc_init.php';
require_once 'include/lib/modalboxhelper.class.php';
require_once 'include/lib/multimediahelper.class.php';
$action = new action();
$action->record(MODULE_ID_UNITS);
if (isset($_REQUEST['id'])) {
    $id = intval($_REQUEST['id']);
}
$pageName = '';
$lang_editor = $language;
load_js('tools.js');
ModalBoxHelper::loadModalBox(true);
if (isset($_REQUEST['edit_submit'])) {
    units_set_maxorder();
    $tool_content .= handle_unit_info_edit();
}
$form = process_actions();
// check if we are trying to access a protected resource directly
$access = Database::get()->querySingle("SELECT public FROM course_units WHERE id = ?d", $id);
if ($access) {
    if (!resource_access(1, $access->public)) {
        $tool_content .= "<div class='alert alert-danger'>{$langForbidden}</div>";
        draw($tool_content, 2, null, $head_content);
        exit;
    }
}
if ($is_editor) {
    $base_url = $urlAppend . "modules/units/insert.php?course={$course_code}&amp;id={$id}&amp;type=";
    $tool_content .= "\n    <div class='row'>\n        <div class='col-md-12'>" . action_bar(array(array('title' => $langEditUnitSection, 'url' => "info.php?course={$course_code}&amp;edit={$id}&amp;next=1", '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'))) . "\n    </div>\n  </div>";
}
Example #2
0
    if (isset($rating_content)) {
        $panel_footer .= "<div class='col-sm-6'>\r\n                {$rating_content}\r\n            </div>";
    }
    if (isset($social_content)) {
        $panel_footer .= "<div class='col-sm-6 " . (isset($rating_content) ? "text-right" : "") . "'>\r\n                {$social_content}\r\n            </div>";
    }
    $panel_footer .= "                \r\n                </div>\r\n            </div>";
}
units_set_maxorder();
// other actions in course unit
if ($is_editor) {
    // update index and refresh course metadata
    require_once 'modules/search/indexer.class.php';
    require_once 'modules/course_metadata/CourseXML.php';
    if (isset($_REQUEST['edit_submit'])) {
        $main_content .= handle_unit_info_edit();
    } elseif (isset($_REQUEST['edit_submitW'])) {
        $title = $_REQUEST['weektitle'];
        $descr = $_REQUEST['weekdescr'];
        if (isset($_REQUEST['week_id'])) {
            //edit week
            $weekid = $_REQUEST['week_id'];
            Database::get()->query("UPDATE course_weekly_view SET title = ?s, comments = ?s\r\n                                    WHERE id = ?d ", $title, $descr, $weekid);
        }
    } elseif (isset($_REQUEST['del'])) {
        // delete course unit
        $id = intval($_REQUEST['del']);
        if ($course_info->view_type == 'units') {
            Database::get()->query('DELETE FROM course_units WHERE id = ?d', $id);
            Database::get()->query('DELETE FROM unit_resources WHERE unit_id = ?d', $id);
            Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_UNIT, $id);