dolibarr  7.0.0-beta
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 
38  var $db;
39  var $param;
40  var $enabled = 1;
41 
42  var $info_box_head = array();
43  var $info_box_contents = array();
44 
45 
52  function __construct($db,$param)
53  {
54  global $conf;
55 
56  $this->db=$db;
57  }
58 
65  function loadBox($max=5)
66  {
67  global $conf, $user, $langs, $db;
68 
69  $textHead = $langs->trans("BoxLoginInformation");
70  $this->info_box_head = array(
71  'text' => $textHead,
72  'limit'=> dol_strlen($textHead),
73  );
74 
75  $line=0;
76  $this->info_box_contents[$line][0] = array(
77  'td' => '',
78  'text' => $langs->trans("User"),
79  );
80  $this->info_box_contents[$line][1] = array(
81  'td' => '',
82  'text' => $user->getNomUrl(-1),
83  'asis' => 1
84  );
85 
86  $line=1;
87  $this->info_box_contents[$line][0] = array(
88  'td' => '',
89  'text' => $langs->trans("PreviousConnexion"),
90  );
91  if ($user->datepreviouslogin) $tmp= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
92  else $tmp= $langs->trans("Unknown");
93  $this->info_box_contents[$line][1] = array(
94  'td' => '',
95  'text' => $tmp,
96  );
97 
98  }
99 
100 
109  function showBox($head = null, $contents = null, $nooutput=0)
110  {
111  parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
112  }
113 }
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.