YaWK  24.1
Yet another WebKit
YAWK\PLUGINS\SIGNUP\buildForm Class Reference
+ Inheritance diagram for YAWK\PLUGINS\SIGNUP\buildForm:

Public Member Functions

 buildForm ($db)
 loads the header, layout and footer of the form More...
 
 getAdditionalFields ($db)
 draw html output of all additional fields More...
 
 getFooter ()
 html form footer (closing tag) More...
 
 getForm ($db)
 build the form More...
 
 getHeader ()
 get form header More...
 
 getLayout ($db)
 build form on depending layout More...
 
 getLegend ($db)
 get form legend More...
 
 getMandatoryFields ()
 draw html output: all mandatory fields More...
 
 getSubmitButton ($db)
 draw the submit button More...
 
 getTerms ($db)
 draw html output: checkbox for terms of service More...
 
 getTitle ($db)
 get form title More...
 
 init ($db)
 initialize form (build it) More...
 
- Public Member Functions inherited from YAWK\PLUGINS\SIGNUP\signup
 __construct ()
 signup constructor. More...
 

Public Attributes

 $form = ''
 
 $html = ''
 
- Public Attributes inherited from YAWK\PLUGINS\SIGNUP\signup
 $userpage
 

Additional Inherited Members

- Static Public Member Functions inherited from YAWK\PLUGINS\SIGNUP\signup
static signUp ($db)
 draw html output adultcheck or form on demand More...
 
- Protected Attributes inherited from YAWK\PLUGINS\SIGNUP\signup
 $form
 
 $html
 
 $signup
 
 $username
 

Detailed Description

Class buildForm

serve all methods to draw the user signup form

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

Definition at line 9 of file buildForm.php.

Member Function Documentation

◆ buildForm()

YAWK\PLUGINS\SIGNUP\buildForm::buildForm (   $db)

loads the header, layout and footer of the form

Parameters
object$dbdatabase
Returns
string return html form

Definition at line 31 of file buildForm.php.

31  {
32  $this->form .= $this->getHeader();
33  $this->form .= $this->getLayout($db);
34  $this->form .= $this->getFooter();
35  return $this->form;
36  }
getLayout($db)
build form on depending layout
Definition: buildForm.php:107
getHeader()
get form header
Definition: buildForm.php:55
getFooter()
html form footer (closing tag)
Definition: buildForm.php:152

References $db, YAWK\PLUGINS\SIGNUP\buildForm\$form, YAWK\PLUGINS\SIGNUP\buildForm\getFooter(), YAWK\PLUGINS\SIGNUP\buildForm\getHeader(), and YAWK\PLUGINS\SIGNUP\buildForm\getLayout().

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\init().

◆ getAdditionalFields()

YAWK\PLUGINS\SIGNUP\buildForm::getAdditionalFields (   $db)

draw html output of all additional fields

Parameters
object$dbdatabase

Definition at line 217 of file buildForm.php.

