YaWK  24.1
Yet another WebKit
YAWK\backend Class Reference

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

Static Public Member Functions

static drawContentWrapper ()
 Draw the AdminLTE Content Wrapper. Useful that view dont crash in situations where the DOM is not loaded or could not be loaded. More...
 
static drawFontList ($fontArray, $folder, $type, $lang)
 Draw a list with all fonts. Expects fonts as array. More...
 
static drawLoginBox ($db, $lang)
 Draw a login box. Basically it wraps the drawLoginForm function with an AdminLTE box. More...
 
static drawLoginForm ($username, $password, $lang)
 Draw a login form. If username and/or password was given, the form will be pre-filled with given values. More...
 
static drawTemplateSelectField ($db, $description)
 Draw a SELECT field with all templates, current active template is selected. More...
 
static drawWidgetsOnPageBox ($db, $page, $lang)
 Draw a box containing all widgets that are linked with given page. Every Widget gets drawn as small bubble/button and is linked with the corresponding Widget-edit page. This increased the workflow while editing a page and their widgets. More...
 
static getFullUsername ($user)
 Clever function to return the username. Expects the user object as param to work correctly. More...
 
static getFX ($db, $time, $type)
 Include Javascript FX to apply on #content-FX DOM element. More...
 
static getMenuNamesArray ($db)
 return all menu ids and names as array More...
 
static getMenusArray ($db)
 Get Menu id name and published into an array. More...
 
static getPagesArray ($db)
 Get pages and user groups into an array. More...
 
static getSettingsBreadcrumbs ($lang)
 Return breadcrumbs for settings pages. More...
 
static getTemplateBreadcrumbs ($lang)
 Return breadcrumbs for template pages. More...
 
static getTitle ($title, $subtext)
 Header title on top of every page. More...
 
static printTooltip ($toolTipText)
 Draw a small question mark, enabling a tooltip on hover. toolTipText must be a string and will usually come from any language file. More...
 
static setFocus ($field)
 Set focus to any input field on pageload. More...
 
static setTimeout ($location, $wait)
 

Detailed Description

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

backend Interface Helper Functions

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

<?php YAWK\backend::getTitle("title", "subtext"); ?> Brings up the title on every page in admin panel.

<?php YAWK\backend::setTimeout("index.php?pages=dashboard", "200"); ?> Set a javascript redirection url and $wait time in ms before redirecting

<?php YAWK\backend::setFocus("$field"); ?> Set focus to any form input field on document ready.

More backend helper functions may come in future releases.

Class covers backend functionality. See Methods Summary for Details!

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

Definition at line 26 of file backend.php.

Member Function Documentation

◆ drawContentWrapper()

static YAWK\backend::drawContentWrapper ( )
static

Draw the AdminLTE Content Wrapper. Useful that view dont crash in situations where the DOM is not loaded or could not be loaded.

Returns
null

Definition at line 144 of file backend.php.

144  {
145  echo "
146  <!-- Content Wrapper. Contains page content -->
147  <div class=\"content-wrapper\" id=\"content-FX\">
148  <!-- Content Header (Page header) -->
149  <section class=\"content-header\">
150  </section>
151  <!-- Main content -->
152  <section class=\"content\">";
153  return null;
154  }

◆ drawFontList()

static YAWK\backend::drawFontList (   $fontArray,
  $folder,
  $type,
  $lang 
)
static

Draw a list with all fonts. Expects fonts as array.

Parameters
array$fontArrayarray with font names
string$folderthe folder where fonts are stored
array$langlanguage array

Definition at line 488 of file backend.php.

