Browse Source

Minor - format code

Julio Montoya 9 years ago
parent
commit
1ec28836b3

+ 1 - 1
plugin/ticket/src/assign_tickets.php

@@ -1,10 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  *
  * @package chamilo.plugin.ticket
  */
+
 require_once '../config.php';
 $plugin = TicketPlugin::create();
 

+ 2 - 4
plugin/ticket/src/course_user_list.php

@@ -4,9 +4,7 @@
 /**
  * @package chamilo.plugin.ticket
  */
-/**
- * Init section
- */
+
 require_once '../config.php';
 $plugin = TicketPlugin::create();
 
@@ -27,7 +25,7 @@ $userLabel = Display::tag('label', get_lang('User'), array('class' => 'control-l
 $personName = api_get_person_name($userInfo['firstname'], $userInfo['lastname']);
 $userInput = Display::tag(
     'input',
-    '', 
+    '',
     array(
         'disabled' => 'disabled',
         'type' => 'text',

+ 1 - 3
plugin/ticket/src/index.php

@@ -5,9 +5,7 @@
  * Redirects to "myticket.php"
  * @package chamilo.plugin.ticket
  */
-/**
- * Code
- */
+
 require_once '../config.php';
 header('location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php?message=success');
 exit;

+ 4 - 3
plugin/ticket/src/myticket.php

@@ -5,8 +5,9 @@
  * This script is the Tickets plugin main entry point
  * @package chamilo.plugin.ticket
  */
+
 $cidReset = true;
-//needed in order to load the plugin lang variables
+// needed in order to load the plugin lang variables
 $course_plugin = 'ticket';
 require_once '../config.php';
 
@@ -30,7 +31,7 @@ function load_history_ticket (div_course,ticket_id) {
             $("div#div_"+ticket_id).html(data);
             $("div#div_"+ticket_id).attr("class","blackboard_show");
             $("div#div_"+ticket_id).attr("style","");
-           }
+        }
     });
 }
 function clear_course_list (div_course) {
@@ -44,7 +45,7 @@ $(function() {
 });
 
 $(document).ready(function() {
-        $("#advanced_search_form").css("display","none");
+    $("#advanced_search_form").css("display","none");
 });
 
 function display_advanced_search_form () {

+ 19 - 16
plugin/ticket/src/new_ticket.php

@@ -4,11 +4,14 @@
 /**
  * @package chamilo.plugin.ticket
  */
+
 $cidReset = true;
 require_once '../config.php';
 $plugin = TicketPlugin::create();
 
-if (!api_is_platform_admin() && $plugin->get('allow_student_add') != 'true') {
+if (!api_is_platform_admin() &&
+    $plugin->get('allow_student_add') != 'true'
+) {
     header('location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php');
     exit;
 }
@@ -71,23 +74,23 @@ function validate() {
     var selected = document.getElementById("category_id").selectedIndex;
     var id = document.getElementById("category_id").options[selected].value;
     if (document.getElementById("user_id_request").value == "") {
-            alert("' . $plugin->get_lang("ValidUser") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidUser") . '");
+        return false;
     } else if(id == 0) {
-            alert("' . $plugin->get_lang("ValidType") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidType") . '");
+        return false;
     } else if(document.getElementById("subject").value == "") {
-            alert("' . $plugin->get_lang("ValidSubject") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidSubject") . '");
+        return false;
     } else if(parseInt(course_required[id]) == 1 && document.getElementById("course_id").value == 0) {
-            alert("' . $plugin->get_lang("ValidCourse") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidCourse") . '");
+        return false;
     } else if(id != "CUR" && parseInt(course_required[id]) != 1  && !re.test(document.getElementById("personal_email").value)) {
-            alert("' . $plugin->get_lang("ValidEmail") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidEmail") . '");
+        return false;
     } else if(fckEditor1val == "") {
-            alert("' . $plugin->get_lang("ValidMessage") . '");
-            return false;
+        alert("' . $plugin->get_lang("ValidMessage") . '");
+        return false;
     }
 }
 
@@ -199,14 +202,13 @@ function show_form_send_ticket()
     global $types, $plugin;
     echo '<div class="divTicket">';
 
-    //Category List
+    // Category List
     $categoryList = array();
     foreach ($types as $type) {
         $categoryList[$type['category_id']] = $type['name'] . ": " . $type['description'];
     }
-    //End Category List
 
-    //Status List
+    // Status List
     $statusList = array();
     $statusAttributes = array(
         'style' => 'display: none;',
@@ -495,6 +497,7 @@ function get_number_of_users()
     }
     $res = Database::query($sql);
     $obj = Database::fetch_object($res);
+
     return $obj->total_number_of_items;
 }
 

+ 7 - 7
plugin/ticket/src/report.php

@@ -186,7 +186,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
     $sql = "SELECT
                  u.user_id AS col0,
                  u.official_code AS col2,
-		 $col34
+		        $col34
                  u.username AS col5,
                  u.email AS col6,
                  u.status AS col7,
@@ -305,12 +305,12 @@ if (isset($_POST['report'])) {
     $table_result->set_header(4, get_lang('Tool'), false);
     while ($row = Database::fetch_assoc($result)) {
         $row = array(
-                $row['username'],
-                $row['fullname'],
-                $row['access_date'],
-                $row['course'],
-                get_lang($tools[$row['tool']]['name'])
-            );
+            $row['username'],
+            $row['fullname'],
+            $row['access_date'],
+            $row['course'],
+            get_lang($tools[$row['tool']]['name'])
+        );
         $table_result->addRow($row);
     }
     $table_result->display();

+ 18 - 9
plugin/ticket/src/ticket.class.php

@@ -48,6 +48,7 @@ class TicketManager
         while ($row = Database::fetch_assoc($result)) {
             $types[] = $row;
         }
+
         return $types;
     }
 
@@ -381,7 +382,10 @@ class TicketManager
             foreach ($file_attachments as $file_attach) {
                 if ($file_attach['error'] == 0) {
                     $data_files[] = self::save_message_attachment_file(
-                                    $file_attach, $ticket_id, $message_id, $message_attch_id
+                        $file_attach,
+                        $ticket_id,
+                        $message_id,
+                        $message_attch_id
                     );
                     $message_attch_id++;
                 } else {
@@ -430,7 +434,7 @@ class TicketManager
             }
             $new_path = $path_message_attach . $new_file_name;
             if (is_uploaded_file($file_attach['tmp_name'])) {
-                $result = @copy($file_attach['tmp_name'], $new_path);
+                @copy($file_attach['tmp_name'], $new_path);
             }
             $safe_file_name = Database::escape_string($file_name);
             $safe_new_file_name = Database::escape_string($new_file_name);
@@ -458,6 +462,7 @@ class TicketManager
                     '$now'
                 )";
             Database::query($sql);
+
             return array(
                 'path' => $path_message_attach . $safe_new_file_name,
                 'filename' => $safe_file_name
@@ -657,7 +662,7 @@ class TicketManager
             }
         }
         $sql .= " ORDER BY col$column $direction";
