Update buttons.

1.10.x
Julio Montoya 11 years ago
parent 9b9b9f2289
commit 2b3d6bdc6d
  1. 2
      main/admin/configure_homepage.php
  2. 2
      main/admin/course_user_import.php
  3. 2
      main/admin/course_user_import_by_email.php
  4. 3
      main/admin/skills_import.php
  5. 2
      main/admin/user_export.php
  6. 2
      main/admin/user_import.php
  7. 2
      main/admin/user_update_import.php
  8. 2
      main/admin/usergroup_export.php
  9. 2
      main/admin/usergroup_import.php
  10. 2
      main/admin/usergroup_user_import.php
  11. 2
      main/course_progress/thematic.php
  12. 8
      main/exercice/exercise.class.php
  13. 35
      main/exercice/unique_answer_no_option.class.php
  14. 18
      main/inc/lib/formvalidator/FormValidator.class.php
  15. 7
      main/inc/lib/pear/HTML/QuickForm/label.php
  16. 4
      main/newscorm/lp_admin_view.php
  17. 4
      main/notebook/index.php
  18. 2
      main/work/add_document.php
  19. 75
      main/work/edit.php
  20. 2
      main/work/edit_work.php

@ -968,7 +968,7 @@ switch ($action) {
$form->addElement('html', $html_langs);
}
$form->addElement('html','</tr></table><br/>');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
$form->addButtonSave(get_lang('Save'));
$form->setDefaults($default);
$form->display();