489  {
490  // we need to check if its a custom font (ttf, otf, woff) or google font.
491  // this determination is needed to flag the delete link - this ensures that
492  // the delete function knows if it's a file to delete or an entry from the database.
493  if ($type === "Google" || ($type === "google"))
494  { // flag get param as google font
495  $flag = "&type=google";
496  }
497  else
498  { // font type unknown
499  $flag = "&type=custom";
500  }
501  // folder is empty...
502  if (!isset($folder) || (empty($folder)))
503  { // default folder
504  $folder = '../system/fonts/';
505  }
506  // if array is empty - no fonts were found
507  if (empty($fontArray))
508  { // throw a message
509  echo $lang['FONTS_NOT_FOUND'];
510  echo "<a href=\"#\" id=\"addFontBtn\" data-toggle=\"modal\" data-target=\"#myModal\"
511  style=\"margin-top:2px;\"><i><small>&nbsp;&nbsp;&raquo; ".$lang['ADD']."</small></i></a>";
512  }
513  else
514  { // walk through folder
515  foreach ($fontArray as $font)
516  { // draw list with fonts, delete and download icon
517  echo "<!-- draw font -->
518  <h4 style=\"font-family:'$font';\">$font<small>
519  <!-- delete font icon -->
520  <a role=\"dialog\" data-confirm=\"$lang[FONT] &laquo; ".$font." &raquo; $lang[DELETE_CONFIRM]\"
521  title=\"".$lang['FONT_DEL']."\" href=\"index.php?page=settings-fonts&delete=true$flag&font=$font\">
522  <i class=\"fa fa-trash-o pull-right\" data-toggle=\"tooltip\" title=\"$lang[DELETE]\" style=\"margin-top:4px;\"></i></a>&nbsp;";
523 
524  // if google fonts get drawn...
525  if ($type === "Google" || ($type === "google"))
526  {
527  // no download icon
528  }
529  else
530  { // download font icon
531  echo "<a href=\"$folder$font\" title=\"$lang[DOWNLOAD] $font\"><i class=\"fa fa-arrow-circle-o-down pull-right\"
532  data-toggle=\"tooltip\" title=\"$lang[TO_DOWNLOAD]\" style=\"margin-top:4px;\"></i></a>&nbsp;&nbsp;";
533  }
534  // close tags
535  echo "</small></h4><hr>";
536  }
537  }
538  }
$folder
Definition: actions.php:9
print $lang['FILEMAN_UPLOAD']
$type
$fontArray

References $folder, $fontArray, $lang, and $type.

◆ drawLoginBox()

static YAWK\backend::drawLoginBox (   $db,
  $lang 
)
static

Draw a login box. Basically it wraps the drawLoginForm function with an AdminLTE box.

Parameters
object$dbDatabase object
string$titleBox title
string$usernameThe username
string$passwordThe password
Returns
string Returns the complete html form

draw login box

Definition at line 294 of file backend.php.