217  {
218  // get additional field settings from db
219  $firstname = \YAWK\settings::getSetting($db, "signup_firstname");
220  $lastname = \YAWK\settings::getSetting($db, "signup_lastname");
221  $street = \YAWK\settings::getSetting($db, "signup_street");
222  $zipcode = \YAWK\settings::getSetting($db, "signup_zipcode");
223  $city = \YAWK\settings::getSetting($db, "signup_city");
224  $country = \YAWK\settings::getSetting($db, "signup_country");
225  // check if fields are required
226  if ($firstname ==='1'){
227  $this->html .= "<label for=\"firstname\">Firstname</label>
228  <input type=\"text\" id=\"firstname\" name=\"firstname\" class=\"form-control\" placeholder=\"Vorname\">";
229  }
230  if ($lastname ==='1'){
231  $this->html .= "<label for=\"lastname\">Lastname</label>
232  <input type=\"text\" id=\"lastname\" name=\"lastname\" class=\"form-control\" placeholder=\"Nachname\">";
233  }
234  if ($street ==='1'){
235  $this->html .= "<label for=\"street\">Street</label>
236  <input type=\"text\" id=\"street\" name=\"street\" class=\"form-control\" placeholder=\"Stra&szlig;e\">";
237  }
238  if ($zipcode ==='1'){
239  $this->html .= "<label for=\"zipcode\">ZIP Code</label>
240  <input type=\"text\" id=\"zipcode\" name=\"zipcode\" class=\"form-control\" placeholder=\"Postleitzahl\">";
241  }
242  if ($city ==='1'){
243  $this->html .= "<label for=\"city\">City</label>
244  <input type=\"text\" id=\"city\" name=\"city\" class=\"form-control\" placeholder=\"Stadt\">";
245  }
246  if ($country ==='1'){
247  $this->html .= "<label for=\"country\">Country</label>
248  <input type=\"text\" id=\"country\" name=\"country\" class=\"form-control\" placeholder=\"Land\">";
249  }
250  }
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
$country
Definition: user-new.php:100
$lastname
Definition: user-new.php:96
$firstname
Definition: user-new.php:95
$city
Definition: user-new.php:99
$zipcode
Definition: user-new.php:98
$street
Definition: user-new.php:97

References $city, $country, $db, $firstname, $lastname, $street, $zipcode, and YAWK\settings\getSetting().

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getForm().

◆ getFooter()

YAWK\PLUGINS\SIGNUP\buildForm::getFooter ( )

html form footer (closing tag)

Definition at line 152 of file buildForm.php.

152  {
153  // form end
154  $this->html .= "</form>";
155  }

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\buildForm().

◆ getForm()

YAWK\PLUGINS\SIGNUP\buildForm::getForm (   $db)

build the form

Parameters
object$dbdatabase
Returns
string return html form

Definition at line 43 of file buildForm.php.

43  {
44  $this->form .= $this->getGroupSelect($db);
45  $this->form .= $this->getMandatoryFields();
46  $this->form .= $this->getAdditionalFields($db);
47  $this->form .= $this->getTerms($db);
48  $this->form .= $this->getSubmitButton($db);
49  return $this->form;
50  }
getTerms($db)
draw html output: checkbox for terms of service
Definition: buildForm.php:205
getMandatoryFields()
draw html output: all mandatory fields
Definition: buildForm.php:186
getSubmitButton($db)
draw the submit button
Definition: buildForm.php:256
getAdditionalFields($db)
draw html output of all additional fields
Definition: buildForm.php:217

References $db, YAWK\PLUGINS\SIGNUP\buildForm\$form, YAWK\PLUGINS\SIGNUP\buildForm\getAdditionalFields(), YAWK\PLUGINS\SIGNUP\buildForm\getMandatoryFields(), YAWK\PLUGINS\SIGNUP\buildForm\getSubmitButton(), and YAWK\PLUGINS\SIGNUP\buildForm\getTerms().

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getLayout().

◆ getHeader()

YAWK\PLUGINS\SIGNUP\buildForm::getHeader ( )

get form header

Definition at line 55 of file buildForm.php.

56  {
57  // form header
58  $this->html .= "<form id=\"form\" action=\"welcome.html\" method=\"POST\">";
59  }

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\buildForm().

◆ getLayout()

YAWK\PLUGINS\SIGNUP\buildForm::getLayout (   $db)

build form on depending layout

Parameters
object$dbdatabase

Definition at line 107 of file buildForm.php.

