dolibarr 21.0.0-alpha
box_lastlogin.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
3 * Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2014-2020 Frederic France <frederic.france@netlogic.fr>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
28
33{
34 public $boxcode = "lastlogin";
35 public $boximg = "object_user";
36 public $boxlabel = 'BoxLoginInformation';
37 public $depends = array("user");
38
39 public $enabled = 1;
40
47 public function __construct($db, $param)
48 {
49 global $conf;
50
51 $this->db = $db;
52 }
53
60 public function loadBox($max = 5)
61 {
62 global $conf, $user, $langs;
63
64 $textHead = $langs->trans("BoxLoginInformation");
65 $this->info_box_head = array(
66 'text' => $textHead,
67 'limit' => dol_strlen($textHead),
68 );
69
70 $line = 0;
71 $this->info_box_contents[$line][0] = array(
72 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
73 'text' => $langs->trans("User"),
74 );
75 $this->info_box_contents[$line][1] = array(
76 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
77 'text' => $user->getNomUrl(-1),
78 'asis' => 1
79 );
80
81 $line = 1;
82 $this->info_box_contents[$line][0] = array(
83 'td' => '',
84 'text' => $langs->trans("PreviousConnexion"),
85 );
86 if ($user->datepreviouslogin) {
87 $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuserrel');
88 } else {
89 $tmp = $langs->trans("Unknown");
90 }
91 $this->info_box_contents[$line][1] = array(
92 'td' => '',
93 'text' => $tmp,
94 );
95 }
96
97
98
99
108 public function showBox($head = null, $contents = null, $nooutput = 0)
109 {
110 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
111 }
112}
Class ModeleBoxes.
Class to manage the box of last login.
loadBox($max=5)
Load data into memory for later display.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
__construct($db, $param)
Constructor.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).