295  { /**
296  * draw login box
297  */
298  /* set focus on text field */
299  \YAWK\backend::setFocus("user");
300  /* get title and draw login box */
301  $title = \YAWK\settings::getSetting($db, "title");
302  $modalWindow = " <!-- Modal -->
303  <form method=\"POST\" action=\"index.php\">
304  <div class=\"modal fade\" id=\"myModal\" role=\"dialog\">
305  <div class=\"modal-dialog\">
306 
307  <!-- Modal content-->
308  <div class=\"modal-content\">
309  <div class=\"modal-header\">
310  <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>
311  <h4 class=\"modal-title\">$lang[PASSWORD_RESET]</h4>
312  </div>
313  <div class=\"modal-body\">
314  <label for=\"email\">$lang[EMAIL]</label>
315  <input type=\"text\" class=\"form-control\" id=\"email\" name=\"email\" placeholder=\"$lang[PASSWORD_RESET_HOWTO]\">
316  <div class=\"text-center\"><br><i>$lang[OR]</i><br></div>
317  <label for=\"username\">$lang[USERNAME]</label>
318  <input type=\"text\" class=\"form-control\" id=\"username\" name=\"username\" placeholder=\"$lang[USERNAME]\">
319  <input type=\"hidden\" name=\"resetPasswordRequest\" id=\"resetPasswordRequest\" value=\"true\">
320  </div>
321  <div class=\"modal-footer\">
322  <div class=\"form-group col-md-12\"><h3 class=\"pull-left\">Please solve this captcha:</h3></div>
323  <div class =\"form-group col-md-4\">
324  <input type=\"text\" size=\"1\" maxlength=\"2\" name=\"number1\" id=\"number1\" value=\"".rand(1,12)."\">
325  </div>
326  <div class=\"form-group col-md-4\">
327  <label for=\"number2\"> + </label> <input type=\"text\" size=\"1\" maxlength=\"2\" name=\"number2\" id=\"number2\" value=\"".rand(1,12)."\">
328  </div>
329  <div class=\"form-group col-md-4\">
330  <label for=\"captcha\"> = </label> <input type=\"text\" size=\"2\" maxlength=\"2\" name=\"captcha\" id=\"captcha\">
331  </div>
332  <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-check\"></i> &nbsp;$lang[PASSWORD_RESET]</button>
333  <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\"><i class=\"fa fa-times\"></i>&nbsp; $lang[CANCEL]</button>
334  <input type=\"hidden\" name=\"resetPasswordRequest\" id=\"resetPasswordRequest\" value=\"true\">
335  <hr>";
336  if (!empty($_SERVER['REMOTE_ADDR'])){
337  $ip = $_SERVER['REMOTE_ADDR'];
338  $hostname = gethostname();
339  $network = gethostbyaddr($_SERVER['REMOTE_ADDR']);
340  }
341  else {
342  $ip = "unknown";
343  $hostname = "unknown";
344  $network = "";
345  }
346 
347  $modalWindow .= "<div class=\"text-left small\"><i><small>Access from IP: $ip @ $hostname from network: $network will be logged.</small></i></div>
348  </div>
349  </div>
350 
351  </div>
352  </div>
353  </form>";
354  // TEMPLATE WRAPPER - HEADER & breadcrumbs
355  $loginBox = "
356  <div class=\"row\" id=\"loginbox\"><br><br>
357  <div class=\"col-md-4\">&nbsp;</div>
358  <div class=\"col-md-4\">
359  <div class=\"box box-default\">
360  <div class=\"box-body\">
361  <h3>Login :: <small>" . $title . "</small></h3><br>";
362  $loginBox .= \YAWK\backend::drawLoginForm("","", $lang);
363  $loginBox .= "<div id=\"loginTimerNode\"></div>
364  </div>
365  <br><br>
366  </div>
367  <div class=\"col-md-4\">&nbsp;</div>
368  </div>";
369  return $modalWindow.$loginBox;
370  }
$ip
Definition: add-comment.php:9
static setFocus($field)
Set focus to any input field on pageload.
Definition: backend.php:93
static drawLoginForm($username, $password, $lang)
Draw a login form. If username and/or password was given, the form will be pre-filled with given valu...
Definition: backend.php:243
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470

References $db, $ip, $lang, YAWK\backend\drawLoginForm(), YAWK\settings\getSetting(), and YAWK\backend\setFocus().

◆ drawLoginForm()

static YAWK\backend::drawLoginForm (   $username,
  $password,
  $lang 
)
static

Draw a login form. If username and/or password was given, the form will be pre-filled with given values.

Parameters
string$usernameThe username
string$passwordThe password
Returns
string Returns the complete html form.

draw login box

Definition at line 243 of file backend.php.

244  { /**
245  * draw login box
246  */
247  if (!isset($username) || (empty($username)))
248  { // set default username: empty
249  $username = "";
250  }
251  if (!isset($password) || (empty($password)))
252  { // set default username: empty
253  $password = "";
254  }
255  if (isset($_SESSION['passwordFail']) && ($_SESSION['passwordFail'] > 1))
256  {
257  // password wrong after user's 2nd try - display reset button
258  $resetBtn = "<a type=\"button\" class=\"btn btn-danger\" id=\"resetPasswordButton\" data-toggle=\"modal\" data-target=\"#myModal\"><i class=\"fa fa-question-circle\"></i> &nbsp;$lang[PASSWORD_FORGOTTEN]</a>";
259  }
260  else
261  { // password not wrong - no button needed
262  $resetBtn = "&nbsp;";
263  }
264 
265  // check if any page is requested
266  if (isset($_GET['page']) && (!empty($_GET['page'])))
267  { // set redirect
268  $redirect = "?page=".$_GET['page']." ";
269  }
270  else
271  { // redirect requested
272  $redirect = '';
273  }
274 
275  $form = "<form role=\"form\" id=\"loginForm\" class=\"form-horizontal\" action=\"index.php".$redirect."\" method=\"post\">
276  <input required type=\"text\" class=\"form-control\" maxlength=\"128\" id=\"user\" value=\"".$username."\" name=\"user\" style=\"margin-bottom:4px;\" placeholder=\"Username\">
277  <input required type=\"password\" class=\"form-control\" id=\"password\" value=\"".$password."\" name=\"password\" placeholder=\"Password\"><br>
278  <button type=\"button\" class=\"btn btn-success\" id=\"loginButton\"><i class=\"fa fa-lock\"></i> &nbsp;".$lang['LOGIN']."</button>
279  &nbsp;&nbsp;".$resetBtn."
280  </form>
281  <div id=\"captchaNode\"></div>
282  <div id=\"loginTimerNode\"></div>";
283  return $form;
284  }
print $_GET['id']
Definition: page-edit.php:357
$redirect