-        $sql .= " LIMIT $from,$number_of_items";
+        $sql .= " LIMIT $from, $number_of_items";
 
         $result = Database::query($sql);
         $tickets = array();
@@ -1028,8 +1033,9 @@ class TicketManager
             }
             $sql = "SELECT  * FROM  $table_support_messages message,
                     $table_main_user user
-                    WHERE message.ticket_id = '$ticket_id'
-                    AND message.sys_insert_user_id = user.user_id ";
+                    WHERE
+                        message.ticket_id = '$ticket_id' AND
+                        message.sys_insert_user_id = user.user_id ";
             $result = Database::query($sql);
             $ticket['messages'] = array();
             $attach_icon = Display::return_icon('attachment.gif', '');
@@ -1050,10 +1056,12 @@ class TicketManager
                 }
 
                 $message['user_created'] = "<a href='$href'> $completeName </a>";
-                $sql_atachment = "SELECT * FROM $table_support_message_attachments
-                                  WHERE message_id = " . $row['message_id'] . "
-                                  AND ticket_id= '$ticket_id'  ";
-                $result_attach = Database::query($sql_atachment);
+                $sql = "SELECT *
+                        FROM $table_support_message_attachments
+                        WHERE
+                            message_id = " . $row['message_id'] . " AND
+                            ticket_id= '$ticket_id'  ";
+                $result_attach = Database::query($sql);
                 while ($row2 = Database::fetch_assoc($result_attach)) {
                     $archiveURL = $archiveURL = $webPath . "plugin/" . PLUGIN_NAME . '/src/download.php?ticket_id=' . $ticket_id . '&file=';
                     $row2['attachment_link'] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $row2['path'] . '&title=' . $row2['filename'] . '">' . $row2['filename'] . '</a>&nbsp;(' . $row2['size'] . ')';
@@ -1127,6 +1135,7 @@ class TicketManager
                 sys_lastedit_datetime ='" . $now . "'
                 WHERE ticket_id ='$ticket_id'";
         $result = Database::query($sql);
+
         if (Database::affected_rows($result) > 0) {
             return true;
         } else {