Browse Source

Updating ticket settings.

Julio 8 years ago
parent
commit
a303a33d1b

+ 7 - 0
app/Migrations/Schema/V111/Version111.php

@@ -256,6 +256,13 @@ class Version111 extends AbstractMigrationChamilo
             $this->addSql('CREATE INDEX IDX_EDE2C76812469DE2 ON ticket_ticket (category_id);');
 
             $this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id);');
+            $this->addSql('DELETE FROM settings_current WHERE title = "Ticket"');
+
+            $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0)");
+            $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0)");
+            $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_student_add', 'true', 'Yes'), ('ticket_allow_student_add', 'false', 'No')");
+            $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_category_edition', 'true', 'Yes'), ('ticket_allow_category_edition', 'false', 'No')");
+
         }
     }
 

+ 1 - 1
main/inc/lib/TicketManager.php

@@ -1059,7 +1059,7 @@ class TicketManager
                 $dif = $now - $last_edit_date;
 
                 if ($dif > 172800 && $row['priority_id'] === self::PRIORITY_NORMAL && $row['status_id'] != self::STATUS_CLOSE) {
-                    $actions .= '<a href="myticket.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
+                    $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/myticket.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
                                  <img src="' . Display::returnIconPath('exclamation.png') . '" border="0" /></a>';
                 }
                 if ($row['priority_id'] === self::PRIORITY_HIGH) {

+ 2 - 2
main/inc/lib/template.lib.php

@@ -779,8 +779,8 @@ class Template
         global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section;
         $_course = api_get_course_info();
         $help = $this->help;
-        $nameTools             = $this->title;
-        $navigation            = return_navigation_array();
+        $nameTools = $this->title;
+        $navigation = return_navigation_array();
         $this->menu_navigation = $navigation['menu_navigation'];
 
         $this->assign('system_charset', api_get_system_encoding());

+ 8 - 2
main/install/data.sql

@@ -308,7 +308,9 @@ VALUES
 ('cron_remind_course_expiration_frequency', NULL, 'textfield', 'Crons', '2', 'CronRemindCourseExpirationFrequencyTitle', 'CronRemindCourseExpirationFrequencyComment', NULL, NULL, 1),
 ('cron_remind_course_expiration_activate', NULL, 'radio', 'Crons', 'false', 'CronRemindCourseExpirationActivateTitle', 'CronRemindCourseExpirationActivateComment', NULL, NULL, 1),
 ('allow_coach_feedback_exercises',NULL,'radio','Session','true','AllowCoachFeedbackExercisesTitle','AllowCoachFeedbackExercisesComment',NULL,NULL, 0),
-('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1);
+('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1),
+('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0),
+('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0);
 
 INSERT INTO settings_options (variable, value, display_text)
 VALUES
@@ -628,7 +630,11 @@ VALUES
 ('allow_coach_feedback_exercises','true','Yes'),
 ('allow_coach_feedback_exercises','false','No'),
 ('allow_my_files','true','Yes'),
-('allow_my_files','false','No');
+('allow_my_files','false','No')
+('ticket_allow_student_add','true','Yes'),
+('ticket_allow_student_add','false','No'),
+('ticket_allow_category_edition','true','Yes'),
+('ticket_allow_category_edition','false','No');
 
 INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
 ('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),

+ 12 - 4
main/ticket/categories.php

@@ -37,7 +37,10 @@ if ($table->per_page == 0) {
 $formToString = '';
 $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
 
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
 
 if (isset($_GET['action'])) {
     global $table;
@@ -45,13 +48,15 @@ if (isset($_GET['action'])) {
     switch ($action) {
         case 'delete':
             TicketManager::deleteCategory($id);
-
             Display::addFlash(Display::return_message(get_lang('Deleted')));
             header("Location: ".api_get_self());
             break;
         case 'add':
             $toolName = get_lang('Add');
-            $interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
+            $interbreadcrumb[] = array(
+                'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+                'name' => get_lang('Categories')
+            );
             $url = api_get_self().'?action=add';
             $form = TicketManager::getCategoryForm($url);
             $formToString = $form->returnForm();
@@ -78,7 +83,10 @@ if (isset($_GET['action'])) {
             break;
         case 'edit':
             $toolName = get_lang('Edit');
-            $interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
+            $interbreadcrumb[] = array(
+                'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+                'name' => get_lang('Categories')
+            );
             $url = api_get_self().'?action=edit&id='.$id;
             $form = TicketManager::getCategoryForm($url);
 

+ 8 - 2
main/ticket/categories_add_user.php

@@ -49,7 +49,13 @@ if ($form->validate()) {
     exit;
 }
 
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
-$interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+    'name' => get_lang('Categories')
+);
 Display::display_header(get_lang('Users'));
 $form->display();

+ 3 - 3
main/ticket/myticket.php

@@ -220,12 +220,12 @@ if ($isAdmin) {
                 '<a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '">' .
                     Display::return_icon('export_excel.png', get_lang('Export'), '', ICON_SIZE_MEDIUM) . '</a>';
 
-        /*if ($plugin->get('allow_category_edition')) {
+        if (api_get_setting('ticket_allow_category_edition')) {
             echo Display::url(
                 Display::return_icon('folder_document.gif'),
                 api_get_path(WEB_CODE_PATH) . 'ticket/categories.php'
             );
-        }*/
+        }
 
         echo Display::url(
             Display::return_icon('settings.png'),
@@ -258,7 +258,7 @@ if ($isAdmin) {
     $advancedSearchForm->addButtonSearch(get_lang('AdvancedSearch'), 'submit_advanced');
     $advancedSearchForm->display();
 } else {
-    if ($plugin->get('allow_student_add') == 'true') {
+    if (api_get_setting('ticket_allow_student_add') == 'true') {
         echo '<div class="actions" >';
         echo '<span style="float:right;">' .
                 '<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php">' .

+ 5 - 4
main/ticket/new_ticket.php

@@ -8,8 +8,7 @@
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
-if (!api_is_platform_admin()
-//    $plugin->get('allow_student_add') != 'true'
+if (!api_is_platform_admin() || api_get_setting('ticket_allow_student_add') != 'true'
 ) {
     header('location:' . api_get_path(WEB_CODE_PATH).'ticket/myticket.php');
     exit;
@@ -570,8 +569,10 @@ function get_user_data($from, $number_of_items, $column, $direction)
     return $users;
 }
 
-
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php', 
+    'name' => get_lang('MyTickets')
+);
 
 if (!isset($_POST['compose'])) {
     if (api_is_platform_admin()) {

+ 5 - 7
main/ticket/ticket_details.php

@@ -12,15 +12,13 @@ api_block_anonymous_users();
 
 $user_id = api_get_user_id();
 $isAdmin = api_is_platform_admin();
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
 $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('TicketDetail'));
 
 $disableReponseButtons = '';
-/*if ($isAdmin) {
-    $disableReponseButtons = "$('#responseyes').attr('disabled', 'disabled');
-                              $('#responseno').attr('disabled', 'disabled');";
-}*/
-
 $htmlHeadXtra[] = '<script>
 $(document).ready(function() {
 	$("#dialog-form").dialog({
@@ -185,7 +183,7 @@ if (!isset($ticket['ticket'])) {
     api_not_allowed();
 }
 if (!isset($_GET['ticket_id'])) {
-    header('location:myticket.php');
+    header('Location: '.api_get_path(WEB_CODE_PATH).'ticket/myticket.php');
     exit;
 }
 if (isset($_POST['response'])) {