108  {
109  // get selected form layout (left, right, 1,2, or 3 cols...)
110  $layout = \YAWK\settings::getSetting($db, "signup_layout");
111  // layout row
112  // switch case layout and load corresponding htmlcode
113  switch ($layout) {
114  case "left":
115  // form title
116  $this->html .= "<div class=\"col-md-6\">";
117  $this->html .= self::getLegend($db);
118  $this->html .= "</div>";
119  $this->html .= "<div class=\"col-md-6\">";
120  $this->html .= self::getTitle($db);
121  $this->html .= self::getForm($db);
122  $this->html .= "</div>";
123  break;
124  case "right":
125  $this->html .= "<div class=\"col-md-6\">";
126  $this->html .= self::getTitle($db);
127  $this->html .= self::getForm($db);
128  $this->html .= "</div><div class=\"col-md-6\">";
129  $this->html .= self::getLegend($db);
130  $this->html .= "</div>";
131  break;
132  case "plain":
133  $this->html .= "<div class=\"col-lg-12\">";
134  $this->html .= self::getTitle($db);
135  $this->html .= self::getForm($db);
136  $this->html .= "</div>";
137  break;
138  case "center":
139  $this->html .= "<div class=\"col-md-4\">&nbsp;</div>";
140  $this->html .= "<div class=\"col-md-4\">";
141  $this->html .= self::getTitle($db);
142  $this->html .= self::getForm($db);
143  $this->html .= "</div>";
144  $this->html .= "<div class=\"col-md-4\">&nbsp;</div>";
145  break;
146  }
147  }
getTitle($db)
get form title
Definition: buildForm.php:65
getForm($db)
build the form
Definition: buildForm.php:43
getLegend($db)
get form legend
Definition: buildForm.php:75
if(isset($_POST['sent'])) $layout
Definition: signup.php:98

References $db, $layout, YAWK\PLUGINS\SIGNUP\buildForm\getForm(), YAWK\PLUGINS\SIGNUP\buildForm\getLegend(), YAWK\settings\getSetting(), and YAWK\PLUGINS\SIGNUP\buildForm\getTitle().

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\buildForm().

◆ getLegend()

YAWK\PLUGINS\SIGNUP\buildForm::getLegend (   $db)

get form legend

Parameters
object$dbdatabase

Definition at line 75 of file buildForm.php.

76  {
77  // gid 0 form legend (public) -- default --
78  $this->html .= "<div id=\"0_hidden\">";
79  $this->html .= \YAWK\settings::getLongSetting($db, "signup_legend0");
80  $this->html .= "</div>";
81  // gid 1 form legend (guest)
82  $this->html .= "<div id=\"1_hidden\">";
83  $this->html .= \YAWK\settings::getLongSetting($db, "signup_legend1");
84  $this->html .= "</div>";
85  // gid 1 form legend (guest)
86  $this->html .= "<div id=\"2_hidden\">";
87  $this->html .= \YAWK\settings::getLongSetting($db, "signup_legend2");
88  $this->html .= "</div>";
89  // gid 1 form legend (guest)
90  $this->html .= "<div id=\"3_hidden\">";
91  $this->html .= \YAWK\settings::getLongSetting($db, "signup_legend3");
92  $this->html .= "</div>";
93  // gid 1 form legend (guest)
94  $this->html .= "<div id=\"4_hidden\">";
95  $this->html .= \YAWK\settings::getLongSetting($db, "signup_legend4");
96  $this->html .= "</div>";
97  // gid 1 form legend (guest)
98  $this->html .= "<div id=\"5_hidden\">";
99  $this->html .= \YAWK\settings::getLongSetting($db, "signup_legend5");
100  $this->html .= "</div>";
101  }
static getLongSetting($db, $property)
Get and return longValue for property from settings database.
Definition: settings.php:527

References $db, and YAWK\settings\getLongSetting().

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getLayout().

◆ getMandatoryFields()

YAWK\PLUGINS\SIGNUP\buildForm::getMandatoryFields ( )

draw html output: all mandatory fields

Definition at line 186 of file buildForm.php.