References $_GET, $lang, $password, $redirect, and $username.

Referenced by YAWK\backend\drawLoginBox().

◆ drawTemplateSelectField()

static YAWK\backend::drawTemplateSelectField (   $db,
  $description 
)
static

Draw a SELECT field with all templates, current active template is selected.

Version
1.0.0
Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com @website http://yawk.website
Parameters
object$dbDatabase object

Definition at line 213 of file backend.php.

214  {
215  /* TEMPLATE SELECTOR */
216  echo "<!-- TEMPLATE SELECT -->
217  <select class=\"form-control\" id=\"selectedTemplate\" name=\"selectedTemplate\">
218  <label for id=\"selectedTemplate\">$description</label>
219  <option value=\""; echo \YAWK\template::getCurrentTemplateId($db); echo "\">";
220  echo \YAWK\template::getCurrentTemplateName($db, "backend", 0);
221  echo"</option>";
222  /* foreach to fetch template select fields */
223  foreach(\YAWK\template::getTemplateIds($db) as $template)
224  {
225  echo "<option value=\"".$template['id']."\"";
226  if (isset($_POST['template'])) {
227  if($_POST['template'] === $template['id']){
228  echo "selected=\"selected\"";
229  }
230  }
231  echo ">".$template['name']."</option>";
232  }
233  echo"</select>";
234  }
static getTemplateIds(object $db)
return array with all template id's + names.
Definition: template.php:426
This class serves methods to create backup from files.
Definition: AdminLTE.php:2

References $db, and YAWK\template\getTemplateIds().

Referenced by YAWK\settings\getFormElements().

◆ drawWidgetsOnPageBox()

static YAWK\backend::drawWidgetsOnPageBox (   $db,
  $page,
  $lang 
)
static

Draw a box containing all widgets that are linked with given page. Every Widget gets drawn as small bubble/button and is linked with the corresponding Widget-edit page. This increased the workflow while editing a page and their widgets.

Parameters
object$dbDatabase handle
object$pagecurrent page object
array$langlanguage array

Definition at line 550 of file backend.php.

551  {
552  // get widget list from database
553  $widgetList = widget::loadWidgetsOfPage($db, $page);
554 
555  // Draw a list of widgets, that are bound to this given page->id
556  echo'<!-- WIDGET OVERVIEW -->
557  <div class="box box-default">
558  <div class="box-header with-border">
559  <h3 class="box-title"><i class="fa fa-tags"></i>&nbsp;&nbsp;'.$lang["WIDGETS"].' <small>'.$lang["WIDGETS_ON_THIS_PAGE"].'</small></h3>
560  <!-- box-tools -->
561  <div class="box-tools pull-right">
562  <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
563  </button>
564  </div>
565  <!-- /.box-tools -->
566  </div>
567  <div class="box-body" style="display: block;">';
568  if (isset($widgetList) && (is_array($widgetList)))
569  {
570  // loop through all found widgets
571  foreach ($widgetList as $widget)
572  {
573  // set color of widget depending on published state
574  if ($widget['published'] == 1){ $wTextColor = 'default'; } else { $wTextColor = 'danger'; }
575 
576  // set widget info tag
577  if ($widget['pageID'] == 0){ $wPageInfo = 'all'; } else { $wPageInfo = 'this'; }
578 
579  // check, if widget title is set
580  if ((empty($widget['widgetTitle'])))
581  { // if not, set widget name as title
582  $widget['widgetTitle'] = $widget['name'];
583  }
584 
585  // draw widget bubble
586  echo '<p style="float:left; margin-right:5px;"><a href="index.php?page=widget-edit&widget='.$widget['id'].'" class="btn btn-xs btn-'.$wTextColor.'" title="'.$lang['EDIT'].': '.$widget['name'].' '.$lang['WIDGET'].'">
587  '.$widget['widgetTitle'].' @<small> '.$wPageInfo.' | '.$widget['position'].'</small></a></p>';
588  }
589  }
590  else {
591  echo'<p>'.$lang['NO_WIDGET_CREATED'].' <small><i>(<a href="index.php?page=widget-new">'.$lang['CREATE'].'</a>)</small></p>';
592  }
593  echo'</div>
594  </div>';
595 
596  } // eof drawWidgetsOnPageBox
static loadWidgetsOfPage($db, $page)
Returns an array of all widgets that are linked with given page->id.
Definition: widget.php:1182
$page
Definition: pages.php:355

