YaWK  24.1
Yet another WebKit
YAWK\BACKEND\dashboard Class Reference

Dashboard class serves a few useful functions for the admin backend. More...

Static Public Member Functions

static drawLatestPagesBox ($db, $limit, $lang)
 Draws a box containing the recently added static pages. More...
 
static drawLatestUsers ($db, $limit, $lang)
 Draws a box containing the recently added users. More...
 

Detailed Description

Dashboard class serves a few useful functions for the admin backend.

Admin LTE Dashboard Class

This class serves a few methods that build the Admin LTE Dashboard view in the backend.

Methods are mostly draw functions that output html.

Class covers backend template functionality. See Methods Summary for Details!

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0/

Definition at line 19 of file dashboard.php.

Member Function Documentation

◆ drawLatestPagesBox()

static YAWK\BACKEND\dashboard::drawLatestPagesBox (   $db,
  $limit,
  $lang 
)
static

Draws a box containing the recently added static pages.

Parameters
object$dbthe database object
object$langlanguage object
int$limitnumber for sql limitation

Definition at line 28 of file dashboard.php.

30  { // default latest pages
31  if (!isset($limit) || (empty($limit))) { $limit = 4; }
32  $latestPages = array();
33  $latestPages = \YAWK\page::getLatest($db, $limit);
34  // print_r($latestPages);
35 
36  echo "<!-- PRODUCT LIST -->
37  <div class=\"box box-primary\">
38  <div class=\"box-header with-border\">
39  <h3 class=\"box-title\">$lang[RECENTLY_ADDED_PAGES]</h3>
40 
41  <div class=\"box-tools pull-right\">
42  <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
43  </button>
44  <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i></button>
45  </div>
46  </div>
47  <!-- /.box-header -->
48  <div class=\"box-body\">
49  <ul class=\"products-list product-list-in-box\">";
50 
51  foreach ($latestPages AS $page => $property)
52  {
53  if ($property['published'] === "1")
54  { // page is online
55  $color = "success"; $text = "online";
56  }
57  else
58  { // page is offline
59  $color = "danger"; $text= "offline";
60  }
61  $since = \YAWK\sys::time_ago($property['date_publish'], $lang);
62  echo"<li class=\"item\">
63  <div class=\"product-img\">
64  <i class=\"fa fa-file-code-o fa-2x text-muted\"></i>
65  </div>
66  <div class=\"product-info\">
67  <a href=\"index.php?page=page-edit&alias=$property[alias]&id=$property[id]\" class=\"product-title\">$property[title]
68  <span class=\"label label-$color pull-right\">$text</span></a>
69  <span class=\"product-description\">
70  <small>$lang[PUBLISHED] $since &nbsp;"; \YAWK\backend::printTooltip($property['date_publish']); echo"</small>
71  </span>
72  </div>
73  </li>";
74  }
75 
76  echo"<!-- /.item -->
77  </ul>
78  </div>
79  <!-- /.box-body -->
80  <div class=\"box-footer text-center\">
81  <a href=\"index.php?page=pages\" class=\"uppercase\">$lang[VIEW_ALL_PAGES]</a>
82  </div>
83  <!-- /.box-footer -->
84  </div>
85  <!-- /.box -->";
86 
print $lang['FILEMAN_UPLOAD']
static printTooltip($toolTipText)
Draw a small question mark, enabling a tooltip on hover. toolTipText must be a string and will usuall...
Definition: backend.php:603
static getLatest($db, $limit)
get latest pages
Definition: page.php:1058
static time_ago($userdate, $lang)
how many time is been gone since given date
Definition: sys.php:1630
$page
Definition: pages.php:355

References $db, $lang, $page, YAWK\page\getLatest(), YAWK\backend\printTooltip(), and YAWK\sys\time_ago().

◆ drawLatestUsers()

static YAWK\BACKEND\dashboard::drawLatestUsers (   $db,
  $limit,
  $lang 
)
static

Draws a box containing the recently added users.

Parameters
object$dbdatabase
int$limitnumber for sql limitation
object$langlanguage object

Definition at line 94 of file dashboard.php.

96  {
97  // set default value
98  if (!isset($limit) && (empty($limit))) { $limit = 8; }
99  // get latest users into array
100  $latestUsers = \YAWK\user::getLatestUsers($db, $limit);
101  // get n of members
102  $members = count($latestUsers);
103  echo "
104  <!-- USERS LIST -->
105  <div class=\"box box-danger\">
106  <div class=\"box-header with-border\">
107  <h3 class=\"box-title\">$lang[LATEST_MEMBERS]</h3>
108 
109  <div class=\"box-tools pull-right\">
110  <span class=\"label label-danger\">$members $lang[NEW_MEMBERS]</span>
111  <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
112  </button>
113  <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"remove\"><i class=\"fa fa-times\"></i>
114  </button>
115  </div>
116  </div>
117  <!-- /.box-header -->
118  <div class=\"box-body no-padding\">
119  <ul class=\"users-list clearfix\">";
120  foreach ($latestUsers AS $newUser)
121  {
122  $userpic = \YAWK\user::getUserImage("backend", $newUser['username'], "img-circle", 50, 50);
123  $timeAgo = \YAWK\sys::time_ago($newUser['date_created'], $lang);
124  echo "<li>
125  <a href=\"index.php?page=user-edit&user=$newUser[username]\">$userpic</a>
126  <br><a href=\"index.php?page=user-edit&user=$newUser[username]\">$newUser[username]</a>
127  <span class=\"users-list-date\">$timeAgo</span>
128  </li>";
129  }
130  echo "</ul>
131  <!-- /.users-list -->
132  </div>
133  <!-- /.box-body -->
134  <div class=\"box-footer text-center\">
135  <a href=\"index.php?page=users\" class=\"uppercase\">$lang[VIEW_ALL_MEMBERS]</a>
136  </div>
137  <!-- /.box-footer -->
138  </div>
139  <!--/.box -->";
static getUserImage($location, $user, $cssClass, $w, $h)
return and output user image
Definition: user.php:1079
static getLatestUsers($db, $count)
get latest users and return as array
Definition: user.php:718

References $db, $lang, YAWK\user\getLatestUsers(), YAWK\user\getUserImage(), and YAWK\sys\time_ago().


The documentation for this class was generated from the following file: