'icon' => 'fa-arrow-down', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&down=" . getIndirectReference($row->id), 'disabled' => $i + 1 >= count($q)), array('title' => q($langDelete), 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&del=" . getIndirectReference($row->id), 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDelete) ) ) ."</div>"; } $tool_content .= " <h3 class='panel-title'>".q($row->title)." ".($row->visible && $is_editor ? " <span data-original-title='$langSeenToCourseHome' data-toggle='tooltip' data-placement='bottom' class='label label-primary'><i class='fa fa-eye'></i></span>" : "")."</h3> </div> <div class='panel-body'>" .handleType($row->type)."<br><br>" . standard_text_escape($row->comments) . "</div> </div>"; $i++; } } else { $tool_content .= "<div class='alert alert-warning'>$langThisCourseDescriptionIsEmpty</div>"; } add_units_navigation(true); draw($tool_content, 2, null, $head_content); // Helper Functions function handleType($typeId) {
processActions(); if (isset($_POST['saveCourseDescription'])) { if (isset($_POST['editId'])) { updateCourseDescription($_POST['editId'], $_POST['editTitle'], $_POST['editComments'], $_POST['editType']); } else { updateCourseDescription(null, $_POST['editTitle'], $_POST['editComments'], $_POST['editType']); } Session::Messages($langCourseUnitAdded, "alert-success"); redirect_to_home_page("modules/course_description/index.php"); } } $q = Database::get()->queryArray("SELECT id, title, comments, type, visible FROM course_description WHERE course_id = ?d ORDER BY `order`", $course_id); if ($q && count($q) > 0) { $i = 0; foreach ($q as $row) { $tool_content .= " \n <div class='panel panel-action-btn-default " . ($row->visible ? "" : "not_visible") . "'>\n <div class='panel-heading'>\n <div class='pull-right'>" . action_button(array(array('title' => q($langDelete), 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&del={$row->id}", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDelete), array('title' => q($langEdit), 'url' => "edit.php?course={$course_code}&id={$row->id}", 'icon' => 'fa-edit'), array('title' => $langAddToCourseHome, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&vis={$row->id}", 'icon' => $row->visible ? 'fa-eye-slash' : 'fa-eye'), array('title' => q($langUp), 'level' => 'primary', 'icon' => 'fa-arrow-up', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&up={$row->id}", 'disabled' => $i <= 0), array('title' => q($langDown), 'level' => 'primary', 'icon' => 'fa-arrow-down', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&down={$row->id}", 'disabled' => $i + 1 >= count($q)))) . "</div>\n <h3 class='panel-title'>{$row->title}</h3> \n </div>\n <div class='panel-body'>" . handleType($row->type) . "<br><br>" . standard_text_escape($row->comments) . "</div>\n </div>"; $i++; } } else { $tool_content .= "<div class='alert alert-warning'>{$langThisCourseDescriptionIsEmpty}</div>"; } add_units_navigation(true); draw($tool_content, 2, null, $head_content); // Helper Functions function handleType($typeId) { global $is_editor, $language; $typeId = intval($typeId); if ($typeId <= 0) { return ''; }