YaWK  24.1
Yet another WebKit
stats.php
Go to the documentation of this file.
1 <?php
2 /** Signup Backend Class */
3 namespace YAWK\PLUGINS\USERPAGE {
4  /**
5  * <b>Stats class for userpage</b>
6  * <p>STATS TAB shows the user his account stats.</p>
7  * <p><i>Class covers frontend functionality.
8  * See Methods Summary for Details!</i></p>
9  *
10  * @author Daniel Retzl <[email protected]>
11  * @copyright 2009-2015 Daniel Retzl
12  * @version 1.0.0
13  * @brief Userpage Profile Class
14  */
15  class stats
16  {
17  /** * @param string html output */
18  protected $html;
19  /** * @param object user object */
20  protected $user;
21 
22  /**
23  * @brief stats constructor. load properties for username
24  * @param object $db database
25  */
26  public function __construct($db){
27  global $user;
28  $this->username = $_SESSION['username'];
29  $user = new \YAWK\user($db);
30  $user->loadProperties($db, $this->username);
31  }
32 
33  /**
34  * @brief draw account stats.
35  * @return string account stats
36  */
37  public function init(){
38  global $user;
39  if($user->blocked === '0') { $blocked = "Alles ok. Dein Account ist in Ordnung."; $blockedHtml = "text-success"; }
40  else { $blocked = "Dein Account wurde geblockt. Irgendetwas ist nicht in Ordnung."; $blockedHtml = "text-danger";
41  }
42 
43  if($user->privacy === '0') { $privacy = "visible"; $privacyHtml = "text-success"; }
44  else { $privacy = "hidden"; $privacyHtml="text-danger";
45  }
46 
47  if($user->public_email === '0') { $public_email = "visible"; $emailHtml = "text-success"; }
48  else { $public_email = "hidden"; $emailHtml = "text-danger";
49  }
50 
51  if($user->date_expired === NULL) {
52  $expiredHtml = "text-success";
53  $expired = "never - lifetime account";
54  }
55  else {
56  $expiredHtml = "text-warning";
57  $expired = "$user->date_expired";
58  }
59 
60  $this->html = "<br><legend><i class=\"fa fa-line-chart\"></i> &nbsp;Account Statistics <small> show details about your account</small></legend>
61  <dl class=\"dl-horizontal\">
62  <dt>Account Status:</dt>
63  <dd><small class=\"$blockedHtml\">$blocked</small></dd>
64  <dt>Active until:</dt>
65  <dd><small class=\"$expiredHtml\">$expired</small></dd>
66  <dt>Account created:</dt>
67  <dd><small>$user->date_created</small></dd>
68  <dt>Account changed:</dt>
69  <dd><small>$user->date_changed</small></dd>
70  <dt>&nbsp;</dt>
71  <dd>&nbsp;</dd>
72  <dt>Your last login:</dt>
73  <dd><small>$user->date_lastlogin</small></dd>
74  <dt>Logins:</dt>
75  <dd><small>$user->login_count</small></dd>
76  <dt>&nbsp;</dt>
77  <dd>&nbsp;</dd>
78  <dt>Online Status:</dt>
79  <dd><small class=\"$privacyHtml\">$privacy</small></dd>
80  <dt>Email adress:</dt>
81  <dd><small class=\"$emailHtml\">$public_email</small></dd>
82  </dl>";
83  return $this->html;
84  }
85  }
86 }
Userpage Profile Class.
Definition: stats.php:16
__construct($db)
stats constructor. load properties for username
Definition: stats.php:26
init()
draw account stats.
Definition: stats.php:37