break; case "3": $typeSel[0] = "selected"; break; default: $typeSel[-1] = "selected"; break; } } $tool_content .= "<div class='form-group'>\n <label for='formsearchtype' class='col-sm-2 control-label'>{$langCourseVis}:</label>\n <div class='col-sm-10'>\n <select class='form-control' name='formsearchtype'>\n <option value='-1' " . @$typeSel[-1] . ">{$langAllTypes}</option>\n <option value='2' " . @$typeSel[2] . ">{$langTypeOpen}</option>\n <option value='1' " . @$typeSel[1] . ">{$langTypeRegistration}</option>\n <option value='0' " . @$typeSel[0] . ">{$langTypeClosed}</option>\n <option value='3' " . @$typeSel[3] . ">{$langCourseInactiveShort}</option>\n </select>\n </div>\n </div>"; $reg_flag_data = array(); $reg_flag_data[1] = $langAfter; $reg_flag_data[2] = $langBefore; $tool_content .= "<div class='form-group'><label class='col-sm-2 control-label'>{$langCreationDate}:</label>"; $tool_content .= "<div class='col-sm-5'>" . selection($reg_flag_data, 'reg_flag', $reg_flag, 'class="form-control"') . "</div>"; $tool_content .= "<div class='col-sm-5'>"; $tool_content .= "<input class='form-control' id='id_date' name='date' type='text' value='{$date}' data-date-format='dd-mm-yyyy' placeholder='{$langCreationDate}'> \n </div>"; $tool_content .= "</div>"; $tool_content .= "<div class='form-group'><label class='col-sm-2 control-label'>{$langFaculty}:</label>"; $tool_content .= "<div class='col-sm-10'>"; if (isDepartmentAdmin()) { list($js, $html) = $tree->buildNodePicker(array('params' => 'name="formsearchfaculte"', 'tree' => array('0' => $langAllFacultes), 'useKey' => "id", 'multiple' => false, 'allowables' => $user->getDepartmentIds($uid))); } else { list($js, $html) = $tree->buildNodePicker(array('params' => 'name="formsearchfaculte"', 'tree' => array('0' => $langAllFacultes), 'useKey' => "id", 'multiple' => false)); } $head_content .= $js; $tool_content .= $html; $tool_content .= "</div></div>"; $tool_content .= "<div class='form-group'>\n <div class='col-sm-10 col-sm-offset-2'>\n <input class='btn btn-primary' type='submit' name='search_submit' value='{$langSearch}'>\n <a href='index.php' class='btn btn-default'>{$langCancel}</a> \n </div>\n </div>"; $tool_content .= "</fieldset></form></div>"; draw($tool_content, 3, null, $head_content);
$course_id = intval($_GET['c']); } else { $course_id = 0; } 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 validateCourseNodes($course_id, isDepartmentAdmin()); $toolName = $langCourseDel; $navigation[] = array('url' => 'index.php', 'name' => $langAdmin); $navigation[] = array('url' => 'listcours.php', 'name' => $langListCours); // If course deleted go back to listcours.php if (isset($_GET['c']) && !isset($_GET['delete'])) { $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "listcours.php", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { $tool_content .= action_bar(array( array('title' => $langBack,
$depqryadd = ''; $dep = isset($_POST['department']) ? intval($_POST['department']) : 0; if ($dep || isDepartmentAdmin()) { $depqryadd = ', user_department'; $subs = array(); if ($dep) { $subs = $tree->buildSubtrees(array($dep)); } else { if (isDepartmentAdmin()) { $subs = $user->getDepartmentIds($uid); } } $count = 0; foreach ($subs as $key => $id) { $terms[] = $id; validateNode($id, isDepartmentAdmin()); $count++; } $pref = $c ? 'a' : 'user'; $criteria[] = $pref . '.user.id = user_department.user'; $criteria[] = 'department IN (' . array_fill(0, $count, '?s') . ')'; } $qry_criteria = count($criteria) ? implode(' AND ', $criteria) : ''; // end filter/criteria if (!empty($c)) { $qry_base = " FROM user AS a LEFT JOIN course_user AS b ON a.id = b.user_id {$depqryadd} WHERE b.course_id = ?d "; array_unshift($terms, $c); if ($qry_criteria) { $qry_base .= ' AND ' . $qry_criteria; } $qry = "SELECT DISTINCT a.username " . $qry_base . " ORDER BY a.username ASC";
$n = isset($_POST['name-' . $langcode]) ? $_POST['name-' . $langcode] : null; if (!empty($n)) { $names[$langcode] = $n; } } $name = serialize($names); $code = $_POST['code']; $allow_course = isset($_POST['allow_course']) ? 1 : 0; $allow_user = isset($_POST['allow_user']) ? 1 : 0; $order_priority = isset($_POST['order_priority']) && !empty($_POST['order_priority']) ? intval($_POST['order_priority']) : 'null'; if (empty($name)) { $tool_content .= "<div class='alert alert-danger'>" . $langEmptyNodeName . "<br>"; $tool_content .= action_bar(array(array('title' => $langReturnToEditNode, 'url' => $_SERVER['SCRIPT_NAME'] . "?action=edit&id={$id}", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { // OK Update the node validateParentLft(intval($_POST['nodelft']), isDepartmentAdmin()); $tree->updateNode($id, $name, intval($_POST['nodelft']), intval($_POST['lft']), intval($_POST['rgt']), intval($_POST['parentLft']), $code, $allow_course, $allow_user, $order_priority); $tool_content .= "<div class='alert alert-success'>{$langEditNodeSuccess}</div><br />"; } } else { // Get node information $id = intval($_GET['id']); $mynode = Database::get()->querySingle("SELECT name, lft, rgt, code, allow_course, allow_user, order_priority FROM hierarchy WHERE id = ?d", $id); $parentLft = $tree->getParent($mynode->lft, $mynode->rgt); $check_course = $mynode->allow_course == 1 ? " checked=1 " : ''; $check_user = $mynode->allow_user == 1 ? " checked=1 " : ''; // Display form for edit node information $tool_content .= "<div class='form-wrapper'>\n <form role='form' class='form-horizontal' method='post' action='" . $_SERVER['SCRIPT_NAME'] . "?action=edit' onsubmit='return validateNodePickerForm();'>\n <fieldset>\n <div class='form-group'>\n <label class='col-sm-3 control-label'>{$langNodeCode1}:</label>\n <div class='col-sm-9'>\n <input type='text' name='code' value='" . q($mynode->code) . "' /> <i>" . $langCodeFaculte2 . "</i>\n </div>\n </div>"; $is_serialized = false; $names = @unserialize($mynode->name); if ($names !== false) {
foreach ($departments as $department) { $br = $i < count($departments) ? '<br/>' : ''; $dep .= $tree->getFullPath($department) . $br; $i++; } // Add links to course users, delete course and course edit $icon_content = icon('fa-user', $langUsers, "listusers.php?c={$logs->id}") . " "; if (!isDepartmentAdmin()) { $icon_content .= icon('fa-list', $langUsersLog, "../usage/displaylog.php?c={$logs->id}&from_admin=TRUE") . " "; } $icon_content .= icon('fa-edit', $langEdit, "editcours.php?c={$logs->code}") . " "; $icon_content .= icon('fa-times', $langDelete, "delcours.php?c={$logs->id}"); $data['aaData'][] = array('0' => $course_title, '1' => icon_old_style($icon, $title), '2' => $dep, '3' => $icon_content); } echo json_encode($data); exit; } load_js('tools.js'); load_js('datatables'); load_js('datatables_filtering_delay'); $head_content .= "<script type='text/javascript'>\n \$(document).ready(function() {\n \$('#course_results_table').dataTable ({\n 'bProcessing': true,\n 'bServerSide': true,\n 'sAjaxSource': '{$_SERVER['REQUEST_URI']}',\n 'aLengthMenu': [\n [10, 15, 20 , -1],\n [10, 15, 20, '{$langAllOfThem}'] // change per page values here\n ],\n 'sPaginationType': 'full_numbers',\n 'bAutoWidth': false,\n 'aoColumns': [\n {'bSortable' : true, 'sWidth': '50%' },\n {'bSortable' : false, 'sClass': 'center' },\n {'bSortable' : false, 'sWidth': '25%' },\n {'bSortable' : false },\n ],\n 'oLanguage': {\n 'sLengthMenu': '{$langDisplay} _MENU_ {$langResults2}',\n 'sZeroRecords': '" . $langNoResult . "',\n 'sInfo': '{$langDisplayed} _START_ {$langTill} _END_ {$langFrom2} _TOTAL_ {$langTotalResults}',\n 'sInfoEmpty': '{$langDisplayed} 0 {$langTill} 0 {$langFrom2} 0 {$langResults2}',\n 'sInfoFiltered': '',\n 'sInfoPostFix': '',\n 'sSearch': '" . $langSearch . "',\n 'sUrl': '',\n 'oPaginate': {\n 'sFirst': '«',\n 'sPrevious': '‹',\n 'sNext': '›',\n 'sLast': '»'\n }\n }\n }).fnSetFilteringDelay(1000);\n \$('.dataTables_filter input').attr('placeholder', '{$langTitle}, {$langTeacher}');\n });\n </script>"; $navigation[] = array('url' => 'index.php', 'name' => $langAdmin); $navigation[] = array('url' => 'searchcours.php', 'name' => $langSearchCourses); $toolName = $langListCours; // Display Actions Toolbar $tool_content .= action_bar(array(array('title' => $langAllCourses, 'url' => "{$_SERVER['SCRIPT_NAME']}?formsearchtitle=&formsearchcode=&formsearchtype=-1&reg_flag=1&date=&formsearchfaculte=0&search_submit={$langSearch}", 'icon' => 'fa-search', 'level' => 'primary-label'), array('title' => $langReturnSearch, 'url' => "searchcours.php", 'icon' => 'fa-reply', 'level' => 'primary'))); $width = !isDepartmentAdmin() ? 100 : 80; // Construct course list table $tool_content .= "<table id='course_results_table' class='display'>\n <thead>\n <tr>\n <th align='left'>{$langCourseCode}</th>\n <th>{$langGroupAccess}</th>\n <th width='260' align='left'>{$langFaculty}</th>\n <th width='{$width}'>{$langActions}</th>\n </tr></thead>"; $tool_content .= "<tbody></tbody></table>"; draw($tool_content, 3, null, $head_content);
$navigation[] = array('url' => 'index.php', 'name' => $langAdmin); $navigation[] = array('url' => 'searchcours.php', 'name' => $langSearchCourses); $toolName = $langListCours; // Display Actions Toolbar $tool_content .= action_bar(array( array('title' => $langAllCourses, 'url' => "$_SERVER[SCRIPT_NAME]?formsearchtitle=&formsearchcode=&formsearchtype=-1&reg_flag=1&date=&formsearchfaculte=0&search_submit=$langSearch", 'icon' => 'fa-search', 'level' => 'primary-label'), array('title' => $langReturnSearch, 'url' => "searchcours.php", 'icon' => 'fa-reply', 'level' => 'primary'))); $width = (!isDepartmentAdmin()) ? 100 : 80; // Construct course list table $tool_content .= "<table id='course_results_table' class='display'> <thead> <tr> <th align='left'>$langCourseCode</th> <th>$langGroupAccess</th> <th width='260' align='left'>$langFaculty</th> <th>".icon('fa-cogs')."</th> </tr></thead>"; $tool_content .= "<tbody></tbody></table>"; draw($tool_content, 3, null, $head_content);
$code = $_POST['code']; $allow_course = (isset($_POST['allow_course'])) ? 1 : 0; $allow_user = (isset($_POST['allow_user'])) ? 1 : 0; $order_priority = (isset($_POST['order_priority']) && !empty($_POST['order_priority'])) ? intval($_POST['order_priority']) : 'null'; if (empty($name)) { $tool_content .= "<div class='alert alert-danger'>" . $langEmptyNodeName . "<br>"; $tool_content .= action_bar(array( array('title' => $langReturnToEditNode, 'url' => $_SERVER['SCRIPT_NAME'] . "?action=edit&id=$id", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { // OK Update the node $oldpid = intval($_POST['oldparentid']); $newpid = intval($_POST['newparentid']); validateParentId($newpid, isDepartmentAdmin()); $tree->updateNode($id, $name, $tree->getNodeLft($newpid), intval($_POST['lft']), intval($_POST['rgt']), $tree->getNodeLft($oldpid), $code, $allow_course, $allow_user, $order_priority); $tool_content .= "<div class='alert alert-success'>$langEditNodeSuccess</div><br />"; } } else { // Get node information $id = intval($_GET['id']); $mynode = Database::get()->querySingle("SELECT name, lft, rgt, code, allow_course, allow_user, order_priority FROM hierarchy WHERE id = ?d", $id); $parent = $tree->getParent($mynode->lft, $mynode->rgt); $check_course = ($mynode->allow_course == 1) ? " checked=1 " : ''; $check_user = ($mynode->allow_user == 1) ? " checked=1 " : ''; // Display form for edit node information $tool_content .= " <div class='form-wrapper'> <form role='form' class='form-horizontal' method='post' action='" . $_SERVER['SCRIPT_NAME'] . "?action=edit' onsubmit='return validateNodePickerForm();'> <fieldset>
array( 'title' => $langEditChange, 'icon' => 'fa-edit', 'url' => "edituser.php?u=$logs->id" ), array( 'title' => $langActions, 'icon' => 'fa-list-alt', 'url' => "userlogs.php?u=$logs->id" ), array( 'title' => $changetip, 'icon' => 'fa-key', 'url' => 'change_user.php?username='******'class' => 'change-user-link', 'hide' => isDepartmentAdmin() ), array( 'title' => $langStat, 'icon' => 'fa-pie-chart', 'url' => "userstats.php?u=$logs->id" ), array( 'title' => $langDelete, 'icon' => 'fa-times', 'url' => "deluser.php?u=$iuid" ) )); } $data['aaData'][] = array( '0' => $logs->surname,