($l->auth_name == 'cas'? 'modules/auth/cas.php': 'secure/') . "'>$langEnter</a><br>"); } elseif (in_array($l->auth_name, $hybridAuthMethods)) { $hybridProviders[] = $l->auth_name; if (is_null($hybridLinkId)) { $authLink[] = array( 'showTitle' => true, 'class' => 'login-option', 'title' => $langViaSocialNetwork); $hybridLinkId = count($authLink) - 1; } } elseif (!$loginFormEnabled) { $loginFormEnabled = true; $authLink[] = array( 'showTitle' => false, 'class' => 'login-option', 'title' => empty($l->auth_title)? "$langLogInWith<br>Credentials": q(getSerializedMessage($l->auth_title)), 'html' => "<form action='$urlServer' method='post'> <div class='form-group'> <label for='uname' class='sr-only'>$langUsername</label> <input type='text' id='uname' name='uname' placeholder='$langUsername'><span class='col-xs-2 col-sm-2 col-md-2 fa fa-user'></span> </div> <div class='form-group'> <label for='pass' class='sr-only'>$langPass</label> <input type='password' id='pass' name='pass' placeholder='$langPass'><span id='revealPass' class='fa fa-eye' style='margin-left: -20px; color: black;'></span> <span class='col-xs-2 col-sm-2 col-md-2 fa fa-lock'></span> </div> <button type='submit' name='submit' class='btn btn-login'>$langEnter</button> </form> <div class='text-right'> <a href='modules/auth/lostpass.php'>$lang_forgot_pass</a> </div>"); }
$rules[$rule] .= "<li><a href='{$urlAppend}courses/{$course->code}/'>" . q($course->title) . '</a> (' . q($course->public_code) . ')</li>'; } $rules[$rule] .= '</ul>'; } $deps = Database::get()->queryArray('SELECT hierarchy.id, name FROM autoenroll_department, hierarchy WHERE autoenroll_department.department_id = hierarchy.id AND rule = ?d', $rule); if ($deps) { $rules[$rule] .= $langAutoEnrollDepartment . ':<ul>'; foreach ($deps as $dep) { $rules[$rule] .= "<li><a href='{$urlAppend}modules/auth/courses.php?fc={$dep->id}'>" . q(getSerializedMessage($dep->name)) . '</a></li>'; } $rules[$rule] .= '</ul>'; } $rules[$rule] .= "</div></div></div>"; }); if ($i) { $tool_content .= implode($rules); } else { $tool_content .= "<div class='alert alert-warning text-center'>$langNoRules</div>"; } } draw($tool_content, 3, null, $head_content); function multiInsert($table, $signature, $key, $values) {
/** * @brief store summarized monthly statistics * @global type $langCourse * @global type $langCoursVisible * @global type $langFaculty * @global type $langTeacher * @global type $langNbUsers * @global type $langTypeClosed * @global type $langTypeRegistration * @global type $langTypeOpen */ function summarizeMonthlyData() { global $langCourse, $langCoursVisible, $langFaculty, $langTeacher, $langNbUsers, $langTypeClosed, $langTypeRegistration, $langTypeOpen; // Check if data for last month have already been inserted in 'monthly_summary'... $lmon = mktime(0, 0, 0, date('m') - 1, date('d'), date('Y')); $last_month = date('m Y', $lmon); $res = Database::get()->querySingle("SELECT id FROM monthly_summary WHERE `month` = ?s", $last_month); if (empty($res)) { $current_month = date('Y-m-01 00:00:00'); $prev_month = date('Y-m-01 00:00:00', $lmon); $login_sum = Database::get()->querySingle("SELECT COUNT(idLog) as sum_id FROM loginout WHERE `when` >= ?t AND `when`< ?t AND action = 'LOGIN'", $prev_month, $current_month)->sum_id; $cours_sum = Database::get()->querySingle("SELECT COUNT(id) as cours_sum FROM course")->cours_sum; $prof_sum = Database::get()->querySingle("SELECT COUNT(id) as prof_sum FROM user WHERE status = 1")->prof_sum; $stud_sum = Database::get()->querySingle("SELECT COUNT(id) as stud_sum FROM user WHERE status = 5")->stud_sum; $vis_sum = Database::get()->querySingle("SELECT COUNT(id) as vis_sum FROM user WHERE status = 10")->vis_sum; $mtext = "<table class='table-default'> <tbody> <tr><th>" . $langCourse . "</th> <th>" . $langCoursVisible . "</th> <th>" . $langFaculty . "</th> <th>" . $langTeacher . "</th> <th>" . $langNbUsers . "</th></tr>"; $sql = "SELECT course.title AS name, course.visible AS visible, hierarchy.name AS dept, course.prof_names AS proff, COUNT(user_id) AS cnt FROM course JOIN course_department ON course.id = course_department.course JOIN hierarchy ON hierarchy.id = course_department.department LEFT JOIN course_user ON course.id = course_user.course_id GROUP BY course.id"; Database::get()->queryFunc($sql, function($row) use (&$mtext, $langTypeClosed, $langTypeRegistration, $langTypeOpen, $langInactiveCourse) { //declare course visibility if ($row->visible == COURSE_CLOSED) { $cvisible = $langTypeClosed; } else if ($row->visible == COURSE_REGISTRATION) { $cvisible = $langTypeRegistration; } else if ($row->visible == COURSE_OPEN) { $cvisible = $langTypeOpen; } else { $cvisible = $langInactiveCourse; } $mtext .= "<tr><td>" . $row->name . "</td><td> " . $cvisible . "</td> <td class='text-center'>" . getSerializedMessage($row->dept) . "</td> <td>" . $row->proff . "</td><td class='text-center'>" . $row->cnt . "</td></tr>"; }); $mtext .= '</tbody></table>'; $sql = "INSERT INTO monthly_summary SET month = ?s, profesNum = ?d, studNum = ?d, visitorsNum = ?d, coursNum = ?d, logins = ?d, details = ?s"; Database::get()->query($sql, $last_month, $prof_sum, $stud_sum, $vis_sum, $cours_sum, $login_sum, $mtext); } }
$warning = ''; $next = isset($_GET['next'])? ("<input type='hidden' name='next' value='" . q($_GET['next']) . "'>"): ''; $userValue = isset($_GET['user'])? (" value='" . q($_GET['user']) . "' readonly"): ''; $authLink = array(); $loginFormEnabled = false; $hybridLinkId = null; $q = Database::get()->queryArray("SELECT auth_name, auth_default, auth_title FROM auth WHERE auth_default > 0 ORDER BY auth_default DESC, auth_id"); foreach ($q as $l) { $authTitle = empty($l->auth_title)? "$langLogInWith {$l->auth_name}": getSerializedMessage($l->auth_title); if (in_array($l->auth_name, $extAuthMethods)) { $authUrl = $urlServer . ($l->auth_name == 'cas'? 'modules/auth/cas.php': 'secure/'); $authLink[] = array(false, " <div class='col-sm-8 col-sm-offset-2' style='padding-top:40px;'> <a class='btn btn-primary btn-block' href='$authUrl' style='line-height:40px;'>$langEnter</a> </div>", $authTitle); } elseif (in_array($l->auth_name, $hybridAuthMethods)) { $hybridProviderHtml = "<a class='' href='{$urlServer}index.php?provider=" . $l->auth_name . "'><img src='$themeimg/$l->auth_name.png' alt='Sign-in with $l->auth_name' title='Sign-in with $l->auth_name' style='margin-right: 0.5em;'>" . ucfirst($l->auth_name) . "</a>"; if (is_null($hybridLinkId)) { $authLink[] = array(false, $hybridProviderHtml, $langViaSocialNetwork); $hybridLinkId = count($authLink) - 1; } else { $authLink[$hybridLinkId][1] .= '<br>' . $hybridProviderHtml; }