Skip to content

Commit 99bb59f

Browse files
committed
Home page: improvements in statistics.
1 parent 071702c commit 99bb59f

File tree

3 files changed

+38
-30
lines changed

3 files changed

+38
-30
lines changed

index.php

+32-24
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,18 @@
176176
FROM auth WHERE auth_default <> 0
177177
ORDER BY auth_default DESC, auth_id");
178178
foreach ($q as $l) {
179-
if($l->auth_name == 'eclass' && $l->auth_default == 2){
179+
if ($l->auth_name == 'eclass' && $l->auth_default == 2) {
180180
$primary_method = 2;
181-
}elseif($l->auth_name == 'cas' && $l->auth_default == 2){
181+
} elseif ($l->auth_name == 'cas' && $l->auth_default == 2) {
182182
$primary_method = 3;
183-
}elseif($l->auth_name == 'shibboleth' && $l->auth_default == 2){
183+
} elseif ($l->auth_name == 'shibboleth' && $l->auth_default == 2) {
184184
$primary_method = 4;
185185
}
186186
if (in_array($l->auth_name, $extAuthMethods)) {
187187
$authNameDefault = '';
188-
if(!empty($l->auth_title)){
188+
if (!empty($l->auth_title)) {
189189
$authNameDefault = getSerializedMessage($l->auth_title);
190-
}else{
190+
} else {
191191
$authNameDefault = $langEnter;
192192
}
193193
$authLinks[] = array(
@@ -197,9 +197,9 @@
197197
'nameAuth' => $l->auth_name,
198198
'showTitle' => true,
199199
'class' => 'login-option login-option-sso',
200-
'title' => empty($l->auth_title)? "$langLogInWith {$l->auth_name}": q(getSerializedMessage($l->auth_title)),
201-
'html' => "<div class='form-wrapper form-edit wrapper-sso w-100'><a class='btn submitAdminBtnDefault sso-btn d-inline-flex' href='" . $urlServer . ($l->auth_name == 'cas'? 'modules/auth/cas.php': 'secure/') . "'>$authNameDefault</a></div>");
202-
$data['auth_url'] = $urlServer . ($l->auth_name == 'cas'? 'modules/auth/cas.php': 'secure/');
200+
'title' => empty($l->auth_title) ? "$langLogInWith {$l->auth_name}" : q(getSerializedMessage($l->auth_title)),
201+
'html' => "<div class='form-wrapper form-edit wrapper-sso w-100'><a class='btn submitAdminBtnDefault sso-btn d-inline-flex' href='" . $urlServer . ($l->auth_name == 'cas' ? 'modules/auth/cas.php' : 'secure/') . "'>$authNameDefault</a></div>");
202+
$data['auth_url'] = $urlServer . ($l->auth_name == 'cas' ? 'modules/auth/cas.php' : 'secure/');
203203
$data['auth_title'] = $authNameDefault;
204204
} elseif (in_array($l->auth_name, $hybridAuthMethods)) {
205205
$hybridProviders[] = $l->auth_name;
@@ -215,7 +215,7 @@
215215
$hybridLinkId = count($authLinks) - 1;
216216
}
217217
} elseif (!$loginFormEnabled) {
218-
$autofocus = count($authLinks)? '' : 'autofocus' ;
218+
$autofocus = count($authLinks) ? '' : 'autofocus';
219219
$loginFormEnabled = true;
220220
$authLinks[] = array(
221221
'authId' => $l->auth_id,
@@ -224,7 +224,7 @@
224224
'nameAuth' => $l->auth_name,
225225
'showTitle' => false,
226226
'class' => 'login-option',
227-
'title' => empty($l->auth_title)? "$langLogInWith {$l->auth_name}": q(getSerializedMessage($l->auth_title)),
227+
'title' => empty($l->auth_title) ? "$langLogInWith {$l->auth_name}" : q(getSerializedMessage($l->auth_title)),
228228
'html' => " <div class='col-12'><div class='form-wrapper form-edit'><form action='$urlServer' method='post'>
229229
<div class='form-group text-start'>
230230
<label for='uname' class='form-label'>$langUsername</label>
@@ -258,7 +258,7 @@
258258
$authLinks[$hybridLinkId]['html'] .= '<br>';
259259
}
260260
$provider_link = $provider;
261-
if($provider_link == 'live'){
261+
if ($provider_link == 'live') {
262262
$provider_link = 'microsoft';
263263
}
264264
$authLinks[$hybridLinkId]['html'] .=
@@ -289,7 +289,7 @@
289289

290290
}
291291

292-
$data['total_collaboration_courses'] = Database::get()->querySingle("SELECT COUNT(*) AS total FROM course WHERE is_collaborative = ?d",1)->total;
292+
$data['total_collaboration_courses'] = Database::get()->querySingle("SELECT COUNT(*) AS total FROM course WHERE is_collaborative = ?d", 1)->total;
293293

294294
$data['popular_courses'] = Database::get()->queryArray('SELECT * FROM `course`
295295
WHERE `popular_course` = ?d AND `visible` != ?d AND lang=?s', 1, 3, $language);
@@ -303,31 +303,31 @@
303303
AND (NOW() <= `end` or `end` IS null)
304304
ORDER BY `order` DESC", $language);
305305

306-
$data['texts'] = Database::get()->queryArray("SELECT * FROM `homepageTexts` WHERE `lang` = ?s AND `type` = ?d ORDER BY `order` ASC",$language,1);
307-
$data['testimonials'] = Database::get()->queryArray("SELECT * FROM `homepageTexts` WHERE `lang` = ?s AND `type` = ?d ORDER BY `order` ASC",$language,2);
306+
$data['texts'] = Database::get()->queryArray("SELECT * FROM `homepageTexts` WHERE `lang` = ?s AND `type` = ?d ORDER BY `order` ASC", $language, 1);
307+
$data['testimonials'] = Database::get()->queryArray("SELECT * FROM `homepageTexts` WHERE `lang` = ?s AND `type` = ?d ORDER BY `order` ASC", $language, 2);
308308

309309
$data['auth_enabled_method'] = 0;
310-
$active_method = Database::get()->queryArray("SELECT * FROM auth WHERE auth_default = ?d OR auth_default = ?d",1,2);
311-
if(count($active_method) > 0){
310+
$active_method = Database::get()->queryArray("SELECT * FROM auth WHERE auth_default = ?d OR auth_default = ?d", 1, 2);
311+
if (count($active_method) > 0) {
312312
$data['auth_enabled_method'] = 1;
313313
}
314314

315315
//priorities
316316
$priority_order = 0;
317317
$priorities = Database::get()->queryArray("SELECT `title` FROM `homepagePriorities` ORDER BY `order` ASC");
318-
if(count($priorities) > 0){
319-
foreach($priorities as $p){
320-
if($p->title == 'announcements'){
318+
if (count($priorities) > 0) {
319+
foreach ($priorities as $p) {
320+
if ($p->title == 'announcements') {
321321
$data['announcements_priority'] = $priority_order;
322-
}elseif($p->title == 'popular_courses'){
322+
} elseif ($p->title == 'popular_courses') {
323323
$data['popular_courses_priority'] = $priority_order;
324-
}elseif($p->title == 'texts'){
324+
} elseif ($p->title == 'texts') {
325325
$data['texts_priority'] = $priority_order;
326-
}elseif($p->title == 'testimonials'){
326+
} elseif ($p->title == 'testimonials') {
327327
$data['testimonials_priority'] = $priority_order;
328-
}elseif($p->title == 'statistics'){
328+
} elseif ($p->title == 'statistics') {
329329
$data['statistics_priority'] = $priority_order;
330-
}else{
330+
} else {
331331
$data['open_courses_priority'] = $priority_order;
332332
}
333333
$priority_order++;
@@ -357,5 +357,13 @@
357357

358358
$data['display_login_form'] = $display_login_form = get_config('display_login_form');
359359

360+
if (!get_config('dont_display_statistics')) {
361+
$digit_separator = '.';
362+
if (isset($_GET['localize']) and $_GET['localize'] != 'el') {
363+
$digit_separator = ',';
364+
}
365+
$data['digit_separator'] = $digit_separator;
366+
}
367+
360368
view('home.index', $data);
361369
}

resources/views/admin/other/manage_homepage.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</div>
6161

6262
<div class='form-group mt-4'>
63-
<label for='answer' class='col-sm-12 control-label-notes'>{{trans('langUserLogins')}}/{{trans('langWeek')}}</label>
63+
<label for='answer' class='col-sm-12 control-label-notes'>{{trans('langUserLogins')}} {{trans('langPerMonth')}}</label>
6464
<div class='col-sm-12'>
6565
<input id='answer' class='form-control' type='number' name='visits_per_week' value="{{ get_config('visits_per_week') }}"/>
6666
</div>

resources/views/home/index.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,9 @@
512512
<i class="fa-solid fa-book-open fa-xl mt-4 pt-1" role="presentation"></i>
513513
<div class='TextBold largest-text mb-0 ms-2'>
514514
@if((isset($collaboration_platform) and !$collaboration_platform) or is_null($collaboration_platform))
515-
{{ get_config('total_courses') }}
515+
{{ number_format(get_config('total_courses'), 0, '', $digit_separator) }}
516516
@else
517-
{{ $total_collaboration_courses }}
517+
{{ number_format($total_collaboration_courses, 0 ,'', $digit_separator) }}
518518
@endif
519519
</div>
520520
</div>
@@ -529,9 +529,9 @@
529529
<div>
530530
<div class='d-flex justify-content-center'>
531531
<i class="fa-solid fa-globe fa-xl mt-4 pt-1" role="presentation"></i>
532-
<div class='TextBold largest-text mb-0 ms-2'>{{ get_config('visits_per_week')}}K+</div>
532+
<div class='TextBold largest-text mb-0 ms-2'>{{ number_format(get_config('visits_per_week'), 0, '', $digit_separator) }}</div>
533533
</div>
534-
<p class='form-label text-center'>{{trans('langUserLogins')}}/</br>{{trans('langWeek')}}</p>
534+
<p class='form-label text-center'>{{trans('langUserLogins')}} {{trans('langPerMonth')}}</p>
535535
</div>
536536
</div>
537537
</div>
@@ -542,7 +542,7 @@
542542
<div>
543543
<div class='d-flex justify-content-center'>
544544
<i class="fa-solid fa-user fa-xl mt-4 pt-1" role="presentation"></i>
545-
<div class='TextBold largest-text mb-0 ms-2'>{{ get_config('users_registered') }}</div>
545+
<div class='TextBold largest-text mb-0 ms-2'>{{ number_format(get_config('users_registered'), 0, '', $digit_separator) }}</div>
546546
</div>
547547
<p class='form-label text-center'>{{ trans('langRegisteredUsers') }}</p>
548548
</div>

0 commit comments

Comments
 (0)