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

Userpage Profile Class. More...

Public Member Functions

 drawForm ()
 draw user settings page More...
 
 init ($db)
 init check if user is logged in - otherwise draw loginbox More...
 

Protected Attributes

 $html
 
 $settings
 
 $user
 
 $username
 

Detailed Description

Userpage Profile Class.

Settings class extends class userpage

SETTINGS TAB serve functions to where user can set his privacy and email settings. Also he can hide from whoisonline (if activated).

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 16 of file settings.php.

Member Function Documentation

◆ drawForm()

YAWK\PLUGINS\USERPAGE\settings::drawForm ( )

draw user settings page

Definition at line 50 of file settings.php.

50  {
51  global $user;
52  if ($user->privacy === '0'){
53  $whoisonlineCheckedOn = "checked";
54  $whoisonlineCheckedOff = "";
55  } else {
56  $whoisonlineCheckedOff = "checked";
57  $whoisonlineCheckedOn = "";
58  }
59  if ($user->public_email === '0'){
60  $EmailCheckedOn = "checked";
61  $EmailCheckedOff = "";
62  } else {
63  $EmailCheckedOff = "checked";
64  $EmailCheckedOn = "";
65  }
66  // form header
67  $this->html .= "<form id=\"form\" class=\"form-inline\" action=\"welcome.html\" method=\"POST\">";
68  $this->html .= "
69  <fieldset>
70  <legend><i class=\"fa fa-eye\"></i> &nbsp;Privacy Settings <small> take care of your data.</small></legend>
71  <dl class=\"dl-horizontal\">
72  <dt><small><i class=\"fa fa-lock\"></i></small> Who is online?</dt>
73  <dd>
74  <input type=\"radio\" id=\"whoisonline-on\" name=\"privacy\" value=\"0\" $whoisonlineCheckedOn>
75  <label class=\"radio-inline control-label\" for=\"whoisonline-on\"> &nbsp;visible</label><br>
76 
77  <input type=\"radio\" id=\"whoisonline-off\" name=\"privacy\" value=\"1\" $whoisonlineCheckedOff>
78  <label class=\"radio-inline control-label\" for=\"whoisonline-off\"> &nbsp;not visible</label><br><br>
79  </dd>
80  <dt><small><i class=\"fa fa-envelope-o\"></i></small> Email</dt>
81  <dd>
82  <input type=\"radio\" id=\"email-on\" name=\"public_email\" value=\"0\" $EmailCheckedOn>
83  <label class=\"radio-inline control-label\" for=\"email-on\"> &nbsp;visible for other users</label><br>
84 
85  <input type=\"radio\" id=\"email-off\" name=\"public_email\" value=\"1\" $EmailCheckedOff>
86  <label class=\"radio-inline control-label\" for=\"email-off\"> &nbsp;not visible for other users</label><br>
87  </dd>
88  </dl>
89  </fieldset>";
90  $this->html .= "<input type=\"submit\" name=\"submit\" value=\"Speichern\" class=\"btn btn-success\">";
91  $this->html .= "<input type=\"hidden\" name=\"settings-update\" value=\"1\">";
92  $this->html .= "<input type=\"hidden\" name=\"uid\" value=\"$user->id\">";
93  $this->html .= "<br><br><br>";
94  $this->html .= "<legend><i class=\"fa fa-user-times\"></i> &nbsp;Terminate my account<small> - Delete my permanent.</small></legend>
95  <dl class=\"dl-horizontal\">
96  <dt><small><i class=\"fa fa-ban\"></i></small> Delete account</dt>
97  <dd><a href=\"logout.html\" id=\"terminateUser\" class=\"btn btn-warning\"><i class=\"fa fa-ban\"></i> &nbsp;De-activate my account</a><br>
98  <label for=\"terminateUser\">Think twice. This will de-activate your account permanently.<br>
99  Attention! <u>You are not able to login anymore afterwards.</u></label></dd>
100  </dl><br>";
101  $this->html .= "</form>";
102  }

References YAWK\PLUGINS\USERPAGE\settings\$user.

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

◆ init()

YAWK\PLUGINS\USERPAGE\settings::init (   $db)

init check if user is logged in - otherwise draw loginbox

Parameters
object$dbdatabase
Returns
string html output (or login box)

Definition at line 32 of file settings.php.

32  {
33  global $user;
34  $this->username = $_SESSION['username'];
35  $user = new \YAWK\user($db);
36  $user->loadProperties($db, $this->username);
37  if ($user->isLoggedIn($db, $user->username)){
38  $this->html .= $this->drawForm();
39  return $this->html;
40  }
41  else {
42  echo \YAWK\alert::draw("danger", "Error!", "Obviously you are not correctly logged in. Please re-login!","",6800);
43  return \YAWK\user::drawLoginBox("","");
44  }
45  }
drawForm()
draw user settings page
Definition: settings.php:50

References $db, YAWK\PLUGINS\USERPAGE\settings\$html, YAWK\PLUGINS\USERPAGE\settings\$user, and YAWK\PLUGINS\USERPAGE\settings\drawForm().

Member Data Documentation

◆ $html

YAWK\PLUGINS\USERPAGE\settings::$html
protected
  • Parameters
    stringhtml output data

Definition at line 19 of file settings.php.

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

◆ $settings

YAWK\PLUGINS\USERPAGE\settings::$settings
protected
  • Parameters
    objectsettings object

Definition at line 21 of file settings.php.

◆ $user

YAWK\PLUGINS\USERPAGE\settings::$user
protected
  • Parameters
    objectuser object

Definition at line 25 of file settings.php.

Referenced by YAWK\PLUGINS\USERPAGE\settings\drawForm(), and YAWK\PLUGINS\USERPAGE\settings\init().

◆ $username

YAWK\PLUGINS\USERPAGE\settings::$username
protected
  • Parameters
    stringusername

Definition at line 23 of file settings.php.


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