UI improvements, adding addButtonCreate, addButtonUpdate, etc

To improve UI consistency.
1.10.x
Julio Montoya 11 years ago
parent f3be86f959
commit b0068c8f16
  1. 2
      main/admin/archive_cleanup.php
  2. 4
      main/admin/course_add.php
  3. 4
      main/admin/session_add.php
  4. 7
      main/admin/session_edit.php
  5. 5
      main/admin/user_add.php
  6. 1
      main/admin/user_edit.php
  7. 4
      main/admin/user_list.php
  8. 4
      main/cron/import_csv.php
  9. 2
      main/document/document.php
  10. 2
      main/group/member_settings.php
  11. 1
      main/inc/lib/formvalidator/Element/DatePicker.php
  12. 2
      main/inc/lib/formvalidator/Element/DateRangePicker.php
  13. 64
      main/inc/lib/formvalidator/FormValidator.class.php
  14. 1
      main/inc/lib/pear/HTML/QuickForm/password.php
  15. 6
      main/inc/lib/pear/HTML/QuickForm/text.php
  16. 3
      main/inc/lib/pear/HTML/QuickForm/textarea.php
  17. 3
      main/newscorm/lp_add.php
  18. 4
      main/newscorm/lp_add_item.php
  19. 2
      main/user/subscribe_user.php

@ -22,7 +22,7 @@ api_protect_admin_script(true);
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$form = new FormValidator('archive_cleanup_form');
$form->addElement('style_submit_button','proceed', get_lang('ArchiveDirCleanupProceedButton'),'class="save"');
$form->addButton('proceed', get_lang('ArchiveDirCleanupProceedButton'));
$message = null;

