YaWK  24.1
Yet another WebKit
settings.php
Go to the documentation of this file.
1 <?php
2 /** Signup Backend Class */
3 namespace YAWK\PLUGINS\USERPAGE {
4  /**
5  * <b>Settings class extends class userpage</b>
6  * <p>SETTINGS TAB serve functions to where user can set his privacy
7  * and email settings. Also he can hide from whoisonline (if activated).</p>
8  * <p><i>Class covers frontend functionality.
9  * See Methods Summary for Details!</i></p>
10  *
11  * @author Daniel Retzl <[email protected]>
12  * @copyright 2009-2015 Daniel Retzl
13  * @version 1.0.0
14  * @brief Userpage Profile Class
15  */
16  class settings
17  {
18  /** * @param string html output data */
19  protected $html;
20  /** * @param object settings object */
21  protected $settings;
22  /** * @param string username */
23  protected $username;
24  /** * @param object user object */
25  protected $user;
26 
27  /**
28  * @brief init check if user is logged in - otherwise draw loginbox
29  * @param object $db database
30  * @return string html output (or login box)
31  */
32  public function init($db){
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  }
46 
47  /**
48  * @brief draw user settings page
49  */
50  public function drawForm(){
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  }
103 
104  }
105 }
Userpage Profile Class.
Definition: settings.php:17
drawForm()
draw user settings page
Definition: settings.php:50
init($db)
init check if user is logged in - otherwise draw loginbox
Definition: settings.php:32