// use the following array for the legend icons $icons = array( 2 => "<img src='$themeimg/lock_open.png' alt='" . $langOpenCourse . "' title='" . $langOpenCourse . "' width='16' height='16' />", 1 => "<img src='$themeimg/lock_registration.png' alt='" . $langRegCourse . "' title='" . $langRegCourse . "' width='16' height='16' />", 0 => "<img src='$themeimg/lock_closed.png' alt='" . $langClosedCourse . "' title='" . $langClosedCourse . "' width='16' height='16' />" ); $tool_content .= action_bar(array( array('title' => $langBack, 'url' => $urlServer, 'icon' => 'fa-reply', 'level' => 'primary-label', 'button-class' => 'btn-default') ),false); if (count($tree->buildRootsArray()) > 1) { $tool_content .= $tree->buildRootsSelectForm($fc); } $tool_content .= " <div class='row'> <div class='col-xs-12'> <ul class='list-group'> <li class='list-group-item list-header'>$langFaculty: <b>" . $tree->getFullPath($fc, false, $_SERVER['SCRIPT_NAME'] . '?fc=') . "</b>"; $tool_content .= $tree->buildDepartmentChildrenNavigationHtml($fc, 'opencourses', $countCallback, $showEmpty); $tool_content .= "</ul> </div> </div>";
Database::get()->query("INSERT IGNORE INTO `course_user` (`course_id`, `user_id`, `status`, `reg_date`)\n VALUES (?d, ?d, ?d, CURDATE())", $cid, intval($uid), USER_STUDENT); } } } if ($errorExists) { $tool_content .= "<div class='alert alert-danger'>{$langWrongPassCourse} " . q(join(', ', $restrictedCourses)) . "</div><br />"; } else { $tool_content .= "<div class='alert alert-success'>{$langRegDone}</div>"; } $tool_content .= "<div><a href='../../index.php'>{$langHome}</a></div>"; } else { $fac = getfacfromfc($fc); if (!$fac) { // if user does not belong to department $tool_content .= "<p align='justify'>{$langAddHereSomeCourses}"; $roots = $tree->buildRootsArray(); if (count($roots) <= 0) { die("ERROR: no root nodes"); } else { if (count($roots) == 1) { header("Location:" . $urlServer . "modules/auth/courses.php?fc=" . intval($roots[0])); exit; } else { $tool_content .= $tree->buildNodesNavigationHtml($tree->buildRootsArray(), 'opencourses'); } } } else { // department exists $numofcourses = getdepnumcourses($fc); if (count($tree->buildRootsArray()) > 1) { $tool_content .= $tree->buildRootsSelectForm($fc);
* Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ require_once '../../include/baseTheme.php'; require_once 'include/lib/hierarchy.class.php'; $redirectUrl = "modules/auth/opencourses.php?fc="; $countCallback = null; if (defined('LISTING_MODE') && LISTING_MODE === 'COURSE_METADATA') { require_once 'modules/course_metadata/CourseXML.php'; $redirectUrl = "modules/course_metadata/opencourses.php?fc="; $countCallback = CourseXMLElement::getCountCallback(); // exit if feature disabled if (!get_config('opencourses_enable')) { header("Location: {$urlServer}"); exit; } } $tree = new Hierarchy(); $pageName = $langSelectFac; $roots = $tree->buildRootsArray(); if (count($roots) <= 0) { die("ERROR: no root nodes"); } else { if (count($roots) == 1) { header("Location:" . $urlServer . $redirectUrl . intval($roots[0])); exit; } else { $tool_content = $tree->buildNodesNavigationHtml($roots, 'opencourses', $countCallback); } } draw($tool_content, (isset($uid) and $uid) ? 1 : 0);
// preload all user's nodes $usernodes = array(); if ($uid) { $usernodes = $user->getDepartmentNodes($uid); } // initialize vars $defs = (is_array($defaults)) ? $defaults : array(intval($defaults)); $subdefs = ($allow_only_defaults) ? $tree->buildSubtrees($defs, $allnodes) : array(); $suballowed = ($allowables != null) ? $tree->buildSubtrees($allowables, $allnodes) : null; $excludeLft = 0; $excludeRgt = 0; $fetchNodeById = "select * from hierarchy where id = ?d"; if ($requestId <= 0) { $nodes = $tree->buildRootsArray(); foreach ($tree_array as $key => $value) { $data[] = array( "id" => $key, "text" => $value ); } } else { // calculate 1st child's lft value, if exists $searchLft = 0; $parent = Database::get()->querySingle($fetchNodeById, $requestId); if ($parent && ($parent->rgt - $parent->lft) > 1) { $searchLft = intval($parent->lft) + 1; }