Adding "icon" attribute in function addButton using FormValidator

1.10.x
Julio Montoya 10 years ago
parent 1dced7680b
commit 0e4036eeed
  1. 2
      main/course_description/upload_file_form.class.php
  2. 2
      main/glossary/upload_file_form.class.php
  3. 9
      main/inc/lib/formvalidator/FormValidator.class.php
  4. 15
      main/inc/lib/pear/HTML/QuickForm/button.php
  5. 2
      main/link/link_form.class.php
  6. 2
      main/link/upload_file_form.class.php
  7. 4
      main/notebook/notebook_form.class.php
  8. 2
      main/notebook/upload_file_form.class.php

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

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

@ -59,7 +59,7 @@ class FormValidator extends HTML_QuickForm
$type = isset($item['type']) ? $item['type'] : 'text';
$label = isset($item['label']) ? $item['label'] : '';
if ($type == 'wysiwyg') {
$element = $result->add_html_editor($name, $label);
$element = $result->addHtmlEditor($name, $label);
} else {
$element = $result->addElement($type, $name, $label);
}
@ -290,11 +290,14 @@ EOT;
/**
* @param string $name
* @param string $label
* @param string $icon font-awesome
* For example plus is transformed to icon fa fa-plus
* @param array $attributes
*/
public function addButton($name, $label, $attributes = array())
public function addButton($name, $label, $icon = 'check', $attributes = array())
{
//$attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'btn btn-default';
$attributes['icon'] = $icon;
$this->addElement('button', $name, $label, $attributes);
}
@ -381,7 +384,7 @@ EOT;
* @param array $config (optional) Configuration settings for the online editor.
*
*/
public function add_html_editor($name, $label, $required = true, $fullPage = false, $config = null)
public function addHtmlEditor($name, $label, $required = true, $fullPage = false, $config = null)
{
$this->addElement('html_editor', $name, $label, 'rows="15" cols="80"', $config);
$this->applyFilter($name, 'trim');

@ -70,16 +70,15 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
} 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;
}
$icon = $this->_attributes['icon'];
$icon = '<i class="fa fa-'.$icon.'"></i> ';
return $this->_getTabs() . '<button' . $this->_getAttrString($this->_attributes) . ' />'.$icon.$value.'</button>';
return
$this->_getTabs() . '
<button' . $this->_getAttrString($this->_attributes) . ' />'.
$icon.$value.
'</button>';
}
}

@ -99,7 +99,7 @@ class LinkForm extends \FormValidator
//$help = '<span class="help-block">' . get_lang('AddTargetOfLinkOnHomepage') . '</span>';
//$this->add_label('', $help);
$this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$this->addButton('save', get_lang('Save'));
$this->setDefaults($defaults);
}

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

@ -76,9 +76,9 @@ class NotebookForm extends \FormValidator
} else {
$toolbar = array('ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student');
}
$this->add_html_editor('description', get_lang('NoteComment'), true, api_is_allowed_to_edit(), $toolbar);
$this->addHtmlEditor('description', get_lang('NoteComment'), true, api_is_allowed_to_edit(), $toolbar);
$this->addButton('save', get_lang('Save'), array('class' => 'btn save'));
$this->addButton('save', get_lang('Save'));
$this->setDefaults($defaults);
}

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

Loading…
Cancel
Save