Zeile 26 | Zeile 26 |
---|
/** * Constructor. Outputs the form tag with the specified options. *
|
/** * Constructor. Outputs the form tag with the specified options. *
|
* @param string The action for the form. * @param string The method (get or post) for this form. * @param string The ID of the form. * @param boolean Should file uploads be allowed for this form? * @param boolean The name of the form * @param boolean Should this form be returned instead of output to the browser? * @param boolean The onsubmit action of the form
| * @param string $script The action for the form. * @param string $method The method (get or post) for this form. * @param string $id The ID of the form. * @param boolean $allow_uploads Should file uploads be allowed for this form? * @param string $name The name of the form * @param boolean $return Should this form be returned instead of output to the browser? * @param string $onsubmit The onsubmit action of the form
|
*/
|
*/
|
function __construct($script='', $method='', $id="", $allow_uploads=0, $name="", $return=false, $onsubmit="")
| function __construct($script='', $method='', $id="", $allow_uploads=false, $name="", $return=false, $onsubmit="")
|
{ global $mybb; $form = "<form action=\"{$script}\" method=\"{$method}\"";
|
{ global $mybb; $form = "<form action=\"{$script}\" method=\"{$method}\"";
|
if($allow_uploads != 0)
| if($allow_uploads != false)
|
{ $form .= " enctype=\"multipart/form-data\""; }
| { $form .= " enctype=\"multipart/form-data\""; }
|
Zeile 73 | Zeile 73 |
---|
/** * Generate and return a hidden field. *
|
/** * Generate and return a hidden field. *
|
* @param string The name of the hidden field. * @param string The value of the hidden field. * @param array Optional array of options (id)
| * @param string $name The name of the hidden field. * @param string $value The value of the hidden field. * @param array $options Optional array of options (id)
|
* @return string The generated hidden */ function generate_hidden_field($name, $value, $options=array())
| * @return string The generated hidden */ function generate_hidden_field($name, $value, $options=array())
|
Zeile 92 | Zeile 92 |
---|
/** * Generate a text box field. *
|
/** * Generate a text box field. *
|
* @param string The name of the text box. * @param string The value of the text box. * @param array Array of options for the text box (class, style, id)
| * @param string $name The name of the text box. * @param string $value The value of the text box. * @param array $options Array of options for the text box (class, style, id)
|
* @return string The generated text box. */ function generate_text_box($name, $value="", $options=array())
| * @return string The generated text box. */ function generate_text_box($name, $value="", $options=array())
|
Zeile 123 | Zeile 123 |
---|
/** * Generate a numeric field. *
|
/** * Generate a numeric field. *
|
* @param string The name of the numeric box. * @param int The value of the numeric box. * @param array Array of options for the numeric box (min, max, step, class, style, id)
| * @param string $name The name of the numeric box. * @param int $value The value of the numeric box. * @param array $options Array of options for the numeric box (min, max, step, class, style, id)
|
* @return string The generated numeric box. */
|
* @return string The generated numeric box. */
|
function generate_numeric_field($name, $value="", $options=array())
| function generate_numeric_field($name, $value=0, $options=array())
|
{
|
{
|
$input = "<input type=\"number\" name=\"".$name."\" value=\"".(int)$value."\""; if(isset($options['min']))
| if(is_numeric($value)) { $value = (float)$value; } else { $value = ''; }
$input = "<input type=\"number\" name=\"{$name}\" value=\"{$value}\""; if(isset($options['min']))
|
{ $input .= " min=\"".$options['min']."\""; } if(isset($options['max']))
|
{ $input .= " min=\"".$options['min']."\""; } if(isset($options['max']))
|
{
| {
|
$input .= " max=\"".$options['max']."\""; } if(isset($options['step'])) { $input .= " step=\"".$options['step']."\"";
|
$input .= " max=\"".$options['max']."\""; } if(isset($options['step'])) { $input .= " step=\"".$options['step']."\"";
|
} if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\""; } if(isset($options['style'])) { $input .= " style=\"".$options['style']."\""; }
| } if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\""; } if(isset($options['style'])) { $input .= " style=\"".$options['style']."\""; }
|
if(isset($options['id'])) { $input .= " id=\"".$options['id']."\"";
| if(isset($options['id'])) { $input .= " id=\"".$options['id']."\"";
|
Zeile 166 | Zeile 175 |
---|
/** * Generate a password input box. *
|
/** * Generate a password input box. *
|
* @param string The name of the password box. * @param string The value of the password box. * @param array Array of options for the password box (class, id)
| * @param string $name The name of the password box. * @param string $value The value of the password box. * @param array $options Array of options for the password box (class, id, autocomplete)
|
* @return string The generated password input box. */ function generate_password_box($name, $value="", $options=array()) { $input = "<input type=\"password\" name=\"".$name."\" value=\"".htmlspecialchars_uni($value)."\"";
|
* @return string The generated password input box. */ function generate_password_box($name, $value="", $options=array()) { $input = "<input type=\"password\" name=\"".$name."\" value=\"".htmlspecialchars_uni($value)."\"";
|
if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\""; } if(isset($options['id'])) { $input .= " id=\"".$options['id']."\""; } if(isset($options['autocomplete'])) { $input .= " autocomplete=\"".$options['autocomplete']."\""; } $input .= " />"; return $input; }
| if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\""; } else { $input .= " class=\"text_input\""; } if(isset($options['id'])) { $input .= " id=\"".$options['id']."\""; } if(isset($options['autocomplete'])) { $input .= " autocomplete=\"".$options['autocomplete']."\""; } $input .= " />"; return $input; }
|
/** * Generate a file upload field. *
|
/** * Generate a file upload field. *
|
* @param string The name of the file upload field. * @param array Array of options for the file upload field (class, id)
| * @param string $name The name of the file upload field. * @param array $options Array of options for the file upload field (class, id, style)
|
* @return string The generated file upload field. */ function generate_file_upload_box($name, $options=array())
| * @return string The generated file upload field. */ function generate_file_upload_box($name, $options=array())
|
Zeile 207 | Zeile 216 |
---|
if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\"";
|
if(isset($options['class'])) { $input .= " class=\"text_input ".$options['class']."\"";
|
}
| }
|
else { $input .= " class=\"text_input\"";
| else { $input .= " class=\"text_input\"";
|
Zeile 228 | Zeile 237 |
---|
/** * Generate a text area. *
|
/** * Generate a text area. *
|
* @param string The name of of the text area. * @param string The value of the text area field. * @param array Array of options for text area (class, id, rows, cols, style, disabled, maxlength)
| * @param string $name The name of of the text area. * @param string $value The value of the text area field. * @param array $options Array of options for text area (class, id, rows, cols, style, disabled, maxlength, readonly)
|
* @return string The generated text area field. */ function generate_text_area($name, $value="", $options=array())
|
* @return string The generated text area field. */ function generate_text_area($name, $value="", $options=array())
|
{
| {
|
$textarea = "<textarea"; if(!empty($name))
|
$textarea = "<textarea"; if(!empty($name))
|
{
| {
|
$textarea .= " name=\"{$name}\"";
|
$textarea .= " name=\"{$name}\"";
|
}
| }
|
if(isset($options['class']))
|
if(isset($options['class']))
|
{
| {
|
$textarea .= " class=\"{$options['class']}\"";
|
$textarea .= " class=\"{$options['class']}\"";
|
} if(isset($options['id'])) { $textarea .= " id=\"{$options['id']}\"";
| } if(isset($options['id'])) { $textarea .= " id=\"{$options['id']}\"";
|
} if(isset($options['style'])) { $textarea .= " style=\"{$options['style']}\"";
|
} if(isset($options['style'])) { $textarea .= " style=\"{$options['style']}\"";
|
}
| }
|
if(isset($options['disabled']) && $options['disabled'] !== false) { $textarea .= " disabled=\"disabled\""; } if(isset($options['readonly']) && $options['readonly'] !== false)
|
if(isset($options['disabled']) && $options['disabled'] !== false) { $textarea .= " disabled=\"disabled\""; } if(isset($options['readonly']) && $options['readonly'] !== false)
|
{
| {
|
$textarea .= " readonly=\"readonly\"";
|
$textarea .= " readonly=\"readonly\"";
|
}
| }
|
if(isset($options['maxlength']))
|
if(isset($options['maxlength']))
|
{
| {
|
$textarea .= " maxlength=\"{$options['maxlength']}\""; } if(!isset($options['rows']))
|
$textarea .= " maxlength=\"{$options['maxlength']}\""; } if(!isset($options['rows']))
|
{
| {
|
$options['rows'] = 5; } if(!isset($options['cols']))
|
$options['rows'] = 5; } if(!isset($options['cols']))
|
{
| {
|
$options['cols'] = 45; } $textarea .= " rows=\"{$options['rows']}\" cols=\"{$options['cols']}\">";
| $options['cols'] = 45; } $textarea .= " rows=\"{$options['rows']}\" cols=\"{$options['cols']}\">";
|
Zeile 280 | Zeile 289 |
---|
/** * Generate a radio button.
|
/** * Generate a radio button.
|
* * @param string The name of the radio button. * @param string The value of the radio button * @param string The label of the radio button if there is one. * @param array Array of options for the radio button (id, class, checked)
| * * @param string $name The name of the radio button. * @param string $value The value of the radio button * @param string $label The label of the radio button if there is one. * @param array $options Array of options for the radio button (id, class, checked)
|
* @return string The generated radio button. */ function generate_radio_button($name, $value="", $label="", $options=array())
| * @return string The generated radio button. */ function generate_radio_button($name, $value="", $label="", $options=array())
|
Zeile 306 | Zeile 315 |
---|
else { $input .= " class=\"radio_input\"";
|
else { $input .= " class=\"radio_input\"";
|
} if(isset($options['id'])) {
| } if(isset($options['id'])) {
|
$input .= " id=\"".$options['id']."\""; } if(isset($options['checked']) && $options['checked'] != 0)
| $input .= " id=\"".$options['id']."\""; } if(isset($options['checked']) && $options['checked'] != 0)
|
Zeile 327 | Zeile 336 |
---|
/** * Generate a checkbox. *
|
/** * Generate a checkbox. *
|
* @param string The name of the check box. * @param string The value of the check box. * @param string The label of the check box if there is one. * @param array Array of options for the check box (id, class, checked)
| * @param string $name The name of the check box. * @param string $value The value of the check box. * @param string $label The label of the check box if there is one. * @param array $options Array of options for the check box (id, class, checked, onclick)
|
* @return string The generated check box. */ function generate_check_box($name, $value="", $label="", $options=array()) { $input = "<label";
|
* @return string The generated check box. */ function generate_check_box($name, $value="", $label="", $options=array()) { $input = "<label";
|
if(isset($options['id'])) {
| if(isset($options['id'])) {
|
$input .= " for=\"{$options['id']}\"";
|
$input .= " for=\"{$options['id']}\"";
|
} if(isset($options['class']))
| } if(isset($options['class']))
|
{ $input .= " class=\"label_{$options['class']}\""; }
| { $input .= " class=\"label_{$options['class']}\""; }
|
Zeile 348 | Zeile 357 |
---|
if(isset($options['class'])) { $input .= " class=\"checkbox_input ".$options['class']."\"";
|
if(isset($options['class'])) { $input .= " class=\"checkbox_input ".$options['class']."\"";
|
} else
| } else
|
{ $input .= " class=\"checkbox_input\""; }
| { $input .= " class=\"checkbox_input\""; }
|
Zeile 372 | Zeile 381 |
---|
} $input .= "</label>"; return $input;
|
} $input .= "</label>"; return $input;
|
}
| }
|
/** * Generate a select box. *
|
/** * Generate a select box. *
|
* @param string The name of the select box. * @param array Array of options in key => val format. * @param mixed Either a string containing the selected item or an array containing multiple selected items (options['multiple'] must be true) * @param array Array of options for the select box (multiple, class, id, size)
| * @param string $name The name of the select box. * @param array $option_list Array of options in key => val format. * @param string|array $selected Either a string containing the selected item or an array containing multiple selected items (options['multiple'] must be true) * @param array $options Array of options for the select box (multiple, class, id, size)
|
* @return string The select box. */
|
* @return string The select box. */
|
function generate_select_box($name, $option_list, $selected=array(), $options=array())
| function generate_select_box($name, $option_list=array(), $selected=array(), $options=array())
|
{ if(!isset($options['multiple']))
|
{ if(!isset($options['multiple']))
|
{
| {
|
$select = "<select name=\"{$name}\"";
|
$select = "<select name=\"{$name}\"";
|
} else {
| } else {
|
$select = "<select name=\"{$name}\" multiple=\"multiple\""; if(!isset($options['size'])) { $options['size'] = count($option_list); }
|
$select = "<select name=\"{$name}\" multiple=\"multiple\""; if(!isset($options['size'])) { $options['size'] = count($option_list); }
|
}
| }
|
if(isset($options['class'])) { $select .= " class=\"{$options['class']}\""; } if(isset($options['id']))
|
if(isset($options['class'])) { $select .= " class=\"{$options['class']}\""; } if(isset($options['id']))
|
{
| {
|
$select .= " id=\"{$options['id']}\""; } if(isset($options['size']))
| $select .= " id=\"{$options['id']}\""; } if(isset($options['size']))
|
Zeile 413 | Zeile 422 |
---|
foreach($option_list as $value => $option) { $select_add = '';
|
foreach($option_list as $value => $option) { $select_add = '';
|
if(!empty($selected) && ((string)$value == (string)$selected || (is_array($selected) && in_array((string)$value, $selected))))
| if((!is_array($selected) || !empty($selected)) && ((is_array($selected) && in_array((string)$value, $selected)) || (!is_array($selected) && (string)$value === (string)$selected)))
|
{ $select_add = " selected=\"selected\""; }
| { $select_add = " selected=\"selected\""; }
|
Zeile 426 | Zeile 435 |
---|
/** * Generate a forum selection box. *
|
/** * Generate a forum selection box. *
|
* @param string The name of the selection box. * @param mixed Array/string of the selected items. * @param array Array of options (pid, main_option, multiple) * @param boolean Is this our first iteration of this function?
| * @param string $name The name of the selection box. * @param array|string $selected Array/string of the selected items. * @param array Array of options (pid, main_option, multiple, depth) * @param boolean|int $is_first Is this our first iteration of this function?
|
* @return string The built select box. */ function generate_forum_select($name, $selected, $options=array(), $is_first=1)
| * @return string The built select box. */ function generate_forum_select($name, $selected, $options=array(), $is_first=1)
|
Zeile 442 | Zeile 451 |
---|
}
if(!isset($options['depth']))
|
}
if(!isset($options['depth']))
|
{ $options['depth'] = 0;
| { $options['depth'] = 0;
|
}
$options['depth'] = (int)$options['depth'];
| }
$options['depth'] = (int)$options['depth'];
|
Zeile 465 | Zeile 474 |
---|
foreach($forum_cache as $fid => $forum) { $fselectcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
foreach($forum_cache as $fid => $forum) { $fselectcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
} }
if($options['main_option'] && $is_first)
| } }
if(isset($options['main_option']) && $is_first)
|
{ $select_add = ''; if($selected == -1)
| { $select_add = ''; if($selected == -1)
|
Zeile 480 | Zeile 489 |
---|
}
if(isset($fselectcache[$pid]))
|
}
if(isset($fselectcache[$pid]))
|
{
| {
|
foreach($fselectcache[$pid] as $main) { foreach($main as $forum)
| foreach($fselectcache[$pid] as $main) { foreach($main as $forum)
|
Zeile 492 | Zeile 501 |
---|
if(!empty($selected) && ($forum['fid'] == $selected || (is_array($selected) && in_array($forum['fid'], $selected)))) { $select_add = " selected=\"selected\"";
|
if(!empty($selected) && ($forum['fid'] == $selected || (is_array($selected) && in_array($forum['fid'], $selected)))) { $select_add = " selected=\"selected\"";
|
}
| }
|
$sep = ''; if(isset($options['depth']))
| $sep = ''; if(isset($options['depth']))
|
Zeile 504 | Zeile 513 |
---|
if($forum['active'] == 0) { $style = " style=\"font-style: italic;\"";
|
if($forum['active'] == 0) { $style = " style=\"font-style: italic;\"";
|
}
| }
|
$selectoptions .= "<option value=\"{$forum['fid']}\"{$style}{$select_add}>".$sep.htmlspecialchars_uni(strip_tags($forum['name']))."</option>\n";
| $selectoptions .= "<option value=\"{$forum['fid']}\"{$style}{$select_add}>".$sep.htmlspecialchars_uni(strip_tags($forum['name']))."</option>\n";
|
Zeile 539 | Zeile 548 |
---|
$select .= " id=\"{$options['id']}\""; } if(isset($options['size']))
|
$select .= " id=\"{$options['id']}\""; } if(isset($options['size']))
|
{
| {
|
$select .= " size=\"{$options['size']}\""; } $select .= ">\n".$selectoptions."</select>\n";
| $select .= " size=\"{$options['size']}\""; } $select .= ">\n".$selectoptions."</select>\n";
|
Zeile 550 | Zeile 559 |
---|
/** * Generate a group selection box.
|
/** * Generate a group selection box.
|
* * @param string The name of the selection box. * @param mixed Array/string of the selected items. * @param array Array of options (class, id, multiple) * @return string The built select box.
| * * @param string $name The name of the selection box. * @param array|string $selected Array/string of the selected items. * @param array $options Array of options (class, id, multiple, size) * @return string The built select box.
|
*/ function generate_group_select($name, $selected=array(), $options=array()) { global $cache;
|
*/ function generate_group_select($name, $selected=array(), $options=array()) { global $cache;
|
| $select = "<select name=\"{$name}\"";
if(isset($options['multiple'])) { $select .= " multiple=\"multiple\""; }
if(isset($options['class'])) { $select .= " class=\"{$options['class']}\""; }
if(isset($options['id'])) { $select .= " id=\"{$options['id']}\""; }
if(isset($options['size'])) { $select .= " size=\"{$options['size']}\""; }
$select .= ">\n";
$groups_cache = $cache->read('usergroups');
if(!is_array($selected)) { $selected = array($selected); }
foreach($groups_cache as $group) { $selected_add = "";
if(in_array($group['gid'], $selected)) { $selected_add = " selected=\"selected\""; }
$select .= "<option value=\"{$group['gid']}\"{$selected_add}>".htmlspecialchars_uni($group['title'])."</option>"; }
$select .= "</select>";
return $select; }
/** * Generate a prefix selection box. * * @param string $name The name of the selection box. * @param array|string $selected Array/string of the selected items. * @param array $options Array of options (class, id, multiple, size) * @return string The built select box. */ function generate_prefix_select($name, $selected=array(), $options=array()) { global $cache;
|
$select = "<select name=\"{$name}\"";
|
$select = "<select name=\"{$name}\"";
|
| |
if(isset($options['multiple'])) { $select .= " multiple=\"multiple\"";
|
if(isset($options['multiple'])) { $select .= " multiple=\"multiple\"";
|
}
| }
|
if(isset($options['class']))
|
if(isset($options['class']))
|
{
| {
|
$select .= " class=\"{$options['class']}\"";
|
$select .= " class=\"{$options['class']}\"";
|
}
| }
|
if(isset($options['id']))
|
if(isset($options['id']))
|
{
| {
|
$select .= " id=\"{$options['id']}\""; }
|
$select .= " id=\"{$options['id']}\""; }
|
| |
if(isset($options['size']))
|
if(isset($options['size']))
|
{
| {
|
$select .= " size=\"{$options['size']}\"";
|
$select .= " size=\"{$options['size']}\"";
|
}
$select .= ">\n";
$groups_cache = $cache->read('usergroups'); foreach($groups_cache as $group)
| } $select .= ">\n"; $prefix_cache = $cache->read('threadprefixes');
if(!is_array($selected)) { $selected = array($selected); }
foreach($prefix_cache as $prefix)
|
{ $selected_add = "";
|
{ $selected_add = "";
|
if(is_array($selected))
|
if(in_array($prefix['pid'], $selected))
|
{
|
{
|
if(in_array($group['gid'], $selected)) { $selected_add = " selected=\"selected\""; }
| $selected_add = " selected=\"selected\"";
|
}
|
}
|
$select .= "<option value=\"{$group['gid']}\"{$selected_add}>".htmlspecialchars_uni(strip_tags($group['title']))."</option>";
| $select .= "<option value=\"{$prefix['pid']}\"{$selected_add}>".htmlspecialchars_uni($prefix['prefix'])."</option>";
|
}
|
}
|
| |
$select .= "</select>";
|
$select .= "</select>";
|
| |
return $select; }
/** * Generate a submit button. *
|
return $select; }
/** * Generate a submit button. *
|
* @param string The value for the submit button. * @param array Array of options for the submit button (class, id, name, dsiabled, onclick)
| * @param string $value The value for the submit button. * @param array $options Array of options for the submit button (class, id, name, dsiabled, onclick)
|
* @return string The generated submit button. */ function generate_submit_button($value, $options=array())
| * @return string The generated submit button. */ function generate_submit_button($value, $options=array())
|
Zeile 620 | Zeile 685 |
---|
$input .= " class=\"submit_button ".$options['class']."\""; } else
|
$input .= " class=\"submit_button ".$options['class']."\""; } else
|
{
| {
|
$input .= " class=\"submit_button\"";
|
$input .= " class=\"submit_button\"";
|
}
| }
|
if(isset($options['id'])) { $input .= " id=\"".$options['id']."\"";
|
if(isset($options['id'])) { $input .= " id=\"".$options['id']."\"";
|
}
| }
|
if(isset($options['name'])) { $input .= " name=\"".$options['name']."\""; } if(isset($options['disabled']))
|
if(isset($options['name'])) { $input .= " name=\"".$options['name']."\""; } if(isset($options['disabled']))
|
{
| {
|
$input .= " disabled=\"disabled\"";
|
$input .= " disabled=\"disabled\"";
|
}
| }
|
if(isset($options['onclick'])) { $input .= " onclick=\"".str_replace('"', '\"', $options['onclick'])."\"";
|
if(isset($options['onclick'])) { $input .= " onclick=\"".str_replace('"', '\"', $options['onclick'])."\"";
|
} $input .= " />"; return $input; }
/**
| } $input .= " />"; return $input; }
/**
|
* Generate a reset button. *
|
* Generate a reset button. *
|
* @param string The value for the reset button. * @param array Array of options for the reset button (class, id, name)
| * @param string $value The value for the reset button. * @param array $options Array of options for the reset button (class, id, name)
|
* @return string The generated reset button. */ function generate_reset_button($value, $options=array())
| * @return string The generated reset button. */ function generate_reset_button($value, $options=array())
|
Zeile 657 | Zeile 722 |
---|
if(isset($options['class'])) { $input .= " class=\"submit_button ".$options['class']."\"";
|
if(isset($options['class'])) { $input .= " class=\"submit_button ".$options['class']."\"";
|
}
| }
|
else
|
else
|
{
| {
|
$input .= " class=\"submit_button\""; } if(isset($options['id']))
|
$input .= " class=\"submit_button\""; } if(isset($options['id']))
|
{
| {
|
$input .= " id=\"".$options['id']."\""; } if(isset($options['name'])) { $input .= " name=\"".$options['name']."\"";
|
$input .= " id=\"".$options['id']."\""; } if(isset($options['name'])) { $input .= " name=\"".$options['name']."\"";
|
}
| }
|
$input .= " />"; return $input; }
|
$input .= " />"; return $input; }
|
|
|
/** * Generate a yes/no radio button choice. *
|
/** * Generate a yes/no radio button choice. *
|
* @param string The name of the yes/no choice field. * @param string The value that should be checked. * @param boolean Using integers for the checkbox? * @param array Array of options for the yes checkbox (@see generate_radio_button) * @param array Array of options for the no checkbox (@see generate_radio_button)
| * @param string $name The name of the yes/no choice field. * @param string $value The value that should be checked. * @param boolean $int Using integers for the checkbox? * @param array $yes_options Array of options for the yes checkbox (@see generate_radio_button) * @param array $no_options Array of options for the no checkbox (@see generate_radio_button)
|
* @return string The generated yes/no radio button.
|
* @return string The generated yes/no radio button.
|
*/ function generate_yes_no_radio($name, $value=1, $int=true, $yes_options=array(), $no_options = array()) { global $lang;
| */ function generate_yes_no_radio($name, $value="1", $int=true, $yes_options=array(), $no_options = array()) { global $lang;
|
// Checked status if($value == "no" || $value === '0') {
| // Checked status if($value == "no" || $value === '0') {
|
Zeile 735 | Zeile 800 |
---|
/** * Generate an on/off radio button choice. *
|
/** * Generate an on/off radio button choice. *
|
* @param string The name of the on/off choice field. * @param string The value that should be checked. * @param boolean Using integers for the checkbox? * @param array Array of options for the on checkbox (@see generate_radio_button) * @param array Array of options for the off checkbox (@see generate_radio_button)
| * @param string $name The name of the on/off choice field. * @param int $value The value that should be checked. * @param boolean $int Using integers for the checkbox? * @param array $on_options Array of options for the on checkbox (@see generate_radio_button) * @param array $off_options Array of options for the off checkbox (@see generate_radio_button)
|
* @return string The generated on/off radio button. */ function generate_on_off_radio($name, $value=1, $int=true, $on_options=array(), $off_options = array())
| * @return string The generated on/off radio button. */ function generate_on_off_radio($name, $value=1, $int=true, $on_options=array(), $off_options = array())
|
Zeile 751 | Zeile 816 |
---|
{ $off_checked = 1; $on_checked = 0;
|
{ $off_checked = 1; $on_checked = 0;
|
} else
| } else
|
{ $on_checked = 1; $off_checked = 0;
| { $on_checked = 1; $off_checked = 0;
|
Zeile 762 | Zeile 827 |
---|
{ $on_value = 1; $off_value = 0;
|
{ $on_value = 1; $off_value = 0;
|
}
| }
|
else { $on_value = "on";
| else { $on_value = "on";
|
Zeile 771 | Zeile 836 |
---|
// Set the options straight if(!isset($on_options['class']))
|
// Set the options straight if(!isset($on_options['class']))
|
{
| {
|
$on_options['class'] = ''; }
| $on_options['class'] = ''; }
|
Zeile 790 | Zeile 855 |
---|
return $on." ".$off; }
|
return $on." ".$off; }
|
function generate_date_select($name, $day="",$month="",$year="")
| /** * @param string $name * @param int $day * @param int $month * @param int $year * * @return string */ function generate_date_select($name, $day=0,$month=0,$year=0)
|
{ global $lang;
| { global $lang;
|
Zeile 833 | Zeile 906 |
---|
$built = $this->generate_select_box($name.'_day', $days, (int)$day, array('id' => $name.'_day'))." "; $built .= $this->generate_select_box($name.'_month', $months, (int)$month, array('id' => $name.'_month'))." ";
|
$built = $this->generate_select_box($name.'_day', $days, (int)$day, array('id' => $name.'_day'))." "; $built .= $this->generate_select_box($name.'_month', $months, (int)$month, array('id' => $name.'_month'))." ";
|
$built .= $this->generate_text_box($name.'_year', (int)$year, array('id' => $name.'_year', 'style' => 'width: 100px;'));
| $built .= $this->generate_numeric_field($name.'_year', $year, array('id' => $name.'_year', 'style' => 'width: 100px;', 'min' => 0));
|
return $built; }
/** * Output a row of buttons in a wrapped container. *
|
return $built; }
/** * Output a row of buttons in a wrapped container. *
|
* @param array Array of the buttons (html) to output.
| * @param array $buttons Array of the buttons (html) to output.
|
* @return string The submit wrapper (optional) */ function output_submit_wrapper($buttons)
| * @return string The submit wrapper (optional) */ function output_submit_wrapper($buttons)
|
Zeile 888 | Zeile 961 |
---|
*/ class DefaultFormContainer {
|
*/ class DefaultFormContainer {
|
| /** @var Table */
|
private $_container;
|
private $_container;
|
| /** @var string */
|
public $_title;
/** * Initialise the new form container. *
|
public $_title;
/** * Initialise the new form container. *
|
* @param string The title of the forum container * @param string An additional class to apply if we have one.
| * @param string $title The title of the form container * @param string $extra_class An additional class to apply if we have one.
|
*/ function __construct($title='', $extra_class='') {
| */ function __construct($title='', $extra_class='') {
|
Zeile 907 | Zeile 982 |
---|
/** * Output a header row of the form container. *
|
/** * Output a header row of the form container. *
|
* @param string The header row label. * @param array Array of extra information for this header cell (class, style, colspan, width)
| * @param string $title The header row label. * @param array $extra Array of extra information for this header cell (class, style, colspan, width)
|
*/ function output_row_header($title, $extra=array()) {
| */ function output_row_header($title, $extra=array()) {
|
Zeile 918 | Zeile 993 |
---|
/** * Output a row of the form container. *
|
/** * Output a row of the form container. *
|
* @param string The title of the row. * @param string The description of the row/field. * @param string The HTML content to show in the row. * @param string The ID of the control this row should be a label for. * @param array Array of options for the row cell. * @param array Array of options for the row container.
| * @param string $title The title of the row. * @param string $description The description of the row/field. * @param string $content The HTML content to show in the row. * @param string $label_for The ID of the control this row should be a label for. * @param array $options Array of options for the row cell. * @param array $row_options Array of options for the row container.
|
*/ function output_row($title, $description="", $content="", $label_for="", $options=array(), $row_options=array()) {
| */ function output_row($title, $description="", $content="", $label_for="", $options=array(), $row_options=array()) {
|
Zeile 949 | Zeile 1024 |
---|
if($title) { $row = "<label{$for}>{$title}</label>";
|
if($title) { $row = "<label{$for}>{$title}</label>";
|
}
if(isset($options['id'])) { $options['id'] = " id=\"{$options['id']}\""; } else { $options['id'] = '';
| |
}
if($description != '')
| }
if($description != '')
|
Zeile 965 | Zeile 1031 |
---|
$row .= "\n<div class=\"description\">{$description}</div>\n"; }
|
$row .= "\n<div class=\"description\">{$description}</div>\n"; }
|
$row .= "<div class=\"form_row\"{$options['id']}>{$content}</div>\n";
| $row .= "<div class=\"form_row\">{$content}</div>\n";
|
$this->_container->construct_cell($row, $options);
| $this->_container->construct_cell($row, $options);
|
Zeile 978 | Zeile 1044 |
---|
/** * Output a row cell for a table based form row. *
|
/** * Output a row cell for a table based form row. *
|
* @param string The data to show in the cell. * @param array Array of options for the cell (optional).
| * @param string $data The data to show in the cell. * @param array $options Array of options for the cell (optional).
|
*/ function output_cell($data, $options=array()) {
| */ function output_cell($data, $options=array()) {
|
Zeile 989 | Zeile 1055 |
---|
/** * Build a row for the table based form row. *
|
/** * Build a row for the table based form row. *
|
* @param array Array of extra options for the cell (optional).
| * @param array $extra Array of extra options for the cell (optional).
|
*/ function construct_row($extra=array()) {
| */ function construct_row($extra=array()) {
|
Zeile 999 | Zeile 1065 |
---|
/** * return the cells of a row for the table based form row. *
|
/** * return the cells of a row for the table based form row. *
|
* @param string The id of the row. * @param boolean Whether or not to return or echo the resultant contents.
| * @param string $row_id The id of the row. * @param boolean $return Whether or not to return or echo the resultant contents.
|
* @return string The output of the row cells (optional). */ function output_row_cells($row_id, $return=false)
| * @return string The output of the row cells (optional). */ function output_row_cells($row_id, $return=false)
|
Zeile 1028 | Zeile 1094 |
---|
/** * Output the end of the form container row. *
|
/** * Output the end of the form container row. *
|
* @param boolean Whether or not to return or echo the resultant contents.
| * @param boolean $return Whether or not to return or echo the resultant contents.
|
* @return string The output of the form container (optional). */ function end($return=false)
| * @return string The output of the form container (optional). */ function end($return=false)
|