@ -157,7 +157,7 @@ $form->addElement('header', '', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
$errors = array();

@ -162,7 +162,7 @@ $form->addElement('header', '', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
$errors = array();

@ -252,8 +252,7 @@ $group = array();
$group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="skill_example.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv');
//$group[] = $form->createElement('radio', 'file_type', null, 'XML (<a href="skill_example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml');
$form->addGroup($group, '', get_lang('FileType'), '<br/>');
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
$defaults['formSent'] = 1;
$defaults['sendMail'] = 0;
$defaults['file_type'] = 'csv';

@ -54,7 +54,7 @@ $form->addElement('radio', 'file_type', null, 'CSV','csv');
$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'),'1');
$form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
$form->addElement('style_submit_button', 'submit',get_lang('Export'),'class="save"');
$form->addButtonExport(get_lang('Export'));
$form->setDefaults(array('file_type'=>'csv'));
if ($form->validate()) {

@ -493,7 +493,7 @@ $form->addElement(
get_lang('CheckUniqueEmail')
);
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
$defaults['formSent'] = 1;
$defaults['sendMail'] = 0;
$defaults['file_type'] = 'csv';

@ -447,7 +447,7 @@ $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$group = array();
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
$defaults['formSent'] = 1;
$defaults['sendMail'] = 0;
$defaults['file_type'] = 'csv';

@ -23,7 +23,7 @@ set_time_limit(0);
$form = new FormValidator('export_users');
$form->addElement('header', $tool_name);
$form->addElement('style_submit_button', 'submit', get_lang('Export'), 'class="save"');
$form->addButtonExport(get_lang('Export'));
if ($form->validate()) {
$userGroup = new UserGroup();

@ -103,7 +103,7 @@ $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
$group = array();
$group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="example_class.csv" target="_blank">' . get_lang('ExampleCSVFile') . '</a>)', 'csv');
$form->addGroup($group, '', get_lang('FileType'), '<br/>');
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
if ($form->validate()) {
$classes = Import::csv_to_array($_FILES['import_file']['tmp_name']);

@ -145,7 +145,7 @@ $form->addElement('header', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
//$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'));
$errors = array();
if ($form->validate()) {

@ -283,6 +283,6 @@ if ($action == 'thematic_list') {
$form->addElement('header', get_lang('ImportThematic'));
$form->addElement('file', 'file');
$form->addElement('checkbox', 'replace', null, get_lang('DeleteAllThematic'));
$form->addElement('style_submit_button', 'SubmitImport', get_lang('Import'), 'class="save"');
$form->addButtonImport(get_lang('Import'), 'SubmitImport');
$form->display();
}

@ -1232,9 +1232,11 @@ class Exercise
}
// submit
$text = isset($_GET['exerciseId']) ? get_lang('ModifyExercise') : get_lang('ProcedToQuestions');
$form->addElement('style_submit_button', 'submitExercise', $text, 'class="save"');
if (isset($_GET['exerciseId'])) {
$form->addButtonSave(get_lang('ModifyExercise'), 'submitExercise');
} else {
$form->addButtonUpdate(get_lang('ProcedToQuestions'), 'submitExercise');
}
$form->addRule('exerciseTitle', get_lang('GiveExerciseName'), 'required');

@ -63,23 +63,24 @@ class UniqueAnswerNoOption extends Question
}
$html='<table class="data_table">
<tr style="text-align: center;">
<th width="10px">
'.get_lang('Number').'
</th>
<th width="10px" >
'.get_lang('True').'
</th>
<th width="50%">
'.get_lang('Answer').'
</th>
'.$comment_title.'
'.$feedback_title.'
<th width="60px">
'.get_lang('Weighting').'
</th>
</tr>';
$form -> addElement ('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html);
<tr style="text-align: center;">
<th width="10px">
'.get_lang('Number').'
</th>
<th width="10px" >
'.get_lang('True').'
</th>
<th width="50%">
'.get_lang('Answer').'
</th>
'.$comment_title.'
'.$feedback_title.'
<th width="60px">
'.get_lang('Weighting').'
</th>
</tr>';
$form->addElement('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html);
$defaults = array();
$correct = 0;

@ -270,6 +270,10 @@ EOT;
/**
* @param string $label
* @param string $name
* @param bool $createElement
*
* @return HTML_QuickForm_button
*/
public function addButtonSave($label, $name = 'submit', $createElement = false)
{
@ -287,6 +291,10 @@ EOT;
/**
* @param string $label
* @param string $name
* @param bool $createElement
*
* @return HTML_QuickForm_button
*/
public function addButtonCreate($label, $name = 'submit', $createElement = false)
{
@ -303,8 +311,11 @@ EOT;
}
/**
* Shortcut to create/add button
* @param string $label
* @param string $name
* @param bool $createElement
*
* @return HTML_QuickForm_button
*/
public function addButtonUpdate($label, $name = 'submit', $createElement = false)
{
@ -339,8 +350,11 @@ EOT;
}
/**
* Shortcut to "send" button
* @param string $label
* @param string $name
* @param bool $createElement
*
* @return HTML_QuickForm_button
*/
public function addButtonSend($label, $name = 'submit', $createElement = false)
{

@ -55,6 +55,11 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
public function toHtml()
{
$for = $this->getLabelFor();
return '<label class="control-label"' . (empty($for) ? '' : ' for="' . $for . '"') . '>' . $this->getLabel() . '</label>' . HTML_QuickForm_static::toHtml();
return
'<label class="control-label"' . empty($for) ? '' : ' for="' . $for . '"' . '>' .
$this->getLabel() .
'</label>
' .
parent::toHtml();
}
}

@ -34,9 +34,9 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$isStudentView = (int) $_REQUEST['isStudentView'];
$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
/* MAIN CODE */

@ -78,7 +78,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') {
? array('ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300')
: array('ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student')
);
$form->addElement('style_submit_button', 'SubmitNote', get_lang('AddNote'), 'class="add"');
$form->addButtonCreate(get_lang('AddNote'), 'SubmitNote');
// Setting the rules
$form->addRule('note_title', get_lang('ThisFieldIsRequired'), 'required');
@ -125,7 +125,7 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'editnote' && is_numeric($_
? array('ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300')
: array('ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student')
);
$form->addElement('style_submit_button', 'SubmitNote', get_lang('ModifyNote'), 'class="save"');
$form->addButtonUpdate(get_lang('ModifyNote'), 'SubmitNote');
// Setting the defaults
$defaults = NotebookManager::get_note_information(Security::remove_XSS($_GET['notebook_id']));

@ -96,7 +96,7 @@ if (empty($docId)) {
$form->addElement('hidden', 'id', $workId);
$form->addElement('hidden', 'document_id', $docId);
$form->addElement('label', get_lang('File'), $documentInfo['title']);
$form->addElement('style_submit_button', 'submit', get_lang('Add'));
$form->addButtonCreate(get_lang('Add'));
if ($form->validate()) {
$values = $form->exportValues();
$workId = $values['id'];

@ -203,7 +203,7 @@ $text = get_lang('UpdateWork');
$class = 'save';
// fix the Ok button when we see the tool in the learn path
$form->addElement('style_submit_button', 'editWork', $text, array('class'=> $class, 'value' => "editWork"));
$form->addButtonUpdate($text);
$form->setDefaults($defaults);
$error_message = null;
@ -213,49 +213,42 @@ $currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'] . '
$succeed = false;
if ($form->validate()) {
if ($student_can_edit_in_session && $check) {
/*
* SPECIAL CASE ! For a work edited
*/
//Get the author ID for that document from the item_property table
$item_to_edit_id = intval($_POST['item_to_edit']);
$is_author = user_is_author($item_to_edit_id);
if ($is_author) {
$work_data = get_work_data_by_id($item_to_edit_id);
if (!empty($_POST['title'])) {
$title = isset($_POST['title']) ? $_POST['title'] : $work_data['title'];
}
$description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
$add_to_update = null;
if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
$add_to_update = ', qualificator_id ='."'".api_get_user_id()."', ";
$add_to_update .= ' qualification = '."'".Database::escape_string($_POST['qualification'])."',";
$add_to_update .= ' date_of_qualification = '."'".api_get_utc_datetime()."'";
}
if (isset($_POST['editWork'])) {
/*
* SPECIAL CASE ! For a work edited
*/
//Get the author ID for that document from the item_property table
$item_to_edit_id = intval($_POST['item_to_edit']);
$is_author = user_is_author($item_to_edit_id);
if ($is_author) {
$work_data = get_work_data_by_id($item_to_edit_id);
if (!empty($_POST['title'])) {
$title = isset($_POST['title']) ? $_POST['title'] : $work_data['title'];
}
$description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
$add_to_update = null;
if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
$add_to_update = ', qualificator_id ='."'".api_get_user_id()."', ";
$add_to_update .= ' qualification = '."'".Database::escape_string($_POST['qualification'])."',";
$add_to_update .= ' date_of_qualification = '."'".api_get_utc_datetime()."'";
}
if ($_POST['qualification'] > $_POST['qualification_over']) {
$error_message .= Display::return_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'), 'error');
} else {
$sql = "UPDATE " . $work_table . "
SET title = '".Database::escape_string($title)."',
description = '".Database::escape_string($description)."'
".$add_to_update."
WHERE c_id = $course_id AND id = $item_to_edit_id";
Database::query($sql);
}
api_item_property_update($_course, 'work', $item_to_edit_id, 'DocumentUpdated', $user_id);
$succeed = true;
$error_message .= Display::return_message(get_lang('ItemUpdated'), 'warning');
if ($_POST['qualification'] > $_POST['qualification_over']) {
$error_message .= Display::return_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'), 'error');
} else {
$error_message .= Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
$sql = "UPDATE " . $work_table . "
SET title = '".Database::escape_string($title)."',
description = '".Database::escape_string($description)."'
".$add_to_update."
WHERE c_id = $course_id AND id = $item_to_edit_id";
Database::query($sql);
}
} else {
$error_message .= Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
api_item_property_update($_course, 'work', $item_to_edit_id, 'DocumentUpdated', $user_id);
$succeed = true;
$error_message .= Display::return_message(get_lang('ItemUpdated'), 'warning');
}
Security::clear_token();
} else {

@ -95,7 +95,7 @@ if ($there_is_a_expire_date) {
$defaults['add_to_calendar'] = isset($homework['add_to_calendar']) ? $homework['add_to_calendar'] : null;
$form = getFormWork($form, $defaults);
$form->addElement('hidden', 'work_id', $workId);
$form->addElement('style_submit_button', 'submit', get_lang('ModifyDirectory'), 'class="save"');
$form->addButtonUpdate(get_lang('ModifyDirectory'));
if ($form->validate()) {
$params = $form->exportValues();

Loading…
Cancel
Save