dolibarr  9.0.0
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-2015 Frederic France <frederic.france@free.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
27 
32 {
33  var $boxcode="lastlogin";
34  var $boximg="object_user";
35  var $boxlabel='BoxLoginInformation';
36  var $depends = array("user");
37 
41  public $db;
42 
43  var $param;
44  var $enabled = 1;
45 
46  var $info_box_head = array();
47  var $info_box_contents = array();
48 
49 
56  function __construct($db,$param)
57  {
58  global $conf;
59 
60  $this->db=$db;
61  }
62 
69  function loadBox($max=5)
70  {
71  global $conf, $user, $langs, $db;
72 
73  $textHead = $langs->trans("BoxLoginInformation");
74  $this->info_box_head = array(
75  'text' => $textHead,
76  'limit'=> dol_strlen($textHead),
77  );
78 
79  $line=0;
80  $this->info_box_contents[$line][0] = array(
81  'td' => '',
82  'text' => $langs->trans("User"),
83  );
84  $this->info_box_contents[$line][1] = array(
85  'td' => '',
86  'text' => $user->getNomUrl(-1),
87  'asis' => 1
88  );
89 
90  $line=1;
91  $this->info_box_contents[$line][0] = array(
92  'td' => '',
93  'text' => $langs->trans("PreviousConnexion"),
94  );
95  if ($user->datepreviouslogin) $tmp= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
96  else $tmp= $langs->trans("Unknown");
97  $this->info_box_contents[$line][1] = array(
98  'td' => '',
99  'text' => $tmp,
100  );
101  }
102 
103 
112  function showBox($head = null, $contents = null, $nooutput=0)
113  {
114  parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
115  }
116 }
loadBox($max=5)
Charge les donnees en memoire pour affichage ulterieur.
Class ModeleBoxes.
__construct($db, $param)
Constructor.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
Class to manage the box of last login.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.