References $db, $lang, $page, and YAWK\widget\loadWidgetsOfPage().

◆ getFullUsername()

static YAWK\backend::getFullUsername (   $user)
static

Clever function to return the username. Expects the user object as param to work correctly.

Parameters
object$userUser object is required.
Returns
null|string Return the proper string or null.

Definition at line 377 of file backend.php.

378  {
379  if (empty($user->firstname))
380  {
381  $currentUser = $user->username;
382  }
383  if (empty($user->lastname))
384  {
385  $currentUser = $user->username;
386  }
387  if (!empty($user->firstname) && (empty($user->lastname)))
388  {
389  $currentUser = $user->firstname;
390  }
391  if (empty($user->firstname) && (!empty($user->lastname)))
392  {
393  $currentUser = $user->lastname;
394  }
395  if (!empty($user->firstname) && (!empty($user->lastname)))
396  {
397  $currentUser = "$user->firstname"."&nbsp;"."$user->lastname";
398  }
399  if (isset($currentUser))
400  {
401  return $currentUser;
402  }
403  else
404  {
405  return null;
406  }
407  }

Referenced by YAWK\BACKEND\AdminLTE\drawHtmlLeftSidebar(), and YAWK\BACKEND\AdminLTE\drawHtmlNavbarUserAccountMenu().

◆ getFX()

static YAWK\backend::getFX (   $db,
  $time,
  $type 
)
static

Include Javascript FX to apply on #content-FX DOM element.

Parameters
object$dbDatabase object
string$timeFX time in milliseconds
string$typeFX type

Definition at line 123 of file backend.php.

