Change function name.

1.10.x
Julio Montoya 11 years ago
parent 87561658e5
commit 9f335e143a
  1. 2
      main/admin/export_certificates.php
  2. 2
      main/attendance/attendance_controller.php
  3. 2
      main/course_description/course_description_form.class.php
  4. 2
      main/course_description/upload_file_form.class.php
  5. 2
      main/glossary/glossary_form.class.php
  6. 5
      main/glossary/upload_file_form.class.php
  7. 2
      main/gradebook/gradebook_display_certificate.php
  8. 58
      main/inc/lib/formvalidator/FormValidator.class.php
  9. 5
      main/inc/lib/pear/HTML/Common.php
  10. 108
      main/inc/lib/pear/HTML/QuickForm/advmultiselect.php
  11. 53
      main/inc/lib/pear/HTML/QuickForm/button.php
  12. 2
      main/inc/lib/pear/HTML/QuickForm/select.php
  13. 4
      main/link/link_form.class.php
  14. 4
      main/link/upload_file_form.class.php
  15. 2
      main/notebook/notebook_form.class.php
  16. 2
      main/notebook/upload_file_form.class.php

@ -23,7 +23,7 @@ foreach ($courses as $course) {
} }
$form->addElement('select', 'course', get_lang('Course'), $options); $form->addElement('select', 'course', get_lang('Course'), $options);
$form->addElement('file', 'file', get_lang('File')); $form->addElement('file', 'file', get_lang('File'));
$form->add_button('submit', get_lang('Submit')); $form->addButton('submit', get_lang('Submit'));
$form->display(); $form->display();
if ($form->validate()) { if ($form->validate()) {

@ -565,7 +565,7 @@ class AttendanceController
) . '&action=calendar_logins' ) . '&action=calendar_logins'
); );
$form->addDateRangePicker('range', get_lang('Range')); $form->addDateRangePicker('range', get_lang('Range'));
$form->add_button('submit', get_lang('submit')); $form->addButton('submit', get_lang('submit'));
if ($form->validate()) { if ($form->validate()) {
$values = $form->getSubmitValues(); $values = $form->getSubmitValues();

@ -77,7 +77,7 @@ class CourseDescriptionForm extends \FormValidator
$this->add_textfield('title', get_lang('Title'), true, array('size' => 'width: 350px;')); $this->add_textfield('title', get_lang('Title'), true, array('size' => 'width: 350px;'));
$this->applyFilter('title', 'html_filter'); $this->applyFilter('title', 'html_filter');
$this->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200')); $this->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
$this->add_button('save', get_lang('Save'), 'class="save"'); $this->addButton('save', get_lang('Save'), 'class="save"');
$this->setDefaults($defaults); $this->setDefaults($defaults);
} }

@ -40,7 +40,7 @@ class UploadFileForm extends \FormValidator
$this->addRule('file', get_lang('ThisFieldIsRequired'), 'required'); $this->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
//$this->add_checkbox('replace', '', get_lang('ReplaceExistingEntries')); //$this->add_checkbox('replace', '', get_lang('ReplaceExistingEntries'));
$this->add_button('save', get_lang('Save'), array('class' => 'btn save')); $this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
// $label = get_lang('CSVMustLookLike'); // $label = get_lang('CSVMustLookLike');
// $label = "<h4>$label</h4>"; // $label = "<h4>$label</h4>";

@ -78,7 +78,7 @@ class GlossaryForm extends \FormValidator
$this->add_textfield('name', get_lang('TermName'), $required = true, array('class' => 'span3')); $this->add_textfield('name', get_lang('TermName'), $required = true, array('class' => 'span3'));
$this->add_html_editor('description', get_lang('TermDefinition'), true, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300')); $this->add_html_editor('description', get_lang('TermDefinition'), true, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300'));
$this->add_button('save', get_lang('Save'), array('class' => 'btn save')); $this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$this->setDefaults($defaults); $this->setDefaults($defaults);
} }