186  {
187  $this->html .= "<label for=\"username\">Username</label>
188  <input type=\"text\" id=\"username\" name=\"username\" class=\"form-control\" placeholder=\"Benutzername\">
189 
190  <label for=\"email\">Email</label>
191  <input type=\"text\" id=\"email\" name=\"email\" class=\"form-control\" placeholder=\"[email protected]\">
192 
193  <label for=\"password1\">Password</label>
194  <input type=\"password\" id=\"password1\" name=\"password1\" class=\"form-control\" placeholder=\"Passwort\">
195 
196  <label for=\"password2\">Password (repeat)</label>
197  <input type=\"password\" id=\"password2\" name=\"password2\" class=\"form-control\" placeholder=\"Passwort wiederholen\">
198  <input type=\"hidden\" name=\"sent\" value=\"1\">";
199  }

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getForm().

◆ getSubmitButton()

YAWK\PLUGINS\SIGNUP\buildForm::getSubmitButton (   $db)

draw the submit button

Parameters
object$dbdatabase

Definition at line 256 of file buildForm.php.

256  {
257  // get selected form layout (left, right, 1,2, or 3 cols...)
258  $layout = \YAWK\settings::getSetting($db, "signup_layout");
259  $btnStyle = \YAWK\settings::getSetting($db, "signup_submitstyle");
260  $btnText = \YAWK\settings::getSetting($db, "signup_submittext");
261  if ($layout === 'center' or $layout === 'plain'){
262  $this->html .= "<div class=\"text-center\"><input type=\"submit\" class=\"btn btn-$btnStyle\" value=\"$btnText\"></div>";
263  } else {
264  $this->html .= "<br><input type=\"submit\" class=\"btn btn-$btnStyle\" value=\"$btnText\">";
265  }
266  }

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

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getForm().

◆ getTerms()

YAWK\PLUGINS\SIGNUP\buildForm::getTerms (   $db)

draw html output: checkbox for terms of service

Parameters
$db

Definition at line 205 of file buildForm.php.

205  {
206  $this->html .= "<input type=\"checkbox\" id=\"checkTerms\" name=\"checkTerms\" class=\"form-control\" checked=\"checked\">
207  <div class=\"text-center\">
208  <label for=\"checkTerms\">
209  <a target=\"_blank\" style=\"color:#";$this->html .= \YAWK\settings::getSetting($db, "signup_toscolor");$this->html .= "\" href=\"";$this->html .= \YAWK\settings::getSetting($db, "signup_tospage");$this->html .= ".html\">";$this->html .= \YAWK\settings::getSetting($db, "signup_tostext"); $this->html .= "</a> akzeptieren</label>
210  </div>";
211  }

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

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getForm().

◆ getTitle()

YAWK\PLUGINS\SIGNUP\buildForm::getTitle (   $db)

get form title

Parameters
object$dbdatabase

Definition at line 65 of file buildForm.php.

66  {
67  // form title
68  $this->html .= \YAWK\settings::getSetting($db, "signup_title");
69  }

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

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\getLayout().

◆ init()

YAWK\PLUGINS\SIGNUP\buildForm::init (   $db)

initialize form (build it)

Parameters
object$dbdatabase
Returns
string return html code

Definition at line 21 of file buildForm.php.

21  {
22  $this->form = $this->buildForm($db);
23  return $this->html;
24  }
buildForm($db)
loads the header, layout and footer of the form
Definition: buildForm.php:31

References $db, YAWK\PLUGINS\SIGNUP\buildForm\$html, and YAWK\PLUGINS\SIGNUP\buildForm\buildForm().

Member Data Documentation

◆ $form

YAWK\PLUGINS\SIGNUP\buildForm::$form = ''
  • Parameters
    stringhtml form

Definition at line 14 of file buildForm.php.

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\buildForm(), and YAWK\PLUGINS\SIGNUP\buildForm\getForm().

◆ $html

YAWK\PLUGINS\SIGNUP\buildForm::$html = ''
  • Parameters
    stringhtml output

Definition at line 12 of file buildForm.php.

Referenced by YAWK\PLUGINS\SIGNUP\buildForm\init().


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