Feature #2099 - Hiding some buttons from the page for editition training requests depending on the context.

skala
Ivan Tcholakov 15 years ago
parent 1690c0b417
commit 77133e8f16
  1. 12
      main/admin/course_request_edit.php
  2. 2
      main/inc/lib/course_request.lib.php

@ -100,9 +100,15 @@ if ($course_validation_feature) {
// Submit buttons. // Submit buttons.
$submit_buttons[] = FormValidator::createElement('style_submit_button', 'save_button', get_lang('Save'), array('class' => 'save')); $submit_buttons[] = FormValidator::createElement('style_submit_button', 'save_button', get_lang('Save'), array('class' => 'save'));
$submit_buttons[] = FormValidator::createElement('style_submit_button', 'accept_button', get_lang('Accept'), array('class' => 'save', 'style' => 'background-image: url('.api_get_path(WEB_IMG_PATH).'action_accept.gif);')); if ($course_request_info['status'] != COURSE_REQUEST_ACCEPTED) {
$submit_buttons[] = FormValidator::createElement('style_submit_button', 'reject_button', get_lang('Reject'), array('class' => 'save', 'style' => 'background-image: url('.api_get_path(WEB_IMG_PATH).'action_reject.gif);')); $submit_buttons[] = FormValidator::createElement('style_submit_button', 'accept_button', get_lang('Accept'), array('class' => 'save', 'style' => 'background-image: url('.api_get_path(WEB_IMG_PATH).'action_accept.gif);'));
$submit_buttons[] = FormValidator::createElement('style_submit_button', 'ask_info_button', get_lang('AskAdditionalInfo'), array('class' => 'save', 'style' => 'background-image: url('.api_get_path(WEB_IMG_PATH).'request_info.gif);')); }
if ($course_request_info['status'] != COURSE_REQUEST_ACCEPTED && $course_request_info['status'] != COURSE_REQUEST_REJECTED) {
$submit_buttons[] = FormValidator::createElement('style_submit_button', 'reject_button', get_lang('Reject'), array('class' => 'save', 'style' => 'background-image: url('.api_get_path(WEB_IMG_PATH).'action_reject.gif);'));
}
if ($course_request_info['status'] != COURSE_REQUEST_ACCEPTED && intval($course_request_info['info']) <= 0) {
$submit_buttons[] = FormValidator::createElement('style_submit_button', 'ask_info_button', get_lang('AskAdditionalInfo'), array('class' => 'save', 'style' => 'background-image: url('.api_get_path(WEB_IMG_PATH).'request_info.gif);'));
}
$form->addGroup($submit_buttons); $form->addGroup($submit_buttons);
// Hidden form fields. // Hidden form fields.

@ -551,7 +551,7 @@ class CourseRequestManager {
*/ */
public static function additional_info_asked($id) { public static function additional_info_asked($id) {
$id = (int)$id; $id = (int)$id;
$sql = "SELECT id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE (id = ".$id." AND info = 1)"; $sql = "SELECT id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE (id = ".$id." AND info > 0)";
$result = Database::num_rows(Database::query($sql)); $result = Database::num_rows(Database::query($sql));
return !empty($result); return !empty($result);
} }

Loading…
Cancel
Save