@ -5,8 +5,6 @@
* @package chamilo.admin
*/
/* INITIALIZATION SECTION */
// Language files that need to be included.
$language_file = array('admin', 'create_course');
@ -126,7 +124,7 @@ $(function() {
</script>';
$form->add_progress_bar();
$form->addElement('style_submit_button', 'submit', get_lang('CreateCourse'), 'class="add"');
$form->addButtonCreate(get_lang('CreateCourse'));
// Set some default values.
$values['course_language'] = api_get_setting('platformLanguage');

@ -364,9 +364,7 @@ $(function() {
});
</script>';
$form->addElement('button', 'submit', get_lang('NextStep'), array(
'class' => 'save'
));
$form->addButtonNext(get_lang('NextStep'));
$formDefaults = array(
'nb_days_acess_before' => $nb_days_acess_before,

@ -4,9 +4,6 @@
* Sessions edition script
* @package chamilo.admin
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file ='admin';
@ -253,9 +250,7 @@ $(function() {
});
</script>';
$form->addElement('button', 'submit', get_lang('ModifyThisSession'), array(
'class' => 'save'
));
$form->addButtonUpdate(get_lang('ModifyThisSession'));
$formDefaults = array(
'id_coach' => $infos['id_coach'],

@ -274,8 +274,9 @@ $defaults = array_merge($defaults, $extra_data);
$form->setDefaults($defaults);
// Submit button
$html_results_enabled[] = $form-> createElement ('style_submit_button', 'submit_plus', get_lang('Add').'+', 'class="add"');
$html_results_enabled[] = $form-> createElement ('style_submit_button', 'submit', get_lang('Add'), 'class="add"');
$html_results_enabled[] = $form->createElement('button', 'submit', get_lang('Add'), 'plus', 'primary');
$html_results_enabled[] = $form->createElement('button', 'submit_plus', get_lang('Add').'+');
$form->addGroup($html_results_enabled);
// Validate form

@ -295,6 +295,7 @@ $(document).ready(function(){
// Submit button
$form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"');
// Set default values
$user_data['reset_password'] = 0;
$expiration_date = $user_data['expiration_date'];

@ -801,8 +801,8 @@ if (!empty($action)) {
$form = new FormValidator('search_simple', 'get', '', '', array('class' => 'form-search'), false);
$renderer = & $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addElement('text','keyword', get_lang('keyword'), 'size="25"');
$form->addElement('style_submit_button', 'submit', get_lang('Search'),'class="btn"');
$form->addElement('text','keyword', get_lang('keyword'));
$form->addButtonSearch(get_lang('Search'));
$form->addElement(
'static',
'search_advanced_link',

@ -941,9 +941,9 @@ class ImportCsv
$addTeacherToSession = isset($courseInfo['add_teachers_to_sessions_courses']) && !empty($courseInfo['add_teachers_to_sessions_courses']) ? true : false;
if ($addTeacherToSession) {
CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], false, true, false);
CourseManager::updateTeachers($courseInfo['real_id'], $row['teachers'], false, true, false);
} else {
CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], false, false);
CourseManager::updateTeachers($courseInfo['real_id'], $row['teachers'], false, false);
}
if ($result) {

@ -1506,7 +1506,7 @@ if (!$is_certificate_mode) {
$form->addElement('hidden', 'cidReq', api_get_course_id());
$form->addElement('hidden', 'id_session', api_get_session_id());
$form->addElement('hidden', 'gidReq', $groupId);
$form->addElement('style_submit_button', 'submit', get_lang('Search'), 'class="search"');
$form->addButtonSearch(get_lang('Search'));
$actions .= $form->return_form();
$actions .= '</span>';
}

@ -167,6 +167,7 @@ if (!empty($group_member_list)) {
$selected_users[] = $user['user_id'];
}
}
$group_members_element = $form->addElement(
'advmultiselect',
'group_members',
@ -209,6 +210,7 @@ switch ($action) {
}
$defaults = $current_group;
$defaults['group_members'] = $selected_users;
$action = isset($_GET['action']) ? $_GET['action'] : '';
$defaults['action'] = $action;

@ -18,6 +18,7 @@ class DatePicker extends HTML_QuickForm_text
if (!isset($attributes['id'])) {
$attributes['id'] = $elementName;
}
//$attributes['class'] = '';
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
$this->_appendName = true;

@ -14,7 +14,7 @@ class DateRangePicker extends HTML_QuickForm_text
if (!isset($attributes['id'])) {
$attributes['id'] = $elementName;
}
$attributes['class'] = 'span3';
$attributes['class'] = 'form-control';
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
$this->_appendName = true;
$this->_type = 'date_range_picker';

@ -214,9 +214,69 @@ EOT;
*
* @return HTML_QuickForm_button
*/
public function addButton($name, $label, $icon = 'check', $style = 'default', $size = 'default', $class = 'btn', $attributes = array())
public function addButton(
$name,
$label,
$icon = 'check',
$style = 'default',
$size = 'default',
$class = 'btn',
$attributes = array()
) {
return $this->addElement(
'button',
$name,
$label,
$icon,
$style,
$size,
$class,
$attributes
);
}
/**
* @param string $label
*/
public function addButtonCreate($label)
{
$this->addButton('submit', $label, 'plus', 'primary');
}
/**
* Shortcut to create/add button
* @param string $label
*/
public function addButtonUpdate($label)
{
return $this->addButton('submit', $label, 'pencil', 'primary');
}
/**
* Shortcut to delete button
* @param string $label
*/
public function addButtonDelete($label)
{
return $this->addButton('submit', $label, 'trash', 'danger');
}
/**
* Shortcut to search button
* @param string $label
*/
public function addButtonSearch($label)
{
return $this->addButton('submit', $label, 'search');
}
/**
* Shortcut to update button
* @param string $label
*/
public function addButtonNext($label)
{
return $this->addElement('button', $name, $label, $icon, $style, $size, $class, $attributes);
return $this->addButton('submit', $label, 'arrow-right', 'primary');
}
/**

@ -50,6 +50,7 @@ class HTML_QuickForm_password extends HTML_QuickForm_input
*/
function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
{
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'form-control';
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
$this->setType('password');
} //end constructor

@ -48,9 +48,11 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
public function HTML_QuickForm_text(
$elementName = null,
$elementLabel = null,
$attributes = null
$attributes = array()
) {
$attributes['class'] = 'form-control';
if (is_array($attributes)) {
$attributes['class'] = 'form-control';
}
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;

@ -57,8 +57,9 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
* @access public
* @return void
*/
function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
public function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
{
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'form-control';
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'textarea';

@ -149,8 +149,7 @@ $defaults['publicated_on'] = date('Y-m-d 08:00:00');
$defaults['expired_on'] = date('Y-m-d 08:00:00',time()+86400);
$form->setDefaults($defaults);
$form->addElement('style_submit_button', 'Submit',get_lang('CreateLearningPath'),'class="save"');
$form->addButtonCreate(get_lang('CreateLearningPath'));
$form->display();
// Footer

@ -179,7 +179,7 @@ $(document).ready(function() {
echo $learnPath->build_action_menu();
echo '<div class="row-fluid" style="overflow:hidden">';
echo '<div id="lp_sidebar" class="span4">';
echo '<div id="lp_sidebar" class="col-md-4">';
echo $learnPath->return_new_tree(null, true);
@ -198,7 +198,7 @@ if ($action == 'add_item' && $type == 'document' && !isset($_GET['file'])) {
echo '<div id="hide_bar_template"></div>';
}
echo '<div id="doc_form" class="span8">';
echo '<div id="doc_form" class="col-md-8">';
//@todo use session flash messages
if (in_array($message, array('ItemUpdated'))) {

@ -64,7 +64,7 @@ $renderer = $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addText('keyword', '', false);
$form->addElement('hidden', 'type', $type);
$form->addElement('style_submit_button', 'submit', get_lang('SearchButton'), 'class="search"');
$form->addButtonSearch(get_lang('Search'));
$form->addElement('static', 'additionalactions', null, $actions);
$form->display();
echo '</div>';

Loading…
Cancel
Save