From 1854bd6e41c7464d10e9654e7f8307671ae194af Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 21 Sep 2015 10:06:08 +0200 Subject: [PATCH] Minor - improve UI --- main/exercice/TestCategory.php | 27 +++++++++--------- main/exercice/tests_category.php | 48 +++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/main/exercice/TestCategory.php b/main/exercice/TestCategory.php index c478ce07e5..4de5d6c207 100644 --- a/main/exercice/TestCategory.php +++ b/main/exercice/TestCategory.php @@ -729,7 +729,7 @@ class TestCategory public function displayCategories($courseId, $sessionId = 0) { $categories = $this->getCategories($courseId, $sessionId); - $html = null; + $html = ''; foreach ($categories as $category) { $tmpobj = new TestCategory($category['id']); @@ -737,20 +737,19 @@ class TestCategory $rowname = self::protectJSDialogQuote($category['title']); $nb_question_label = $nb_question == 1 ? $nb_question . ' ' . get_lang('Question') : $nb_question . ' ' . get_lang('Questions'); - $html .= '
'; - $html .= "" . $nb_question_label . ""; - $html .= $category['title']; - $html .= '
'; - $html .= '
'; - $html .= $category['description']; - $html .= '
'; - $html .= '
'; - $html .= '' . + //$html .= ''; + $links .= ' '; + $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . ''; + $html .= Display::panel($content, $category['title'].$links); } return $html; diff --git a/main/exercice/tests_category.php b/main/exercice/tests_category.php index 5d3dabbadb..533b2cd2e3 100755 --- a/main/exercice/tests_category.php +++ b/main/exercice/tests_category.php @@ -33,7 +33,10 @@ $courseId = api_get_course_int_id(); $sessionId = api_get_session_id(); // breadcrumbs -$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); +$interbreadcrumb[] = array( + "url" => "exercise.php?".api_get_cidreq(), + "name" => get_lang('Exercises'), +); Display::display_header(get_lang('Category')); // Action handling: add, edit and remove @@ -52,19 +55,23 @@ echo $category->displayCategories($courseId, $sessionId); Display::display_footer(); -// FUNCTIONS -// form to edit a category + /** + * Form to edit a category * @todo move to TestCategory.class.php - * @param string $in_action + * @param string $action */ -function edit_category_form($in_action) { - $in_action = Security::remove_XSS($in_action); +function edit_category_form($action) { + $action = Security::remove_XSS($action); if (isset($_GET['category_id']) && is_numeric($_GET['category_id'])) { $category_id = Security::remove_XSS($_GET['category_id']); $objcat = new TestCategory($category_id); - $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $in_action . '&category_id=' . $category_id); + $form = new FormValidator( + 'note', + 'post', + api_get_self().'?action='.$action.'&category_id='.$category_id + ); // Setting the form elements $form->addElement('header', get_lang('EditCategory')); @@ -118,7 +125,7 @@ function edit_category_form($in_action) { } // process to delete a category -function delete_category_form($in_action) { +function delete_category_form($action) { if (isset($_GET['category_id']) && is_numeric($_GET['category_id'])) { $category_id = Security::remove_XSS($_GET['category_id']); $catobject = new TestCategory($category_id); @@ -135,16 +142,22 @@ function delete_category_form($in_action) { /** * form to add a category * @todo move to TestCategory.class.php - * @param string $in_action + * @param string $action */ -function add_category_form($in_action) { - $in_action = Security::remove_XSS($in_action); +function add_category_form($action) { + $action = Security::remove_XSS($action); // initiate the object - $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $in_action); + $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action); // Setting the form elements $form->addElement('header', get_lang('AddACategory')); $form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95')); - $form->addHtmlEditor('category_description', get_lang('CategoryDescription'), false, false, array('ToolbarSet' => 'test_category', 'Height' => '200')); + $form->addHtmlEditor( + 'category_description', + get_lang('CategoryDescription'), + false, + false, + array('ToolbarSet' => 'test_category', 'Height' => '200') + ); $form->addButtonCreate(get_lang('AddTestCategory'), 'SubmitNote'); // setting the rules $form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required'); @@ -176,8 +189,10 @@ function add_category_form($in_action) { function display_add_category() { echo ''; echo "
"; echo "
" . get_lang('QuestionCategory') . "
"; @@ -186,6 +201,7 @@ function display_add_category() { // display goback to category list page link function display_goback() { echo ''; }