124  {
125  // set defaults
126  if (!$time) {
127  $time = 820;
128  }
129  if (!$type) {
130  $type = "fadeIn";
131  }
132  // are FX enabled?
133  if (\YAWK\settings::getSetting($db, "backendFX") >= 1) {
134  echo "
135  <!-- optional backend FX on -->
136  <script>$(\"#content-FX\").hide(0).delay(0)." . $type . "(" . $time . ")</script>";
137  }
138  }

References $db, $type, and YAWK\settings\getSetting().

Referenced by YAWK\BACKEND\AdminLTE\drawHtmlEnd().

◆ getMenuNamesArray()

static YAWK\backend::getMenuNamesArray (   $db)
static

return all menu ids and names as array

Parameters
$db
Returns
array

Definition at line 465 of file backend.php.

466  {
467  /* @param $db \YAWK\db */
468  if ($res = $db->query("SELECT id, name FROM {menu_names} WHERE published = '1'"))
469  {
470  $menusArray = array();
471  while ($rows = $res->fetch_assoc()) {
472  $menusArray[] = $rows;
473  }
474  /* free result set */
475  $res->close();
476  } else {
477  die ("Sorry, fetch database error: getMenus failed.");
478  }
479  return $menusArray;
480  }
die
Definition: block-user.php:27
$rows
Definition: menus.php:126

References $db, $res, $rows, and die.

Referenced by YAWK\settings\getFormElements().

◆ getMenusArray()

static YAWK\backend::getMenusArray (   $db)
static

Get Menu id name and published into an array.

Parameters
object$dbDatabase object
Returns
array

Definition at line 440 of file backend.php.

441  {
442  /* @param $db \YAWK\db */
443  if ($res = $db->query("SELECT id, name, published, (
444  SELECT COUNT(*)
445  FROM {menu}
446  WHERE menuID = {menu_names}.id
447  ) count FROM {menu_names}")) {
448  $menusArray = array();
449  while ($rows = $res->fetch_assoc()) {
450  $menusArray[] = $rows;
451  }
452  /* free result set */
453  $res->close();
454  } else {
455  die ("Sorry, fetch database error: getMenus failed.");
456  }
457  return $menusArray;
458  }

References $db, $res, $rows, and die.

◆ getPagesArray()

static YAWK\backend::getPagesArray (   $db)
static

Get pages and user groups into an array.

Parameters
object$dbDatabase object
Returns
array|string

Definition at line 415 of file backend.php.

416  {
417  /* @param $db \YAWK\db */
418  if ($res = $db->query("SELECT cp.*, cg.value as gid FROM {pages} as cp
419  JOIN {user_groups} as cg on cp.gid = cg.id ORDER BY id DESC")) {
420  $pagesArray = array();
421  while ($row = $res->fetch_assoc()){
422  $pagesArray[] = $row;
423  }
424  /* free result set */
425  $res->close();
426  }
427  else {
428  $pagesArray = '';
429  echo \YAWK\alert::draw("danger", "Error!", "Sorry, fetch database error: getPagesArray failed.","",4200);
430  // die ("Sorry, fetch database error: getPagesArray failed.");
431  }
432  return $pagesArray;
433  }

References $db, and $res.

◆ getSettingsBreadcrumbs()

static YAWK\backend::getSettingsBreadcrumbs (   $lang)
static

Return breadcrumbs for settings pages.

Parameters
array$langLanguage Array
Returns
string html code

Definition at line 34 of file backend.php.

35  {
36  return "<ol class=\"breadcrumb\">
37  <li><i class=\"fa fa-globe\"></i> &nbsp;<a href=\"index.php?page=settings-frontend\" title=\"$lang[EDIT]\"> $lang[FRONTEND]</a></li>
38  <li><i class=\"fa fa-sign-in\"></i> &nbsp;<a href=\"index.php?page=settings-backend\" title=\"$lang[EDIT]\"> $lang[BACKEND]</a></li>
39  <li><i class=\"fa fa-cogs\"></i> &nbsp;<a href=\"index.php?page=settings-system\" title=\"$lang[EDIT]\"> $lang[SYSTEM]</a></li>
40  <li><i class=\"fa fa-envelope-o\"></i> &nbsp;<a href=\"index.php?page=settings-webmail\" title=\"$lang[WEBMAIL]\"> $lang[WEBMAIL]</a></li>
41  <li><i class=\"fa fa-language\"></i> &nbsp;<a href=\"index.php?page=settings-language\" title=\"$lang[EDIT]\"> $lang[LANGUAGES]</a></li>
42  <li><i class=\"fa fa-android\"></i> &nbsp;<a href=\"index.php?page=settings-robots\" title=\"$lang[EDIT]\"> $lang[ROBOTS_TXT]</a></li>
43  <li><i class=\"fa fa-puzzle-piece\"></i> &nbsp;<a href=\"index.php?page=settings-assets\" title=\"$lang[EDIT]\"> $lang[ASSETS]</a></li>
44  <li><i class=\"fa fa-font\"></i> &nbsp;<a href=\"index.php?page=settings-fonts\" title=\"$lang[EDIT]\"> $lang[FONTS]</a></li>
45  <li><i class=\"fa fa-database\"></i> &nbsp;<a href=\"index.php?page=settings-database\" title=\"$lang[EDIT]\"> $lang[DATABASE]</a></li>
46  <li><i class=\"fa fa-info-circle\"></i> &nbsp;<a href=\"index.php?page=settings-systeminfo\" title=\"$lang[EDIT]\"> $lang[SYSTEM] $lang[INFO]</a></li>
47  </ol></section>";
48  }

◆ getTemplateBreadcrumbs()

static YAWK\backend::getTemplateBreadcrumbs (   $lang)
static

Return breadcrumbs for template pages.

Parameters
array$langLanguage Array
Returns
string html code

Definition at line 55 of file backend.php.

56  {
57  // <li><i class=\"fa fa-tint\"></i> &nbsp;<a href=\"index.php?page=template-theme\" title=\"$lang[EDIT]\"> $lang[THEME]</a></li>
58 
59  return "<ol class=\"breadcrumb\">
60  <li><i class=\"fa fa-home\"></i> &nbsp;<a href=\"index.php?page=template-overview\" title=\"$lang[EDIT]\"> $lang[OVERVIEW]</a></li>
61  <li><i class=\"fa fa-cube\"></i> &nbsp;<a href=\"index.php?page=template-positions\" title=\"$lang[EDIT]\"> $lang[POSITIONS]</a></li>
62  <li><i class=\"fa fa-paint-brush\"></i> &nbsp;<a href=\"index.php?page=template-redesign\" title=\"$lang[EDIT]\"> $lang[DESIGN]</a></li>
63  <li><i class=\"fa fa-text-height\"></i> &nbsp;<a href=\"index.php?page=template-typography\" title=\"$lang[EDIT]\"> $lang[TYPOGRAPHY]</a></li>
64  <li><i class=\"fa fa-css3\"></i> &nbsp;<a href=\"index.php?page=template-customcss\" title=\"$lang[EDIT]\"> $lang[CUSTOM_CSS]</a></li>
65  <li><i class=\"fa fa-code\"></i> &nbsp;<a href=\"index.php?page=template-customjs\" title=\"$lang[EDIT]\"> $lang[CUSTOM_JS]</a></li>
66  <li><i class=\"fa fa-puzzle-piece\"></i> &nbsp;<a href=\"index.php?page=template-assets\" title=\"$lang[EDIT]\"> $lang[ASSETS]</a></li>
67  <li><i class=\"fa fa-eye\"></i> &nbsp;<a href=\"index.php?page=template-preview\" title=\"$lang[WEBSITE] $lang[PREVIEW]\"> $lang[PREVIEW]</a></li>
68  </ol></section>";
69  }

◆ getTitle()

static YAWK\backend::getTitle (   $title,
  $subtext 
)
static

Header title on top of every page.

Parameters
string$titleTitle to display
string$subtextSubtitle as small-tag beneath Title
Returns
string

Definition at line 79 of file backend.php.

80  {
81  if ($title && $subtext) {
82  $html = "<h1>" . $title . "&nbsp;<small>" . $subtext . "</small></h1>";
83  } else {
84  $html = "<h1>" . $title . "</h1>";
85  }
86  return $html;
87  }
$subtext
Definition: jplayer.php:19

References $subtext.

◆ printTooltip()

static YAWK\backend::printTooltip (   $toolTipText)
static

Draw a small question mark, enabling a tooltip on hover. toolTipText must be a string and will usually come from any language file.

Parameters
string$toolTipTexttext that will appear as tooltip on mouseover

Definition at line 603 of file backend.php.

604  {
605  if (!empty($toolTipText))
606  { // print out toolTip markup
607  return '<small><i class="fa fa-question-circle-o text-info" data-placement="auto right" data-toggle="tooltip" title="'.$toolTipText.'"></i></small>';
608  }
609  else {
610  return '<small><i class="fa fa-question-circle-o text-info" data-placement="auto right" data-toggle="tooltip" title="Tooltip fehlt leider :("></i></small>';
611  }
612  }

Referenced by YAWK\menu\displayEditable(), and YAWK\BACKEND\dashboard\drawLatestPagesBox().

◆ setFocus()

static YAWK\backend::setFocus (   $field)
static

Set focus to any input field on pageload.

Parameters
string$fieldName of the html input form element who should be focused.

Definition at line 93 of file backend.php.

94  {
95  print"<script type=\"text/javascript\" >
96  $(document).ready(function() {
97  $('#" . $field . "').focus(); });
98  </script>";
99  }
$field
Definition: booking.php:9

References $field.

Referenced by YAWK\backend\drawLoginBox().

◆ setTimeout()

static YAWK\backend::setTimeout (   $location,
  $wait 
)
static

Do a javascript redirect to $location after given delay time ($wait) in ms

Parameters
string$locationurl to redirect
string$waitTime to wait in ms before redirect

Definition at line 106 of file backend.php.

107  {
108  print"<script type=\"text/javascript\">
109  setTimeout(\"self.location.href='" . $location . "'\"," . $wait . ");
110  </script>
111  <noscript>
112  <h1>Your Browser needs activated javascript, to render the site correctly.<br>
113  <small>Please click <a href=\"$location\">here</a> to go ahead.</small></h1>
114  </noscript>";
115  }

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