@ -48,9 +48,8 @@ class UploadFileForm extends \FormValidator
$label = get_lang('ImportCSVFileLocation'); $label = get_lang('ImportCSVFileLocation');
$this->add_file('file', $label); $this->add_file('file', $label);
$this->addRule('file', get_lang('ThisFieldIsRequired'), 'required'); $this->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
$this->add_checkbox('deleteall', '', get_lang('DeleteAllGlossaryTerms')); $this->addCheckBox('deleteall', '', get_lang('DeleteAllGlossaryTerms'));
$this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$this->add_button('save', get_lang('Save'), array('class' => 'btn save'));
$label = get_lang('CSVMustLookLike'); $label = get_lang('CSVMustLookLike');
$label = "$label"; $label = "$label";

@ -149,7 +149,7 @@ if ($filter) {
api_get_self().'?'.api_get_cidreq().'&cat_id='.$cat_id api_get_self().'?'.api_get_cidreq().'&cat_id='.$cat_id
); );
$form->addElement('select', 'filter', get_lang('OfficialCode'), $options); $form->addElement('select', 'filter', get_lang('OfficialCode'), $options);
$form->add_button('submit', get_lang('Submit')); $form->addButton('submit', get_lang('Submit'));
$filterForm = '<br />'.$form->return_form(); $filterForm = '<br />'.$form->return_form();
if ($form->validate()) { if ($form->validate()) {

@ -272,27 +272,48 @@ EOT;
* @param string $name * @param string $name
* @param string $value * @param string $value
*/ */
function add_hidden($name, $value) public function add_hidden($name, $value)
{ {
$this->addElement('hidden', $name, $value); $this->addElement('hidden', $name, $value);
} }
/**
* @param string $name
* @param string $label
* @param array $attributes
*/
public function add_textarea($name, $label, $attributes = array()) public function add_textarea($name, $label, $attributes = array())
{ {
$this->addElement('textarea', $name, $label, $attributes); $this->addElement('textarea', $name, $label, $attributes);
} }
public function add_button($name, $label, $attributes = array()) /**
* @param string $name
* @param string $label
* @param array $attributes
*/
public function addButton($name, $label, $attributes = array())
{ {
$this->addElement('button', $name, $label, $attributes); $this->addElement('button', $name, $label, $attributes);
} }
public function add_checkbox($name, $label, $trailer = '', $attributes = array()) /**
* @param string $name
* @param string $label
* @param string $trailer
* @param array $attributes
*/
public function addCheckBox($name, $label, $trailer = '', $attributes = array())
{ {
$this->addElement('checkbox', $name, $label, $trailer, $attributes); $this->addElement('checkbox', $name, $label, $trailer, $attributes);
} }
public function add_radio($name, $label, $options = '') /**
* @param string $name
* @param string $label
* @param array $options
*/
public function addRadio($name, $label, $options = array())
{ {
$group = array(); $group = array();
foreach ($options as $key => $value) { foreach ($options as $key => $value) {
@ -301,26 +322,47 @@ EOT;
$this->addGroup($group, $name, $label); $this->addGroup($group, $name, $label);
} }
/**
* @param string $name
* @param string $label
* @param string $options
* @param array $attributes
*/
public function add_select($name, $label, $options = '', $attributes = array()) public function add_select($name, $label, $options = '', $attributes = array())
{ {
$this->addElement('select', $name, $label, $options, $attributes); $this->addElement('select', $name, $label, $options, $attributes);
} }
/**
* @param string $label
* @param string $text
*/
public function add_label($label, $text) public function add_label($label, $text)
{ {
$this->addElement('label', $label, $text); $this->addElement('label', $label, $text);
} }
/**
* @param string $text
*/
public function add_header($text) public function add_header($text)
{ {
$this->addElement('header', $text); $this->addElement('header', $text);
} }
/**
* @param string $name
* @param string $label
* @param array $attributes
*/
public function add_file($name, $label, $attributes = array()) public function add_file($name, $label, $attributes = array())
{ {
$this->addElement('file', $name, $label, $attributes); $this->addElement('file', $name, $label, $attributes);
} }
/**
* @param string $snippet
*/
public function add_html($snippet) public function add_html($snippet)
{ {
$this->addElement('html', $snippet); $this->addElement('html', $snippet);
@ -338,7 +380,7 @@ EOT;
* @param array $config (optional) Configuration settings for the online editor. * @param array $config (optional) Configuration settings for the online editor.
* *
*/ */
public function add_html_editor($name, $label, $required = true, $full_page = false, $config = null) public function add_html_editor($name, $label, $required = true, $fullPage = false, $config = null)
{ {
$this->addElement('html_editor', $name, $label, 'rows="15" cols="80"', $config); $this->addElement('html_editor', $name, $label, 'rows="15" cols="80"', $config);
$this->applyFilter($name, 'trim'); $this->applyFilter($name, 'trim');
@ -346,9 +388,13 @@ EOT;
$this->addRule($name, get_lang('ThisFieldIsRequired'), 'required'); $this->addRule($name, get_lang('ThisFieldIsRequired'), 'required');
} }
/** @var HTML_QuickForm_html_editor $element */ /** @var HtmlEditor $element */
$element = $this->getElement($name); $element = $this->getElement($name);
if ($fullPage) {
$config['FullPage'] = true;
}
if ($element->editor) { if ($element->editor) {
$element->editor->processConfig($config); $element->editor->processConfig($config);
} }

@ -142,9 +142,8 @@ class HTML_Common
$charset = HTML_Common::charset(); $charset = HTML_Common::charset();
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
// Modified by Ivan Tcholakov, 16-MAR-2010 // Modified by Ivan Tcholakov, 16-MAR-2010
//$strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"'; $value = @htmlspecialchars($value, ENT_COMPAT, $charset);
$strAttr .= ' ' . $key . '="' . @htmlspecialchars($value, ENT_COMPAT, $charset) . '"'; $strAttr .= ' ' . $key . '="' . $value. '"';
//
} }
} }
return $strAttr; return $strAttr;

@ -216,6 +216,8 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
*/ */
var $_attributesHidden; var $_attributesHidden;
public $selectAllCheckBox = false;
/** /**
* Default Element template string * Default Element template string
* *
@ -270,14 +272,19 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
* @return void * @return void
* @since version 0.4.0 (2005-06-25) * @since version 0.4.0 (2005-06-25)
*/ */
function HTML_QuickForm_advmultiselect($elementName = null, $elementLabel = null, public function HTML_QuickForm_advmultiselect(
$options = null, $attributes = null, $elementName = null,
$sort = null) $elementLabel = null,
{ $options = null,
$attributes = null,
$sort = null
) {
$opts = $options; $opts = $options;
$options = null; // prevent to use the default select element load options $options = null; // prevent to use the default select element load options
$this->HTML_QuickForm_select($elementName, $elementLabel,
$options, $attributes); $this->HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes);
$this->selectAllCheckBox = isset($attributes['select_all_checkbox']) ? $attributes['select_all_checkbox'] : false;
// allow to load options at once and take care of fancy attributes // allow to load options at once and take care of fancy attributes
$this->load($opts); $this->load($opts);
@ -291,13 +298,12 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
} }
if (is_null($this->getAttribute('style'))) { if (is_null($this->getAttribute('style'))) {
// default width of each select box // default width of each select box
$this->updateAttributes(array('style' => 'width:100px;')); $this->updateAttributes(array('style' => 'min-width:180px;'));
} }
$this->_tableAttributes = $this->getAttribute('class'); $this->_tableAttributes = $this->getAttribute('class');
if (is_null($this->_tableAttributes)) { if (is_null($this->_tableAttributes)) {
// default table layout // default table layout
$attr = array('border' => '0', $attr = array('border' => '0', 'cellpadding' => '10', 'cellspacing' => '0');
'cellpadding' => '10', 'cellspacing' => '0');
} else { } else {
$attr = array('class' => $this->_tableAttributes); $attr = array('class' => $this->_tableAttributes);
$this->_removeAttr('class', $this->_attributes); $this->_removeAttr('class', $this->_attributes);
@ -400,13 +406,16 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
switch ($button) { switch ($button) {
case 'add': case 'add':
if (is_null($attributes)) { if (is_null($attributes)) {
$this->_addButtonAttributes $this->_addButtonAttributes = array(
= array('name' => 'add', 'name' => 'add',
'value' => ' ', 'value' => ' ',
'type' => 'button'); 'type' => 'button'
);
} else { } else {
$this->_updateAttrArray($this->_addButtonAttributes, $this->_updateAttrArray(
$this->_parseAttributes($attributes)); $this->_addButtonAttributes,
$this->_parseAttributes($attributes)
);
} }
break; break;
case 'remove': case 'remove':
@ -586,7 +595,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
* @return string * @return string
* @since version 0.4.0 (2005-06-25) * @since version 0.4.0 (2005-06-25)
*/ */
function toHtml() public function toHtml()
{ {
if ($this->_flagFrozen) { if ($this->_flagFrozen) {
return $this->getFrozenHtml(); return $this->getFrozenHtml();
@ -610,7 +619,6 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
$strHtmlSelected = $tab . '<div id="qfams_'.$id.'">' . PHP_EOL; $strHtmlSelected = $tab . '<div id="qfams_'.$id.'">' . PHP_EOL;
$unselected_count = count($this->_options); $unselected_count = count($this->_options);
$checkbox_id_suffix = 0; $checkbox_id_suffix = 0;
foreach ($this->_options as $option) { foreach ($this->_options as $option) {
@ -654,16 +662,13 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
// build the select all button with all its attributes // build the select all button with all its attributes
$jsName = $this->_jsPrefix . $this->_jsPostfix; $jsName = $this->_jsPrefix . $this->_jsPostfix;
$attributes = array('onclick' => $jsName . $attributes = array('onclick' => $jsName ."('". $selectId ."', 1);");
"('". $selectId ."', 1);"); $this->_allButtonAttributes = array_merge($this->_allButtonAttributes, $attributes);
$this->_allButtonAttributes
= array_merge($this->_allButtonAttributes, $attributes);
$attrStrAll = $this->_getAttrString($this->_allButtonAttributes); $attrStrAll = $this->_getAttrString($this->_allButtonAttributes);
$strHtmlAll = "<input$attrStrAll />". PHP_EOL; $strHtmlAll = "<input$attrStrAll />". PHP_EOL;
// build the select none button with all its attributes // build the select none button with all its attributes
$attributes = array('onclick' => $jsName . $attributes = array('onclick' => $jsName ."('". $selectId ."', 0);");
"('". $selectId ."', 0);");
$this->_noneButtonAttributes $this->_noneButtonAttributes
= array_merge($this->_noneButtonAttributes, $attributes); = array_merge($this->_noneButtonAttributes, $attributes);
$attrStrNone = $this->_getAttrString($this->_noneButtonAttributes); $attrStrNone = $this->_getAttrString($this->_noneButtonAttributes);
@ -672,9 +677,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
// build the toggle selection button with all its attributes // build the toggle selection button with all its attributes
$attributes = array('onclick' => $jsName . $attributes = array('onclick' => $jsName .
"('". $selectId ."', 2);"); "('". $selectId ."', 2);");
$this->_toggleButtonAttributes $this->_toggleButtonAttributes = array_merge($this->_toggleButtonAttributes, $attributes);
= array_merge($this->_toggleButtonAttributes,
$attributes);
$attrStrToggle = $this->_getAttrString($this->_toggleButtonAttributes); $attrStrToggle = $this->_getAttrString($this->_toggleButtonAttributes);
$strHtmlToggle = "<input$attrStrToggle />". PHP_EOL; $strHtmlToggle = "<input$attrStrToggle />". PHP_EOL;
@ -802,13 +805,22 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
= array_merge($this->_attributes, $this->_attributesSelected); = array_merge($this->_attributes, $this->_attributesSelected);
$attrSelected = $this->_getAttrString($this->_attributesSelected); $attrSelected = $this->_getAttrString($this->_attributesSelected);
} }
$strHtmlSelected = "<select$attrSelected>". PHP_EOL; $strHtmlSelected = "<select$attrSelected>";
if ($selected_count > 0) { if ($selected_count > 0) {
foreach ($arrHtmlSelected as $data) { foreach ($arrHtmlSelected as $data) {
$attribute = null;
if (isset($data['attr'])) {
$attribute = $this->_getAttrString($data['attr']);
}
$text = null;
if (isset($data['text'])) {
$text = $data['text'];
}
$strHtmlSelected $strHtmlSelected
.= $tabs . $tab .= $tabs . $tab
. '<option' . $this->_getAttrString($data['attr']) . '>' . '<option' . $attribute. '>'
. $data['text'] . '</option>' . PHP_EOL; . $text . '</option>';
} }
} else { } else {
$strHtmlSelected .= '<option value="">&nbsp;</option>'; $strHtmlSelected .= '<option value="">&nbsp;</option>';
@ -819,10 +831,18 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
$strHtmlHidden = "<select$attrHidden>". PHP_EOL; $strHtmlHidden = "<select$attrHidden>". PHP_EOL;
if (count($arrHtmlHidden) > 0) { if (count($arrHtmlHidden) > 0) {
foreach ($arrHtmlHidden as $data) { foreach ($arrHtmlHidden as $data) {
$attribute = null;
if (isset($data['attr'])) {
$attribute = $this->_getAttrString($data['attr']);
}
$text = null;
if (isset($data['text'])) {
$text = $data['text'];
}
$strHtmlHidden $strHtmlHidden
.= $tabs . $tab .= $tabs . $tab
. '<option' . $this->_getAttrString($data['attr']) . '>' . '<option' . $attribute . '>'
. $data['text'] . '</option>' . PHP_EOL; . $text . '</option>' . PHP_EOL;
} }
} }
$strHtmlHidden .= '</select>'; $strHtmlHidden .= '</select>';
@ -838,7 +858,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
$this->_removeButtonAttributes $this->_removeButtonAttributes
= array_merge($this->_removeButtonAttributes, $attributes); = array_merge($this->_removeButtonAttributes, $attributes);
$attrStrRemove = $this->_getAttrString($this->_removeButtonAttributes); $attrStrRemove = $this->_getAttrString($this->_removeButtonAttributes);
$strHtmlRemove = "<input$attrStrRemove />". PHP_EOL; $strHtmlRemove = "<button $attrStrRemove /> <i class='fa fa-arrow-left'></i></button>";
// build the add button with all its attributes // build the add button with all its attributes
$attributes $attributes
@ -848,10 +868,9 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
"this.form.elements['" . $selectNameTo . "'], " . "this.form.elements['" . $selectNameTo . "'], " .
"this.form.elements['" . $selectName . "'], " . "this.form.elements['" . $selectName . "'], " .
"'add', '{$this->_sort}'); return false;"); "'add', '{$this->_sort}'); return false;");
$this->_addButtonAttributes $this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes);
= array_merge($this->_addButtonAttributes, $attributes);
$attrStrAdd = $this->_getAttrString($this->_addButtonAttributes); $attrStrAdd = $this->_getAttrString($this->_addButtonAttributes);
$strHtmlAdd = "<input$attrStrAdd />". PHP_EOL; $strHtmlAdd = "<button $attrStrAdd /> <i class='fa fa-arrow-right'></i></button><br /><br />";
// build the select all button with all its attributes // build the select all button with all its attributes
$attributes $attributes
@ -861,8 +880,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
"this.form.elements['" . $selectNameTo . "'], " . "this.form.elements['" . $selectNameTo . "'], " .
"this.form.elements['" . $selectName . "'], " . "this.form.elements['" . $selectName . "'], " .
"'all', '{$this->_sort}'); return false;"); "'all', '{$this->_sort}'); return false;");
$this->_allButtonAttributes $this->_allButtonAttributes = array_merge($this->_allButtonAttributes, $attributes);
= array_merge($this->_allButtonAttributes, $attributes);
$attrStrAll = $this->_getAttrString($this->_allButtonAttributes); $attrStrAll = $this->_getAttrString($this->_allButtonAttributes);
$strHtmlAll = "<input$attrStrAll />". PHP_EOL; $strHtmlAll = "<input$attrStrAll />". PHP_EOL;
@ -990,6 +1008,14 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
$strHtmlMoveTop, $strHtmlMoveBottom $strHtmlMoveTop, $strHtmlMoveBottom
); );
if ($this->selectAllCheckBox) {
$strHtml .= '
<label class="checkbox" >'.get_lang('SelectAll').'
<input type="checkbox" class="advmultiselect_checkbox" id="'.$selectId.'_select_all'.'">
</label>
';
}
$strHtml = str_replace($placeHolders, $htmlElements, $strHtml); $strHtml = str_replace($placeHolders, $htmlElements, $strHtml);
$comment = $this->getComment(); $comment = $this->getComment();
@ -998,6 +1024,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
$strHtml = $tabs . '<!-- ' . $comment . " //-->" . PHP_EOL . $strHtml; $strHtml = $tabs . '<!-- ' . $comment . " //-->" . PHP_EOL . $strHtml;
} }
return $strHtml; return $strHtml;
} }
@ -1013,16 +1040,14 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
*/ */
function getElementJs($raw = true, $min = true) function getElementJs($raw = true, $min = true)
{ {
$js = '@data_dir@' . DIRECTORY_SEPARATOR
. '@package_name@' . DIRECTORY_SEPARATOR;
$js = api_get_path(LIBRARY_PATH).'javascript'.DIRECTORY_SEPARATOR.'pear'.DIRECTORY_SEPARATOR; $js = api_get_path(LIBRARY_PATH).'javascript'.DIRECTORY_SEPARATOR.'pear'.DIRECTORY_SEPARATOR;
if ($min) { /*if ($min) {
$js .= 'qfamsHandler-min.js'; $js .= 'qfamsHandler-min.js';
} else { } else {
$js .= 'qfamsHandler.js'; $js .= 'qfamsHandler.js';
} }*/
$js .= 'qfamsHandler.js';
if (file_exists($js)) { if (file_exists($js)) {
$js = file_get_contents($js); $js = file_get_contents($js);
@ -1038,6 +1063,7 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
. PHP_EOL . '</script>' . PHP_EOL . '</script>'
. PHP_EOL; . PHP_EOL;
} }
return $js; return $js;
} }

@ -34,8 +34,6 @@
*/ */
class HTML_QuickForm_button extends HTML_QuickForm_input class HTML_QuickForm_button extends HTML_QuickForm_input
{ {
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -47,16 +45,43 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
* @access public * @access public
* @return void * @return void
*/ */
function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null) public function HTML_QuickForm_button(
{ $elementName = null,
HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); $value = null,
$attributes = null
) {
HTML_QuickForm_input::HTML_QuickForm_input(
$elementName,
null,
$attributes
);
$this->_persistantFreeze = false; $this->_persistantFreeze = false;
$this->setValue($value); $this->setValue($value);
$this->setType('button'); $this->setType('submit');
} //end constructor }
/**
* @return string
*/
public function toHtml()
{
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
$value = $this->_attributes['value'];
unset($this->_attributes['value']);
$icon = null;
//$class = isset($this->_attributes['class']) ? $this->_attributes['class'] : 'btn btn-large';
switch ($this->_attributes['name']) {
case 'save':
case 'submit':
$icon = '<i class="fa fa-check"></i> ';
break;
}
// }}} return $this->_getTabs() . '<button' . $this->_getAttrString($this->_attributes) . ' />'.$icon.$value.'</button>';
// {{{ freeze() }
}
/** /**
* Freeze the element so that only its value is returned * Freeze the element so that only its value is returned
@ -64,12 +89,8 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
* @access public * @access public
* @return void * @return void
*/ */
function freeze() public function freeze()
{ {
return false; return false;
} //end func freeze }
}
// }}}
} //end class HTML_QuickForm_button
?>

@ -111,7 +111,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
function setSelected($values) function setSelected($values)
{ {
if (is_string($values) && $this->getMultiple()) { if (is_string($values) && $this->getMultiple()) {
$values = split("[ ]?,[ ]?", $values); $values = explode("[ ]?,[ ]?", $values);
} }
if (is_array($values)) { if (is_array($values)) {
$this->_values = array_values($values); $this->_values = array_values($values);

@ -73,7 +73,7 @@ class LinkForm extends \FormValidator
$this->add_textarea('description', get_lang('Description'), array('class' => 'span3')); $this->add_textarea('description', get_lang('Description'), array('class' => 'span3'));
$this->add_checkbox('on_homepage', '', get_lang('OnHomepage')); $this->addCheckBox('on_homepage', '', get_lang('OnHomepage'));
$id = $link->id; $id = $link->id;
if ($id) { if ($id) {
@ -100,7 +100,7 @@ class LinkForm extends \FormValidator
//$help = '<span class="help-block">' . get_lang('AddTargetOfLinkOnHomepage') . '</span>'; //$help = '<span class="help-block">' . get_lang('AddTargetOfLinkOnHomepage') . '</span>';
//$this->add_label('', $help); //$this->add_label('', $help);
$this->add_button('save', get_lang('Save'), array('class' => 'btn save')); $this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$this->setDefaults($defaults); $this->setDefaults($defaults);
} }

@ -38,9 +38,9 @@ class UploadFileForm extends \FormValidator
$label = get_lang('File'); $label = get_lang('File');
$this->add_file('file', $label); $this->add_file('file', $label);
$this->addRule('file', get_lang('ThisFieldIsRequired'), 'required'); $this->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
//$this->add_checkbox('replace', '', get_lang('ReplaceExistingEntries')); //$this->addCheckBox('replace', '', get_lang('ReplaceExistingEntries'));
$this->add_button('save', get_lang('Save'), array('class' => 'btn save')); $this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$label = get_lang('CSVMustLookLike'); $label = get_lang('CSVMustLookLike');
$label = "<h4>$label</h4>"; $label = "<h4>$label</h4>";

@ -78,7 +78,7 @@ class NotebookForm extends \FormValidator
} }
$this->add_html_editor('description', get_lang('NoteComment'), true, api_is_allowed_to_edit(), $toolbar); $this->add_html_editor('description', get_lang('NoteComment'), true, api_is_allowed_to_edit(), $toolbar);
$this->add_button('save', get_lang('Save'), array('class' => 'btn save')); $this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$this->setDefaults($defaults); $this->setDefaults($defaults);
} }

@ -42,7 +42,7 @@ class UploadFileForm extends \FormValidator
$this->add_file('file', $label); $this->add_file('file', $label);
$this->addRule('file', get_lang('ThisFieldIsRequired'), 'required'); $this->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
$this->add_button('save', get_lang('Save'), array('class' => 'btn save')); $this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$label = get_lang('CSVMustLookLike'); $label = get_lang('CSVMustLookLike');
$label = "$label"; $label = "$label";

Loading…
Cancel
Save