YaWK  24.1
Yet another WebKit
YAWK\PLUGINS\USERPAGE\userpage Class Reference

Userpage Profile Class. More...

Public Member Functions

 __construct ($db, $user)
 userpage constructor. More...
 
 getRootPage ($db, $user)
 detect admin and build a special 'ROOT' page with admin functions... TODO: in development More...
 
 getUserPage ($db, $user, $lang)
 getUserPage is a wrapper for buildPage More...
 
 init ($db, $user, $lang)
 init function check if backend is allowed and load userpage More...
 

Protected Attributes

 $appendPanel
 
 $appendTab
 
 $dashboard
 

Detailed Description

Userpage Profile Class.

Userpage Plugin

Userpage Class check and build the userpage.

Class covers frontend 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 14 of file userpage.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\PLUGINS\USERPAGE\userpage::__construct (   $db,
  $user 
)

userpage constructor.

Parameters
object$dbdatabase
object$useruser object

Definition at line 28 of file userpage.php.

28  {
29  /* property $user */
30  if (isset($username) && (!empty($username)))
31  {
32  $this->user = $username;
33  }
34  $this->usergroup = \YAWK\user::getGroup($db);
35  }

References $db, and $username.

Member Function Documentation

◆ getRootPage()

YAWK\PLUGINS\USERPAGE\userpage::getRootPage (   $db,
  $user 
)

detect admin and build a special 'ROOT' page with admin functions... TODO: in development

Parameters
object$dbdatabase
object$userobject
Returns
string buildPage with admin functions

Definition at line 82 of file userpage.php.

82  {
83  // check, if admin tab is enabled
84  if (\YAWK\settings::getSetting($db, "userpage_admin") === '1'){
85  // prepare dashboard
86  $this->dashboard = "<h5 class=\"btn-danger\">*** ROOT MODE ***</h5>";
87  // root mode notice
88  $this->dashboard .= "Hello $user->username! You are logged in with root access.";
89 
90  // append admin panel + tab
91  $this->appendTab = "<li class=\"nav-item\" role=\"admin\"><a href=\"#admin\" class=\"nav-link\" aria-controls=\"admin\" role=\"tab\" data-toggle=\"tab\">
92  <i class=\"fa fa-wrench\"></i>&nbsp; Admin</a></li>";
93  $this->appendPanel = "<div role=\"tabpanel\" class=\"tab-pane animated fadeIn\" id=\"admin\"><h4>
94  <i class=\"fa fa-lock fa-2x\"></i> &nbsp;Admin Stuff...</h4></div>";
95  }
96  else {
97  $this->appendTab = "";
98  $this->appendPanel = "";
99  }
100  return self::buildPage($db, $user->username, $user->gid, $this->appendTab, $this->appendPanel, $this->dashboard, $lang);
101  }
print $lang['SETTINGS_SAVE']
Definition: userpage.php:282
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
This class serves methods to create backup from files.
Definition: AdminLTE.php:2

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

Referenced by YAWK\PLUGINS\USERPAGE\userpage\init().

◆ getUserPage()

YAWK\PLUGINS\USERPAGE\userpage::getUserPage (   $db,
  $user,
  $lang 
)

getUserPage is a wrapper for buildPage

Parameters
object$dbdatabase
object$userobject
object$langlanguage
Returns
string buildPage function

Definition at line 72 of file userpage.php.

72  {
73  return $this->buildPage($db, $user->username, $user->gid, $this->appendTab, $this->appendPanel, $this->dashboard, $lang);
74  }

References $db, and $lang.

Referenced by YAWK\PLUGINS\USERPAGE\userpage\init().

◆ init()

YAWK\PLUGINS\USERPAGE\userpage::init (   $db,
  $user,
  $lang 
)

init function check if backend is allowed and load userpage

Parameters
object$dbdatabase
object$useruser
Returns
bool|null|string

Definition at line 43 of file userpage.php.

43  {
44  if ($this->usergroup['backend_allowed'] !== '1'){
45  // backend access not allowed
46  // check usergroup
47  if ($this->usergroup['backend_allowed'] === '0') {
48  // load userpage
49  return $this->getUserPage($db, $user, $lang);
50  }
51  else
52  { // throw error
53  return \YAWK\alert::draw("danger", "Error", "Could not load userpage. Something strange has happened.","",6800);
54  }
55  }
56  else {
57  // backend access granted, load root page
58  if (\YAWK\user::isAdmin($db)){
59  return $this->getRootPage($db, $user);
60  }
61  }
62  return null;
63  }
getUserPage($db, $user, $lang)
getUserPage is a wrapper for buildPage
Definition: userpage.php:72
getRootPage($db, $user)
detect admin and build a special 'ROOT' page with admin functions... TODO: in development
Definition: userpage.php:82

References $db, $lang, YAWK\PLUGINS\USERPAGE\userpage\getRootPage(), and YAWK\PLUGINS\USERPAGE\userpage\getUserPage().

Member Data Documentation

◆ $appendPanel

YAWK\PLUGINS\USERPAGE\userpage::$appendPanel
protected
  • Parameters
    stringappend panel

Definition at line 21 of file userpage.php.

◆ $appendTab

YAWK\PLUGINS\USERPAGE\userpage::$appendTab
protected
  • Parameters
    stringappend tab

Definition at line 19 of file userpage.php.

◆ $dashboard

YAWK\PLUGINS\USERPAGE\userpage::$dashboard
protected
  • Parameters
    stringdashboard

Definition at line 17 of file userpage.php.


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