Bladeren bron

Move ticket code

jmontoyaa 8 jaren geleden
bovenliggende
commit
6c018f923b

+ 0 - 249
plugin/ticket/database.php

@@ -1,249 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Contains the SQL for the tickets management plugin database structure
- */
-
-$objPlugin = TicketPlugin::create();
-
-// Category
-$table = Database::get_main_table(TABLE_TICKET_CATEGORY);
-
-if (!Database::tableExists($table)) {
-    $sql = "CREATE TABLE IF NOT EXISTS $table (
-            id int UNSIGNED NOT NULL AUTO_INCREMENT,
-            category_id char(3) NOT NULL,
-            project_id char(3) NOT NULL,
-            name varchar(100) NOT NULL,
-            description varchar(255) NOT NULL,
-            total_tickets int UNSIGNED NOT NULL DEFAULT '0',
-            course_required char(1) NOT NULL,
-            sys_insert_user_id int UNSIGNED DEFAULT NULL,
-            sys_insert_datetime datetime DEFAULT NULL,
-            sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
-            sys_lastedit_datetime datetime DEFAULT NULL,
-            PRIMARY KEY (id))";
-    $result = Database::query($sql);
-
-    $tableLog = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG);
-    $sql = "CREATE TABLE IF NOT EXISTS $tableLog (
-            id int UNSIGNED NOT NULL AUTO_INCREMENT,
-            ticket_id int UNSIGNED DEFAULT NULL,
-            user_id int UNSIGNED DEFAULT NULL,
-            assigned_date datetime DEFAULT NULL,
-            sys_insert_user_id int UNSIGNED DEFAULT NULL,
-            PRIMARY KEY PK_ticket_assigned_log (id),
-            KEY FK_ticket_assigned_log (ticket_id))";
-    Database::query($sql);
-
-    // Default Categories
-    $categories = array(
-        $objPlugin->get_lang('Enrollment') => $objPlugin->get_lang('TicketsAboutEnrollment'),
-        $objPlugin->get_lang('GeneralInformation') => $objPlugin->get_lang('TicketsAboutGeneralInformation'),
-        $objPlugin->get_lang('RequestAndPapework') => $objPlugin->get_lang('TicketsAboutRequestAndPapework'),
-        $objPlugin->get_lang('AcademicIncidence') => $objPlugin->get_lang('TicketsAboutAcademicIncidence'),
-        $objPlugin->get_lang('VirtualCampus') => $objPlugin->get_lang('TicketsAboutVirtualCampus'),
-        $objPlugin->get_lang('OnlineEvaluation') => $objPlugin->get_lang('TicketsAboutOnlineEvaluation')
-    );
-
-    $i = 1;
-    foreach ($categories as $category => $description) {
-        // Online evaluation requires a course
-        if ($i == 6) {
-            $attributes = array(
-                'id' => $i,
-                'category_id' => $i,
-                'name' => $category,
-                'description' => $description,
-                'project_id' => 1,
-                'course_required' => 1
-            );
-        } else {
-            $attributes = array(
-                'id' => $i,
-                'category_id' => $i,
-                'project_id' => 1,
-                'description' => $description,
-                'name' => $category,
-                'course_required' => 0
-            );
-        }
-
-        Database::insert($table, $attributes);
-        $i++;
-    }
-}
-
-$table = Database::get_main_table(TABLE_TICKET_MESSAGE);
-$sql = "CREATE TABLE IF NOT EXISTS $table (
-        id int UNSIGNED NOT NULL AUTO_INCREMENT,
-        message_id int UNSIGNED NOT NULL,
-        ticket_id int UNSIGNED NOT NULL,
-        subject varchar(255) DEFAULT NULL,
-        message text NOT NULL,
-        status char(3) NOT NULL,
-        ip_address varchar(16) DEFAULT NULL,
-        sys_insert_user_id int UNSIGNED DEFAULT NULL,
-        sys_insert_datetime datetime DEFAULT NULL,
-        sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
-        sys_lastedit_datetime datetime DEFAULT NULL,
-        PRIMARY KEY (id),
-        KEY FK_tick_message (ticket_id))";
-Database::query($sql);
-
-$table = Database::get_main_table(TABLE_TICKET_MESSAGE_ATTACHMENTS);
-$sql = "CREATE TABLE IF NOT EXISTS $table (
-        id int UNSIGNED NOT NULL AUTO_INCREMENT,
-        message_attch_id char(2) NOT NULL,
-        message_id char(2) NOT NULL,
-        ticket_id int UNSIGNED NOT NULL,
-        path varchar(255) NOT NULL,
-        filename varchar(255) NOT NULL,
-        size varchar(25) DEFAULT NULL,
-        sys_insert_user_id int UNSIGNED DEFAULT NULL,
-        sys_insert_datetime datetime DEFAULT NULL,
-        sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
-        sys_lastedit_datetime datetime DEFAULT NULL,
-        PRIMARY KEY (id),
-        KEY ticket_message_id_fk (message_id))";
-Database::query($sql);
-
-// Priority
-$table = Database::get_main_table(TABLE_TICKET_PRIORITY);
-
-if (!Database::tableExists($table)) {
-    $sql = "CREATE TABLE IF NOT EXISTS $table (
-            id int UNSIGNED NOT NULL AUTO_INCREMENT,
-            priority_id char(3) NOT NULL,
-            priority varchar(20) DEFAULT NULL,
-            priority_desc varchar(250) DEFAULT NULL,
-            priority_color varchar(25) DEFAULT NULL,
-            priority_urgency tinyint DEFAULT NULL,
-            sys_insert_user_id int UNSIGNED DEFAULT NULL,
-            sys_insert_datetime datetime DEFAULT NULL,
-            sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
-            sys_lastedit_datetime datetime DEFAULT NULL,
-            PRIMARY KEY (id))";
-    Database::query($sql);
-
-    // Default Priorities
-    $defaultPriorities = array(
-        TicketManager::PRIORITY_NORMAL => $objPlugin->get_lang('PriorityNormal'),
-        TicketManager::PRIORITY_HIGH => $objPlugin->get_lang('PriorityHigh'),
-        TicketManager::PRIORITY_LOW => $objPlugin->get_lang('PriorityLow')
-    );
-
-    $i = 1;
-    foreach ($defaultPriorities as $pId => $priority) {
-        $attributes = array(
-            'id' => $i,
-            'priority_id' => $pId,
-            'priority' => $priority,
-            'priority_desc' => $priority
-        );
-        Database::insert($table, $attributes);
-        $i++;
-    }
-}
-
-$table = Database::get_main_table(TABLE_TICKET_PROJECT);
-if (!Database::tableExists($table)) {
-    $sql = "CREATE TABLE IF NOT EXISTS $table (
-            id int UNSIGNED NOT NULL AUTO_INCREMENT,
-            project_id char(3) NOT NULL,
-            name varchar(50) DEFAULT NULL,
-            description varchar(250) DEFAULT NULL,
-            email varchar(50) DEFAULT NULL,
-            other_area tinyint NOT NULL DEFAULT '0',
-            sys_insert_user_id int UNSIGNED DEFAULT NULL,
-            sys_insert_datetime datetime DEFAULT NULL,
-            sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
-            sys_lastedit_datetime datetime DEFAULT NULL,
-            PRIMARY KEY (id))";
-    Database::query($sql);
-
-    // Default Project Table Ticket
-    $attributes = array(
-        'id' => 1,
-        'project_id' => 1,
-        'name' => 'Ticket System'
-    );
-    Database::insert($table, $attributes);
-}
-
-// STATUS
-$table = Database::get_main_table(TABLE_TICKET_STATUS);
-if (!Database::tableExists($table)) {
-    $sql = "CREATE TABLE IF NOT EXISTS $table (
-            id int UNSIGNED NOT NULL AUTO_INCREMENT,
-            status_id char(3) NOT NULL,
-            name varchar(100) NOT NULL,
-            description varchar(255) DEFAULT NULL,
-            PRIMARY KEY (id))";
-    Database::query($sql);
-
-    // Default status
-    $defaultStatus = array(
-        TicketManager::STATUS_NEW => $objPlugin->get_lang('StatusNew'),
-        TicketManager::STATUS_PENDING => $objPlugin->get_lang('StatusPending'),
-        TicketManager::STATUS_UNCONFIRMED => $objPlugin->get_lang('StatusUnconfirmed'),
-        TicketManager::STATUS_CLOSE => $objPlugin->get_lang('StatusClose'),
-        TicketManager::STATUS_FORWARDED => $objPlugin->get_lang('StatusForwarded')
-    );
-
-    $i = 1;
-    foreach ($defaultStatus as $abr => $status) {
-        $attributes = array(
-            'id' => $i,
-            'status_id' => $abr,
-            'name' => $status
-        );
-        Database::insert($table, $attributes);
-        $i++;
-    }
-}
-
-$table = Database::get_main_table(TABLE_TICKET_TICKET);
-$sql = "CREATE TABLE IF NOT EXISTS $table (
-        ticket_id int UNSIGNED NOT NULL AUTO_INCREMENT,
-        ticket_code char(12) DEFAULT NULL,
-        project_id char(3) DEFAULT NULL,
-        category_id char(3) NOT NULL,
-        priority_id char(3) NOT NULL,
-        course_id int UNSIGNED NOT NULL,
-        session_id int UNSIGNED NOT NULL DEFAULT '0',        
-        personal_email varchar(150) DEFAULT NULL,
-        assigned_last_user int UNSIGNED NOT NULL DEFAULT '0',
-        status_id char(3) NOT NULL,
-        total_messages int UNSIGNED NOT NULL DEFAULT '0',
-        subject varchar(255) DEFAULT NULL,
-        message text NOT NULL,
-        keyword varchar(250) DEFAULT NULL,
-        source char(3) NOT NULL,
-        start_date datetime NOT NULL,
-        end_date datetime DEFAULT NULL,
-        sys_insert_user_id int UNSIGNED DEFAULT NULL,
-        sys_insert_datetime datetime DEFAULT NULL,
-        sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
-        sys_lastedit_datetime datetime DEFAULT NULL,
-        PRIMARY KEY (ticket_id),
-        UNIQUE KEY UN_ticket_code (ticket_code),
-        KEY FK_ticket_priority (priority_id),
-        KEY FK_ticket_category (project_id,category_id))";
-Database::query($sql);
-
-$table = Database::get_main_table(TABLE_TICKET_CATEGORY_REL_USER);
-$sql = "CREATE TABLE IF NOT EXISTS $table (
-        id int UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
-        category_id INT NOT NULL,
-        user_id INT NOT NULL
-)";
-Database::query($sql);
-
-// Menu main tabs
-$rsTab = $objPlugin->addTab('Ticket', 'plugin/ticket/src/myticket.php');
-
-if ($rsTab) {
-    echo "<script>location.href = '" . $_SERVER['REQUEST_URI'] . "';</script>";
-}

+ 0 - 102
plugin/ticket/lang/english.php

@@ -1,102 +0,0 @@
-<?php
-$strings['plugin_title'] = "Support tickets";
-$strings['plugin_comment'] = "Plugin to include a support tickets system inside Chamilo.";
-$strings['tool_enable'] = "Enable Ticket plugin";
-$strings['tool_enable_help'] = "Enabling the ticket tool will make a new tab available in the main horizontal menu. This tab will appear for all users and will lead them to the tickets management system where they can check the status of their tickets.";
-$strings['TabsTickets'] = "Tickets tab";
-$strings['TicketNum'] = "Ticket #";
-$strings['Date'] = "Date";
-$strings['Category'] = "Category";
-$strings['User'] = "User";
-$strings['Program'] = "Program";
-$strings['Responsible'] = "Assigned to";
-$strings['Status'] = "Status";
-$strings['Message'] = "Messages";
-$strings['Description'] = "Description";
-$strings['Tickets'] = "Tickets";
-$strings['MyTickets'] = "My Tickets";
-$strings['MsgWelcome'] = "Welcome to YOUR tickets section. Here, you'll be able to track the state of all the tickets you created in the main tickets section";
-$strings['TckSuccessSave'] = "Your ticket has been created successfully";
-$strings['TckClose'] = "Close the ticket";
-$strings['TckNew'] = "New ticket";
-$strings['TcksNew'] = "New tickets";
-$strings['Unassigned'] = "Not assigned";
-$strings['Unassign'] = "Unassigned";
-$strings['Read'] = "Read";
-$strings['Unread'] = "Not read";
-$strings['RegisterDate'] = "Registration date";
-$strings['AssignedTo'] = "Assigned to";
-$strings['ValidUser'] = "Please select a user";
-$strings['ValidType'] = "Please select a type";
-$strings['ValidSubject'] = "Please select a topic";
-$strings['ValidCourse'] = "Please select a course";
-$strings['ValidEmail'] = "The e-mail address must be valid";
-$strings['ValidMessage'] = "You must enter a message";
-$strings['PersonalEmail'] = "Personal e-mail";
-$strings['Optional'] = "Optional";
-$strings['ErrorRegisterMessage'] = "The ticket could not be created";
-$strings['Source'] = "Source";
-$strings['DeniedAccess'] = "Unauthorized access.";
-$strings['StatusNew'] = "New";
-$strings['StatusPending'] = "Pending";
-$strings['StatusUnconfirmed'] = "Unconfirmed";
-$strings['StatusClose'] = "Closed";
-$strings['StatusForwarded'] = "Resent";
-$strings['Priority'] = "Priority";
-$strings['PriorityHigh'] = "High";
-$strings['PriorityNormal'] = "Normal";
-$strings['PriorityLow'] = "Low";
-$strings['SrcPlatform'] = "Platforme";
-$strings['SrcEmail'] = "E-mail";
-$strings['SrcPhone'] = "Phone";
-$strings['SrcPresential'] = "In-person";
-$strings['TicketAssignedMsg'] = "<p>Dear %s</p><p><a href='%s'>Ticket  %s</a> has been assigned to you.</p><p>Message sent from the support ticket system</p>";
-$strings['TicketAssignX'] = "[TICKETS] Assignation of ticket #%s";
-$strings['AreYouSureYouWantToCloseTheTicket'] = "Are you sure you want to close this ticket?";
-$strings['AreYouSureYouWantToUnassignTheTicket'] = "Are you sure you want to unassign this ticket?";
-$strings['YouMustWriteAMessage'] = "You have to enter a message";
-$strings['LastResponse'] = "Last response";
-$strings['AssignTicket'] = "Assign ticket";
-$strings['AttendedBy'] = "Attended by";
-$strings['IfYouAreSureTheTicketWillBeClosed'] = "If you are certain, the ticket will be closed";
-$strings['YourQuestionWasSentToTheResponableAreaX'] = "<p>Your support request was sent to the area manager: <a href='mailto:%s'>%s</a></p>";
-$strings['YourAnswerToTheQuestionWillBeSentToX'] = "<p>The answer to your support ticket was sent to the following e-mail: <a href='#'>%s</a></p>";
-$strings['VirtualSupport'] = "Virtual support";
-$strings['IncidentResentToVirtualSupport'] = "The incident was sent to virtual support";
-$strings['DateLastEdition'] = "Last edition date";
-$strings['GeneralInformation'] = "General information";
-$strings['TicketsAboutGeneralInformation'] = "Tickets about general information";
-$strings['Enrollment'] = "Enrollment";
-$strings['TicketsAboutEnrollment'] = "Tickets about enrollment";
-$strings['RequestAndPapework'] = "Requests and paperwork";
-$strings['TicketsAboutRequestAndPapework'] = "Tickets about requests and paperwork";
-$strings['AcademicIncidence'] = "Academic Incidents";
-$strings['TicketsAboutAcademicIncidence'] = "Tickets about academic incidents, like exams, practices, tasks, etc.";
-$strings['VirtualCampus'] = "Virtual campus";
-$strings['TicketsAboutVirtualCampus'] = "Tickets about virtual campus";
-$strings['OnlineEvaluation'] = "Online evaluation";
-$strings['TicketsAboutOnlineEvaluation'] = "Tickets about online evaluation";
-$strings['ToBeAssigned'] = "To be assigned";
-$strings['Untill'] = "Until";
-$strings['TicketWasThisAnswerSatisfying'] = "Was this answer satisfactory?";
-$strings['TicketDetail'] = "Ticket details";
-$strings['AreYouSure'] = "Are you sure?";
-$strings['allow_student_add'] = "Allow students to generate tickets";
-$strings['PleaseBeforeRegisterATicketSelectOneUser'] = "Please select a user before you register a ticket.";
-$strings['RequestConfirmation'] = "Request confirmation";
-
-$strings['TicketUpdated'] = "Ticket updated";
-$strings['TicketClosed'] = "Ticket closed";
-
-$strings['TicketXCreated'] = "Ticket <b>%s</b> created";
-$strings['allow_category_edition'] = "Allow category edition";
-$strings['warn_admin_no_user_in_category'] = "Warn admin if category doesn't have users related";
-$strings['send_warning_to_all_admins'] = "Send warning to all admins, if category doesn't have users related";
-$strings['WarningCategoryXDoesntHaveUsers'] = "Warning: The category '%s' doesn't have users assigned";
-$strings['TicketInformation'] = 'Ticket information';
-$strings['CategoryWithNoUserNotificationSentToAdmins'] = 'Category <b>%s</b> has users, Ticket sent to all administrators.';
-$strings['TicketXAssignedToUserX'] = 'Ticket <b>#%s</b> assigned to user <b>%s</b>';
-$strings['TicketXCreatedWithNoCategory'] = 'Ticket <b>#%s</b> created with no category';
-
-$strings['UpdatedByX'] = 'Updated by %s';
-$strings['AssignedChangeFromXToY'] = 'Assignee changed from %s to %s';

+ 0 - 89
plugin/ticket/lang/french.php

@@ -1,89 +0,0 @@
-<?php
-$strings['plugin_title'] = "Tickets de support";
-$strings['plugin_comment'] = "Plugin de gestion des tickets de support.";
-$strings['tool_enable'] = "Activer le plugin de tickets";
-$strings['tool_enable_help'] = "Activer l'outil de tickets activera un nouvel onglet dans le même menu horizontal. Cet onglet apparaîtra pour tous les utilisateurs et les mènera au système de gestion de tickets où ils pourront vérifier l'état de leurs tickets.";
-$strings['TabsTickets'] = "Onglet tickets";
-$strings['TicketNum'] = "Ticket #";
-$strings['Date'] = "Date";
-$strings['Category'] = "Catégorie";
-$strings['User'] = "Utilisateur";
-$strings['Program'] = "Programme";
-$strings['Responsible'] = "Assigné à";
-$strings['Status'] = "État";
-$strings['Message'] = "Messages";
-$strings['Description'] = "Description";
-$strings['Tickets'] = "Tickets";
-$strings['MyTickets'] = "Mes tickets";
-$strings['MsgWelcome'] = "Ceci est la section MES Tickets, où vous pouvez suivre l'évolution des tickets que vous avez créé";
-$strings['TckSuccessSave'] = "Votre ticket a été enregistré";
-$strings['TckClose'] = "Fermer le ticket";
-$strings['TckNew'] = "Nouveau ticket";
-$strings['TcksNew'] = "Nouveaux tickets";
-$strings['Unassigned'] = "Non assignés";
-$strings['Unassign'] = "Désassigné";
-$strings['Read'] = "Lus";
-$strings['Unread'] = "Non lus";
-$strings['RegisterDate'] = "Date d'enregistrement";
-$strings['AssignedTo'] = "Assigné à";
-$strings['ValidUser'] = "Veuillez sélectionner un utilisateur";
-$strings['ValidType'] = "Veuillez sélectionner un type";
-$strings['ValidSubject'] = "Veuillez sélectionner un sujet";
-$strings['ValidCourse'] = "Veuillez sélectionner un cours";
-$strings['ValidEmail'] = "L'adresse e-mail doit être correcte";
-$strings['ValidMessage'] = "Veuillez introduire un message";
-$strings['PersonalEmail'] = "E-mail personnel";
-$strings['Optional'] = "Optionnel";
-$strings['ErrorRegisterMessage'] = "Le ticket n'a pas pu être enregistré";
-$strings['Source'] = "Source";
-$strings['DeniedAccess'] = "Accès non autorisé.";
-$strings['StatusNew'] = "Nouveau";
-$strings['StatusPending'] = "En attente";
-$strings['StatusUnconfirmed'] = "À confirmer";
-$strings['StatusClose'] = "Fermé";
-$strings['StatusForwarded'] = "Réenvoyé";
-$strings['Priority'] = "Priorité";
-$strings['PriorityHigh'] = "Haute";
-$strings['PriorityNormal'] = "Normale";
-$strings['PriorityLow'] = "Basse";
-$strings['SrcEmail'] = "E-mail";
-$strings['SrcPhone'] = "Téléphone";
-$strings['SrcPresential'] = "En personne";
-$strings['TicketAssignedMsg'] = "<p>Cher/Chère %s </p><p>Le <a href='%s'>ticket %s</a> vous a été assigné.</p><p>Message envoyé depuis le système de support.</p>";
-$strings['TicketAssignX'] = "[TICKETS] Assignation de ticket #%s";
-$strings['AreYouSureYouWantToCloseTheTicket'] = "Êtes-vous certain de vouloir fermer ce ticket?";
-$strings['AreYouSureYouWantToUnassignTheTicket'] = "Êtes-vous certain de vouloir désassigner le ticket?";
-$strings['YouMustWriteAMessage'] = "Vous devez introduire un message";
-$strings['LastResponse'] = "Dernière réponse";
-$strings['AssignTicket'] = "Assigner ticket";
-$strings['AttendedBy'] = "Pris en charge par";
-$strings['IfYouAreSureTheTicketWillBeClosed'] = "Si vous êtes certain, le ticket sera clôturé";
-$strings['YourQuestionWasSentToTheResponableAreaX'] = "<p>Votre demande de support a été réenvoyée au responsable du département: <a href='mailto:%s'>%s</a></p>";
-$strings['YourAnswerToTheQuestionWillBeSentToX'] = "<p>La réponse à votre demande de support sera envoyée à l'e-mail:<a href='#'>%s</a></p>";
-$strings['VirtualSupport'] = "Support virtuel";
-$strings['IncidentResentToVirtualSupport'] = "L'incident a été envoyé au support virtuel";
-$strings['DateLastEdition'] = "Date de la dernière édition";
-$strings['GeneralInformation'] = "Information générale";
-$strings['TicketsAboutGeneralInformation'] = "Tickets liés à information générale.";
-$strings['Enrollment'] = "Inscription";
-$strings['TicketsAboutEnrollment'] = "Tickets liés à l'inscription.";
-$strings['RequestAndPapework'] = "Questions précédentes et procédures";
-$strings['TicketsAboutRequestAndPapework'] = "Tickets liés aux questions précédentes et procédures.";
-$strings['AcademicIncidence'] = "Incidences académiques";
-$strings['TicketsAboutAcademicIncidence'] = "Tickets liés aux incidences académiques, comme les examens, les pratiques, tâches, etc.";
-$strings['VirtualCampus'] = "Campus virtuel";
-$strings['TicketsAboutVirtualCampus'] = "Tickets liés au campus virtuel";
-$strings['OnlineEvaluation'] = "Évaluation en ligne";
-$strings['TicketsAboutOnlineEvaluation'] = "Tickets liés aux évaluations en ligne";
-$strings['ToBeAssigned'] = "À assigner";
-$strings['Untill'] = "Jusqu'au";
-$strings['TicketWasThisAnswerSatisfying'] = "La réponse au ticket est-elle satisfaisante?";
-$strings['TicketDetail'] = "Détails du ticket";
-$strings['AreYouSure'] = "Êtes-vous certain?";
-$strings['allow_student_add'] = "Permettre à l'étudiant de générer des tickets";
-$strings['PleaseBeforeRegisterATicketSelectOneUser'] = "Veuillez sélectionner un utilisateur avant d'enregistrer un ticket.";
-$strings['RequestConfirmation'] = "Demander confirmation";
-$strings['TicketUpdated'] = "Ticket modifié";
-$strings['TicketClosed'] = "Ticket fermé";
-$strings['SrcPlatform'] = "Platforme";
-$strings['UpdatedByX'] = 'Updated by %s';

+ 0 - 93
plugin/ticket/lang/spanish.php

@@ -1,93 +0,0 @@
-<?php /* License: see /license.txt */
-//Needed in order to show the plugin title
-$strings['plugin_title'] = "Tickets de soporte";
-$strings['plugin_comment'] = "Plugin para el soporte de tickets de atención dentro de Chamilo.";
-$strings['tool_enable'] = "Activar plugin de tickets";
-$strings['tool_enable_help'] = "Activar la herramienta de tickets hará disponible una nueva pestaña en la barra principal horizontal. Esta pestaña aparecerá para todos los usuarios y los guiará al sistema de gestión de tickets donde podrán verificar el estado de sus tickets.";
-$strings['TabsTickets'] = "Pestaña de tickets";
-$strings['TicketNum'] = "Ticket #";
-$strings['Date'] = "Fecha";
-$strings['Category'] = "Categoría";
-$strings['User'] = "Usuario";
-$strings['Program'] = "Programa";
-$strings['Responsible'] = "Responsable";
-$strings['Status'] = "Estado";
-$strings['Message'] = "Mensajes";
-$strings['Description'] = "Descripción";
-$strings['Tickets'] = "Tickets";
-$strings['MyTickets'] = "Mis Tickets";
-$strings['MsgWelcome'] = "Bienvenido a su sección MIS TICKETS. Esta sección le permite revisar sus Tickets de Soporte generados en SOPORTE TÉCNICO";
-$strings['TckSuccessSave'] = "Se registró con éxito su ticket";
-$strings['TckClose'] = "Cerrar Tickets";
-$strings['TckNew'] = "Nuevo Ticket";
-$strings['TcksNew'] = "Tickets Nuevos";
-$strings['Unassigned'] = "No asignados";
-$strings['Unassign'] = "Desasignado";
-$strings['Read'] = "Leídos";
-$strings['Unread'] = "No leídos";
-$strings['RegisterDate'] = "Fecha de Registro";
-$strings['AssignedTo'] = "Asignado a";
-$strings['ValidUser'] = "Debe seleccionar a un usuario";
-$strings['ValidType'] = "Debe seleccionar un tipo";
-$strings['ValidSubject'] = "Debe escribir un asunto";
-$strings['ValidCourse'] = "Debe elegir un curso";
-$strings['ValidEmail'] = "Debe escribir un email válido";
-$strings['ValidMessage'] = "Debe escribir un mensaje";
-$strings['PersonalEmail'] = "Email Personal";
-$strings['Optional'] = "Opcional";
-$strings['ErrorRegisterMessage'] = "No se pudo registrar su ticket";
-$strings['Source'] = "Fuente";
-$strings['DeniedAccess'] = "Acceso denegado.";
-// Status Tickets
-$strings['StatusNew'] = "Nuevo";
-$strings['StatusPending'] = "Pendiente";
-$strings['StatusUnconfirmed'] = "Por Confirmar";
-$strings['StatusClose'] = "Cerrado";
-$strings['StatusForwarded'] = "Reenviado";
-// Priority
-$strings['Priority'] = "Prioridad";
-$strings['PriorityHigh'] = "Alta";
-$strings['PriorityNormal'] = "Normal";
-$strings['PriorityLow'] = "Baja";
-// Source
-$strings['SrcEmail'] = "Email";
-$strings['SrcPhone'] = "Teléfono";
-$strings['SrcPresential'] = "Presencial";
-$strings['TicketAssignedMsg']    = "<p>Estimado(a) %s </p><p>Se le ha sido asignado el <a href=\"%s\">ticket %s</a></p><p>Mensaje enviado desde el sistema de ticket.</p>";
-$strings['TicketAssignX'] = "[TICKETS] Asignación de Ticket #%s ";
-$strings['AreYouSureYouWantToCloseTheTicket'] = "¿Está seguro que quiere cerrar el ticket?";
-$strings['AreYouSureYouWantToUnassignTheTicket'] = "¿Está seguro que quiere desasignarse el ticket?";
-$strings['YouMustWriteAMessage'] = "Debe escribir un mensaje";
-$strings['LastResponse'] = "Última Respuesta";
-$strings['AssignTicket'] = "Asignar Ticket";
-$strings['AttendedBy'] = "Atendido por";
-$strings['IfYouAreSureTheTicketWillBeClosed'] = "Si está seguro el Ticket será cerrado";
-$strings['YourQuestionWasSentToTheResponableAreaX'] = "<p>Su consulta fue reenviada al área responsable: <a href='mailto: %s'>%s</a></p>";
-$strings['YourAnswerToTheQuestionWillBeSentToX'] = "<p>La respuesta a su consulta será enviada al correo:<a href='#'>%s</a></p>";
-$strings['VirtualSupport'] = "Soporte Virtual";
-$strings['IncidentResentToVirtualSupport'] = "El incidente ha sido reenviado al Soporte Técnico";
-$strings['DateLastEdition'] = "Fecha Última Edición";
-$strings['GeneralInformation'] = "Información General";
-$strings['TicketsAboutGeneralInformation'] = "Tickets acerca de Infomación General.";
-$strings['Enrollment'] = "Matrícula";
-$strings['TicketsAboutEnrollment'] = "Tickets relacionados con la Matrícula.";
-$strings['RequestAndPapework'] = "Consultas y Trámites";
-$strings['TicketsAboutRequestAndPapework'] = "Tickets relacionados a consultas anteriores y trámites.";
-$strings['AcademicIncidence'] = "Incidencias Académicas";
-$strings['TicketsAboutAcademicIncidence'] = "Tickets relacionados a incidencias académicas como exámenes, prácticas, tareas, etc.";
-$strings['VirtualCampus'] = "Campus Virtual";
-$strings['TicketsAboutVirtualCampus'] = "Tickets relacionados al Campus Virtual";
-$strings['OnlineEvaluation'] = "Evaluación en línea";
-$strings['TicketsAboutOnlineEvaluation'] = "Tickets relacionados a las evaluaciones en línea";
-$strings['ToBeAssigned'] = "Por Asignar";
-$strings['Untill'] = "Hasta";
-$strings['TicketWasThisAnswerSatisfying'] = "¿Fue la respuesta al Ticket satisfactoria?";
-$strings['TicketDetail'] = "Detalle del Ticket";
-$strings['AreYouSure'] = "¿Está seguro?";
-$strings['allow_student_add'] = "Permitir al estudiante generar Tickets";
-$strings['PleaseBeforeRegisterATicketSelectOneUser'] = "Por favor, antes de registrar un Ticket seleccione un usuario.";
-$strings['RequestConfirmation'] = "Solicitar confirmación";
-$strings['TicketUpdated'] = "Ticket actualizado";
-$strings['TicketClosed'] = "Ticket cerrado";
-$strings['SrcPlatform'] = "Plataforma";
-$strings['UpdatedByX'] = 'Actualizado por %s';

+ 0 - 72
plugin/ticket/src/assign_tickets.php

@@ -1,72 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- *
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-api_protect_course_script();
-if (!api_is_allowed_to_edit()) {
-	api_not_allowed();
-}
-$course_info = api_get_course_info();
-$course_code = $course_info['code'];
-
-echo '<form action="tutor.php" name="assign" id ="assign">';
-echo '<div id="confirmation"></div>';
-$id = intval($_GET['id']);
-$tblWeeklyReport = Database::get_main_table('rp_reporte_semanas');
-$sql ="SELECT * FROM $tblWeeklyReport WHERE id = '$id'";
-$sql_tasks = "SELECT id AS colid, title as coltitle
-    FROM ".Database::get_course_table(TABLE_STUDENT_PUBLICATION)."
-    WHERE parent_id = 0
-        AND id NOT IN (
-            SELECT work_id
-            FROM $tblWeeklyReport
-            WHERE
-                course_code = '$course_code' AND
-                id != '$id'
-        )";
-$sql_forum = "SELECT thread_id AS colid, thread_title AS coltitle
-    FROM ".Database::get_course_table(TABLE_FORUM_THREAD)."
-    WHERE thread_id NOT IN (
-        SELECT forum_id
-            FROM $tblWeeklyReport
-            WHERE
-                course_code = '$course_code' AND
-                id != '$id'
-    )";
-$rs = Database::fetch_object(Database::query($sql));
-$result_tareas = Database::query($sql_tasks);
-$result_forum = Database::query($sql_forum);
-
-echo '<div class="row">
-        <input type="hidden" id="rs_id" name ="rs_id" value="' . $id . '">
-        <div class="formw">' . get_lang('PleaseSelectTasks') . '</div>
-    </div>';
-echo '<div class="row"><div class="formw"><select name ="work_id" id="work_id">';
-echo '<option value="0"' . (($row['colid'] == $rs->work_id) ? "selected" : "") . '>' . get_lang('PleaseSelect') . '</option>';
-while ($row = Database::fetch_assoc($result_tasks)) {
-    echo '<option value="' . $row['colid'] . '"' . (($row['colid'] == $rs->work_id) ? "selected" : "") . '>' . $row['coltitle'] . '</option>';
-}
-echo '</select></div><div>';
-echo '<div class="row">
-        <div class="formw">' . get_lang('PleaseSelectThread') . '</div>
-    </div>';
-echo '<div class="row"><div class="formw"><select name ="forum_id" id="forum_id">';
-echo '<option value="0"' . (($row['colid'] == $rs->work_id) ? "forum_id" : "") . '>' . get_lang('PleaseSelect') . '</option>';
-while ($row = Database::fetch_assoc($result_forum)) {
-    echo '<option value="' . $row['colid'] . '"' . (($row['colid'] == $rs->forum_id) ? "selected" : "") . '>' . $row['coltitle'] . '</option>';
-}
-echo '</select></div><div>';
-echo '<div class="row">
-        <div class="formw">
-        <button class="save" name="edit" type="button" value="' . get_lang('Edit') . '" onClick="save(' . "$id" . ');">' .
-            get_lang('Edit') . '</button>
-        </div>
-    </div>';
-echo '</form>';

+ 0 - 158
plugin/ticket/src/categories.php

@@ -1,158 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * This script is the Tickets plugin main entry point
- * @package chamilo.plugin.ticket
- */
-
-$cidReset = true;
-// needed in order to load the plugin lang variables
-$course_plugin = 'ticket';
-require_once __DIR__.'/../config.php';
-
-$plugin = TicketPlugin::create();
-
-api_protect_admin_script(true);
-
-$toolName = $plugin->get_lang('Categories');
-
-$libPath = api_get_path(LIBRARY_PATH);
-$webLibPath = api_get_path(WEB_LIBRARY_PATH);
-
-$this_section = 'tickets';
-unset($_SESSION['this_section']);
-
-$table = new SortableTable(
-    'TicketCategories',
-    array('TicketManager', 'getCategoriesCount'),
-    array('TicketManager', 'getCategories'),
-    1
-);
-
-if ($table->per_page == 0) {
-    $table->per_page = 20;
-}
-
-$formToString = '';
-$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
-
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
-
-if (isset($_GET['action'])) {
-    global $table;
-    $action = $_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' => $plugin->get_lang('Categories'));
-            $url = api_get_self().'?action=add';
-            $form = TicketManager::getCategoryForm($url);
-            $formToString = $form->returnForm();
-            if ($form->validate()) {
-                $values =$form->getSubmitValues();
-
-                $params = [
-                    'name' => $values['name'],
-                    'description' => $values['description'],
-                    'total_tickets' => 0,
-                    'sys_insert_user_id' => api_get_user_id(),
-                    'sys_insert_datetime' => api_get_utc_datetime(),
-                    'category_id' => 0,
-                    'project_id' => 0,
-                    'course_required' => ''
-                ];
-                TicketManager::addCategory($params);
-
-                Display::addFlash(Display::return_message(get_lang('Added')));
-
-                header("Location: ".api_get_self());
-                exit;
-            }
-            break;
-        case 'edit':
-            $toolName = get_lang('Edit');
-            $interbreadcrumb[] = array('url' => 'categories.php', 'name' => $plugin->get_lang('Categories'));
-            $url = api_get_self().'?action=edit&id='.$id;
-            $form = TicketManager::getCategoryForm($url);
-
-            $cat = TicketManager::getCategory($_GET['id']);
-            $form->setDefaults($cat);
-            $formToString = $form->returnForm();
-            if ($form->validate()) {
-                $values =$form->getSubmitValues();
-
-                $params = [
-                    'name' => $values['name'],
-                    'description' => $values['description'],
-                    'sys_lastedit_datetime' => api_get_utc_datetime(),
-                    'sys_lastedit_user_id' => api_get_user_id()
-                ];
-                $cat = TicketManager::updateCategory($_GET['id'], $params);
-                Display::addFlash(Display::return_message(get_lang('Updated')));
-                header("Location: ".api_get_self());
-                exit;
-            }
-            break;
-        default:
-            break;
-    }
-}
-
-$user_id = api_get_user_id();
-$isAdmin = api_is_platform_admin();
-
-/**
- * Build the modify-column of the table
- * @param   int     The user id
- * @param   string  URL params to add to table links
- * @param   array   Row of elements to alter
- * @return string Some HTML-code with modify-buttons
- */
-function modify_filter($id, $params, $row)
-{
-    $result = Display::url(
-        Display::return_icon('edit.png', get_lang('Edit')),
-        "categories.php?action=edit&id={$row['id']}"
-    );
-
-    $result .= Display::url(
-        Display::return_icon('user.png', get_lang('AssignUser')),
-        "categories_add_user.php?id={$row['id']}"
-    );
-
-    $result .= Display::url(
-        Display::return_icon('delete.png', get_lang('Delete')),
-        "categories.php?action=delete&id={$row['id']}"
-    );
-
-	return $result;
-}
-
-$table->set_header(0, '', false);
-$table->set_header(1, $plugin->get_lang('Title'), false);
-$table->set_header(2, get_lang('Description'), true, array("style" => "width:200px"));
-$table->set_header(3, $plugin->get_lang('TotalTickets'), false);
-$table->set_header(4, get_lang('Actions'), true);
-$table->set_column_filter(4, 'modify_filter');
-
-Display::display_header($toolName);
-
-$items = [
-    [
-        'url' => 'categories.php?action=add',
-        'content' => Display::return_icon('new_folder.png', null, null, ICON_SIZE_MEDIUM)
-    ]
-];
-
-echo Display::actions($items);
-echo $formToString;
-echo $table->return_table();
-
-Display::display_footer();

+ 0 - 55
plugin/ticket/src/categories_add_user.php

@@ -1,55 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- *
- * @package chamilo.plugin.ticket
- */
-$cidReset = true;
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-api_protect_admin_script(true);
-
-$categoryId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
-$categoryInfo = TicketManager::getCategory($categoryId);
-
-if (empty($categoryInfo)) {
-    api_not_allowed(true);
-}
-
-$form = new FormValidator('edit', 'post', api_get_self().'?id='.$categoryId);
-$form->addHeader($categoryInfo['name']);
-$users = UserManager::get_user_list([], ['firstname']);
-$users = array_column($users, 'complete_name', 'user_id');
-
-$form->addElement(
-    'advmultiselect',
-    'users',
-    get_lang('Users'),
-    $users,
-    'style="width: 280px;"'
-);
-
-$usersAdded = TicketManager::getUsersInCategory($categoryId);
-if (!empty($usersAdded)) {
-    $usersAdded = array_column($usersAdded, 'user_id');
-}
-
-$form->setDefaults(['users' => $usersAdded]);
-// submit button
-$form->addButtonSave(get_lang('Save'));
-
-if ($form->validate()) {
-    $values = $form->exportValues();
-    TicketManager::deleteAllUserInCategory($categoryId);
-    TicketManager::addUsersToCategory($categoryId, $values['users']);
-    Display::addFlash(Display::return_message(get_lang('Updated')));
-    header("Location: ".api_get_self()."?id=".$categoryId);
-    exit;
-}
-
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
-$interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
-Display::display_header(get_lang('Users'));
-$form->display();

+ 0 - 43
plugin/ticket/src/course_user_list.php

@@ -1,43 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-$userId = intval($_GET['user_id']);
-$userInfo = api_get_user_info($userId);
-
-$coursesList = CourseManager::get_courses_list_by_user_id($userId, false, true);
-$arrCourseList = array(get_lang('Select'));
-//Course List
-foreach ($coursesList as $key => $course) {
-    $courseInfo = CourseManager::get_course_information($course['code']);
-    $arrCourseList[$courseInfo['code']] = $courseInfo['title'];
-}
-
-$userLabel = Display::tag('label', get_lang('User'), array('class' => 'control-label'));
-$personName = api_get_person_name($userInfo['firstname'], $userInfo['lastname']);
-$userInput = Display::tag(
-    'input',
-    '',
-    array(
-        'disabled' => 'disabled',
-        'type' => 'text',
-        'value' => $personName
-    )
-);
-$userControl = Display::div($userInput, array('class' => 'controls'));
-$courseLabel = Display::tag('label', get_lang('Course'), array('class' => 'control-label'));
-$courseSelect = Display::select('course_id', $arrCourseList, 0, array(), false);
-$courseControl = Display::div($courseSelect, array('class' => 'controls'));
-
-$userDiv = Display::div($userLabel . " " . $userControl, array('class' => 'control-group'));
-$courseDiv = Display::div($courseLabel . " " . $courseControl, array('class' => 'control-group'));
-
-echo $userDiv;
-echo $courseDiv;
-

+ 0 - 51
plugin/ticket/src/download.php

@@ -1,51 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-api_block_anonymous_users();
-$user_id = api_get_user_id();
-if (!isset($_GET['file']) || !isset($_GET['title']) || !isset($_GET['ticket_id'])) {
-    api_not_allowed();
-}
-
-if (!api_is_platform_admin()) {
-    $ticket_id = intval($_GET['ticket_id']);
-    $table_support_messages = Database::get_main_table(TABLE_TICKET_MESSAGE);
-    $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
-    $table_support_message_attachments = Database::get_main_table(TABLE_TICKET_MESSAGE_ATTACHMENTS);
-    $sql = "SELECT DISTINCT  ticket.request_user
-          FROM  $table_support_tickets ticket,
-                $table_support_messages message,
-                $table_support_message_attachments attch
-            WHERE ticket.ticket_id = message.ticket_id
-            AND attch.message_id = message.message_id
-            AND ticket.ticket_id = $ticket_id";
-    $rs = Database::query($sql);
-    $row_users = Database::fetch_array($rs, 'ASSOC');
-    $user_request_id = $row_users['request_user'];
-    if (intval($user_request_id) != $user_id) {
-        api_not_allowed();
-    }
-}
-
-// @todo replace by Security::check_abs_path()?
-$file_url = $_GET['file'];
-$file_url = str_replace('///', '&', $file_url);
-$file_url = str_replace(' ', '+', $file_url);
-$file_url = str_replace('/..', '', $file_url);
-$file_url = Database::escape_string($file_url);
-$title = $_GET['title'];
-$path_attachment = api_get_path(SYS_ARCHIVE_PATH);
-$path_message_attach = $path_attachment . 'plugin_ticket_messageattch/';
-$full_file_name = $path_message_attach . $file_url;
-if (Security::check_abs_path($full_file_name, $path_message_attach)) {
-    DocumentManager::file_send_for_download($full_file_name, true, $title);
-}
-
-exit;

+ 0 - 11
plugin/ticket/src/index.php

@@ -1,11 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Redirects to "myticket.php"
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-header('Location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php');
-exit;

+ 0 - 295
plugin/ticket/src/myticket.php

@@ -1,295 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * This script is the Tickets plugin main entry point
- * @package chamilo.plugin.ticket
- */
-
-$cidReset = true;
-// needed in order to load the plugin lang variables
-$course_plugin = 'ticket';
-require_once __DIR__.'/../config.php';
-
-api_block_anonymous_users();
-
-$plugin = TicketPlugin::create();
-$tool_name = $plugin->get_lang('LastEdit');
-
-$libPath = api_get_path(LIBRARY_PATH);
-$webLibPath = api_get_path(WEB_LIBRARY_PATH);
-$htmlHeadXtra[] = '<script>
-function load_history_ticket(div_course, ticket_id) {
-    $.ajax({
-        contentType: "application/x-www-form-urlencoded",
-        beforeSend: function(object) {
-        $("div#"+div_course).html("<img src=\'' . $webLibPath . 'javascript/indicator.gif\' />"); },
-        type: "POST",
-        url: "ticket_assign_log.php",
-        data: "ticket_id="+ticket_id,
-        success: function(data) {
-            $("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) {
-    $("div#"+div_course).html("&nbsp;");
-    $("div#"+div_course).hide("");
-}
-
-$(document).ready(function() {
-    $("#advanced_search_form").css("display","none");
-});
-
-function display_advanced_search_form() {
-    if ($("#advanced_search_form").css("display") == "none") {
-        $("#advanced_search_form").css("display","block");
-        $("#img_plus_and_minus").html(\'&nbsp;' . Display::return_icon('div_hide.gif', get_lang('Hide'), array('style' => 'vertical-align:middle')) . '&nbsp;' . get_lang('AdvancedSearch') . '\');
-    } else {
-        $("#advanced_search_form").css("display","none");
-        $("#img_plus_and_minus").html(\'&nbsp;' . Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')) . '&nbsp;' . get_lang('AdvancedSearch') . '\');
-    }
-}
-</script>';
-
-$this_section = 'tickets';
-unset($_SESSION['this_section']);
-
-$table = new SortableTable(
-    'Tickets',
-    array('TicketManager', 'get_total_tickets_by_user_id'),
-    array('TicketManager', 'get_tickets_by_user_id'),
-    2,
-    20,
-    'DESC'
-);
-
-if ($table->per_page == 0) {
-    $table->per_page = 20;
-}
-
-$action = isset($_GET['action']) ? $_GET['action'] : '';
-
-switch ($action) {
-    case 'assign':
-        if ($isAdmin && isset($_GET['ticket_id'])) {
-            TicketManager::assign_ticket_user($_GET['ticket_id'], $user_id);
-        }
-        break;
-    case 'unassign':
-        if ($isAdmin && isset($_GET['ticket_id'])) {
-            TicketManager::assign_ticket_user($_GET['ticket_id'], 0);
-        }
-        break;
-    case 'alert':
-        if (!$isAdmin && isset($_GET['ticket_id'])) {
-            TicketManager::send_alert($_GET['ticket_id'], $user_id);
-        }
-        break;
-    case 'export':
-        $data = array(
-            array(
-                $plugin->get_lang('TicketNum'),
-                $plugin->get_lang('Date'),
-                $plugin->get_lang('DateLastEdition'),
-                $plugin->get_lang('Category'),
-                $plugin->get_lang('User'),
-                $plugin->get_lang('Program'),
-                $plugin->get_lang('Responsible'),
-                $plugin->get_lang('Status'),
-                $plugin->get_lang('Description')
-            )
-        );
-        $datos = $table->get_clean_html();
-        foreach ($datos as $ticket) {
-            $ticket[0] = substr(strip_tags($ticket[0]), 0, 12);
-            $ticket_rem = array(
-                utf8_decode(strip_tags($ticket[0])),
-                utf8_decode(api_html_entity_decode($ticket[1])),
-                utf8_decode(strip_tags($ticket[2])),
-                utf8_decode(strip_tags($ticket[3])),
-                utf8_decode(strip_tags($ticket[4])),
-                utf8_decode(strip_tags($ticket[5])),
-                utf8_decode(strip_tags($ticket[6])),
-                utf8_decode(strip_tags($ticket[7])),
-                utf8_decode(strip_tags(str_replace('&nbsp;', ' ', $ticket[9])))
-            );
-            $data[] = $ticket_rem;
-        }
-        Export::arrayToXls($data, $plugin->get_lang('Tickets'));
-        exit;
-        break;
-    case 'close_tickets':
-        TicketManager::close_old_tickets();
-        break;
-    default:
-        break;
-}
-
-$user_id = api_get_user_id();
-$isAdmin = api_is_platform_admin();
-
-Display::display_header($plugin->get_lang('MyTickets'));
-
-if ($isAdmin) {
-    $getParameters = [
-        'keyword',
-        'keyword_status',
-        'keyword_category',
-        'keyword_request_user',
-        'keyword_admin',
-        'keyword_start_date',
-        'keyword_unread',
-        'Tickets_per_page',
-        'Tickets_column'
-    ];
-    $get_parameter = '';
-    foreach ($getParameters as $getParameter) {
-        if (isset($_GET[$getParameter])) {
-            $get_parameter .= "&$getParameter=".Security::remove_XSS($_GET[$getParameter]);
-        }
-    }
-
-    $getParameters = [
-        'Tickets_per_page',
-        'Tickets_column'
-    ];
-    $get_parameter2 = '';
-    foreach ($getParameters as $getParameter) {
-        if (isset($_GET[$getParameter])) {
-            $get_parameter2 .= "&$getParameter=".Security::remove_XSS($_GET[$getParameter]);
-        }
-    }
-
-    if (isset($_GET['submit_advanced'])) {
-        $get_parameter .= "&submit_advanced=";
-    }
-    if (isset($_GET['submit_simple'])) {
-        $get_parameter .= "&submit_simple=";
-    }
-
-    // Select categories
-    $selectTypes = [];
-    $types = TicketManager::get_all_tickets_categories();
-    foreach ($types as $type) {
-        $selectTypes[$type['category_id']] = $type['name'];
-    }
-
-    $admins = UserManager::get_user_list_like(array("status" => "1"), array("username"), true);
-    $selectAdmins = [
-        0 => $plugin->get_lang('Unassigned')
-    ];
-    foreach ($admins as $admin) {
-        $selectAdmins[$admin['user_id']] = $admin['complete_name'];
-    }
-    $status = TicketManager::get_all_tickets_status();
-    $selectStatus = [];
-    foreach ($status as $stat) {
-        $selectStatus[$stat['status_id']] = $stat['name'];
-    }
-
-    $selectPriority = [
-        '' => get_lang('All'),
-        TicketManager::PRIORITY_NORMAL => $plugin->get_lang('PriorityNormal'),
-        TicketManager::PRIORITY_HIGH => $plugin->get_lang('PriorityHigh'),
-        TicketManager::PRIORITY_LOW => $plugin->get_lang('PriorityLow')
-    ];
-
-    $selectStatusUnread = [
-        '' => get_lang('All'),
-        'yes' => $plugin->get_lang('Unread'),
-        'no' => $plugin->get_lang('Read')
-    ];
-
-    // Create a search-box
-    $form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
-    $form->addText('keyword', get_lang('Keyword'), 'size="25"');
-    $form->addButtonSearch(get_lang('Search'), 'submit_simple');
-    $form->addElement('static', 'search_advanced_link', null,
-            '<a href="javascript://" class = "advanced-parameters" onclick="display_advanced_search_form();">'
-            . '<span id="img_plus_and_minus">&nbsp;'
-            . Display::return_icon('div_show.gif', get_lang('Show')) . ' '
-            . get_lang('AdvancedSearch') . '</span></a>');
-
-    echo '<div class="actions" >';
-    if (api_is_platform_admin()) {
-        echo '<span class="left">' .
-                '<a href="' . api_get_path(WEB_PLUGIN_PATH) . 'ticket/src/new_ticket.php">' .
-                    Display::return_icon('add.png', $plugin->get_lang('TckNew'), '', ICON_SIZE_MEDIUM) . '</a>' .
-                '<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')) {
-            echo Display::url(
-                Display::return_icon('folder_document.gif'),
-                api_get_path(WEB_PLUGIN_PATH) . 'ticket/src/categories.php'
-            );
-        }
-
-        echo Display::url(
-            Display::return_icon('settings.png'),
-            api_get_path(WEB_CODE_PATH) . 'admin/configure_plugin.php?name=ticket'
-        );
-
-        echo '</span>';
-
-    }
-    $form->display();
-    echo '</div>';
-
-    $advancedSearchForm = new FormValidator(
-        'advanced_search',
-        'get',
-        api_get_self(),
-        null,
-        ['style' => 'display:"none"', 'id' => 'advanced_search_form']
-    );
-    $advancedSearchForm->addHeader(get_lang('AdvancedSearch'));
-    $advancedSearchForm->addSelect('keyword_category', get_lang('Category'), $selectTypes, ['placeholder' => get_lang('Select')]);
-    //$advancedSearchForm->addText('keyword_request_user', get_lang('User'), false);
-    $advancedSearchForm->addDateTimePicker('keyword_start_date_start', $plugin->get_lang('RegisterDate'));
-    $advancedSearchForm->addDateTimePicker('keyword_start_date_end', $plugin->get_lang('Untill'));
-    $advancedSearchForm->addSelect('keyword_admin', $plugin->get_lang('AssignedTo') , $selectAdmins, ['placeholder' => get_lang('All')]);
-    $advancedSearchForm->addSelect('keyword_status', get_lang('Status'), $selectStatus, ['placeholder' => get_lang('Select')]);
-    $advancedSearchForm->addSelect('keyword_priority', $plugin->get_lang('Priority'), $selectPriority, ['placeholder' => get_lang('All')]);
-    $advancedSearchForm->addSelect('keyword_unread', get_lang('Status'), $selectStatusUnread, ['placeholder' => get_lang('All')]);
-    $advancedSearchForm->addText('keyword_course', get_lang('Course'), false);
-    $advancedSearchForm->addButtonSearch(get_lang('AdvancedSearch'), 'submit_advanced');
-    $advancedSearchForm->display();
-} else {
-    if ($plugin->get('allow_student_add') == 'true') {
-        echo '<div class="actions" >';
-        echo '<span style="float:right;">' .
-                '<a href="' . api_get_path(WEB_PLUGIN_PATH) . 'ticket/src/new_ticket.php">' .
-                    Display::return_icon('add.png', $plugin->get_lang('TckNew'), '', '32') .
-                '</a>' .
-              '</span>';
-        echo '</div>';
-    }
-}
-
-if ($isAdmin) {
-    $table->set_header(0, $plugin->get_lang('TicketNum'), true);
-    $table->set_header(1, $plugin->get_lang('Date'), true);
-    $table->set_header(2, $plugin->get_lang('DateLastEdition'), true);
-    $table->set_header(3, $plugin->get_lang('Category'), true);
-    $table->set_header(4, $plugin->get_lang('CreatedBy'), true);
-    $table->set_header(5, $plugin->get_lang('AssignedTo'), true);
-    $table->set_header(6, $plugin->get_lang('Status'), true);
-    $table->set_header(7, $plugin->get_lang('Message'), true);
-} else {
-    echo '<center><h1>' . $plugin->get_lang('MyTickets') . '</h1></center>';
-    echo '<center><p>' . $plugin->get_lang('MsgWelcome') . '</p></center>';
-    if (isset($_GET['message'])) {
-        Display::display_confirmation_message($plugin->get_lang('TckSuccessSave'));
-    }
-    $table->set_header(0, $plugin->get_lang('TicketNum'), true);
-    $table->set_header(1, $plugin->get_lang('Date'), true);
-    $table->set_header(2, $plugin->get_lang('DateLastEdition'), true);
-    $table->set_header(3, $plugin->get_lang('Category'));
-    $table->set_header(4, $plugin->get_lang('Status'), false);
-}
-
-$table->display();
-Display::display_footer();

+ 0 - 596
plugin/ticket/src/new_ticket.php

@@ -1,596 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-$cidReset = true;
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-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;
-}
-
-api_block_anonymous_users();
-
-$htmlHeadXtra[] = '
-<script>
-function load_course_list (div_course, my_user_id, user_email) {
-    $.ajax({
-        contentType: "application/x-www-form-urlencoded",
-        type: "GET",
-        url: "course_user_list.php",
-        data: "user_id="+my_user_id,
-        success: function(datos) {
-            $("#user_request").html(datos);
-            $("#user_id_request").val(my_user_id);
-            $("#personal_email").val(user_email);
-            $("#btnsubmit").attr("disabled", false);
-        }
-    });
-}
-function changeType() {
-    var selected = document.getElementById("category_id").selectedIndex;
-    var id = $("#category_id").val();
-    $("#project_id").val(projects[id]);
-    $("#other_area").val(other_area[id]);
-    $("#email").val(email[id]);
-    if (parseInt(course_required[id]) == 0){
-        $("#divCourse").css("display", "none");
-        if( id != "CUR"){
-            $("#divEmail").css("display", "block");
-            $("#personal_email").attr("required","required");
-        }
-        $("#course_id").disabled = true;
-        $("#course_id").value = 0;
-    } else {
-        $("#divCourse").css("display", "block");
-        $("#course_id").prop("disabled", false);
-        $("#course_id").val(0);
-    }
-}
-function handleClick2(myRadio) {
-    var user_id = myRadio.value;
-    document.getElementById("user_id_request").value = user_id;
-    alert(document.getElementById("user_id_request").value);
-}
-function validate() {
-    var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
-    fckEditor1val = CKEDITOR.instances["content"].getData();
-    document.getElementById("content").value= fckEditor1val;
-    var selected = document.getElementById("category_id").selectedIndex;
-    var id = document.getElementById("category_id").options[selected].value;
-    if (id == 0) {
-        alert("' . $plugin->get_lang("ValidType") . '");
-        return false;
-    } else if(document.getElementById("subject").value == "") {
-        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;
-    } else if(id != "CUR" && parseInt(course_required[id]) != 1  && !re.test(document.getElementById("personal_email").value)) {
-        if (document.getElementById("personal_email").value != "") {
-            alert("' . $plugin->get_lang("ValidEmail") . '");
-            return false;
-        }
-    } else if(fckEditor1val == "") {
-        alert("' . $plugin->get_lang("ValidMessage") . '");
-        return false;
-    }
-}
-
-var counter_image = 1;
-
-function remove_image_form(element_id) {
-    $("#" + element_id).remove();
-    counter_image = counter_image - 1;
-    $("#link-more-attach").css("display", "block");
-}
-
-function add_image_form() {
-    // Multiple filepaths for image form
-    var filepaths = $("#filepaths");
-    var new_elem, input_file, link_remove, img_remove, new_filepath_id;
-
-    if ($("#filepath_"+counter_image)) {
-        counter_image = counter_image + 1;
-    }  else {
-        counter_image = counter_image;
-    }
-
-    new_elem = "filepath_"+counter_image;
-
-    $("<div/>", {
-        id: new_elem,
-        class: "controls"
-    }).appendTo(filepaths);
-
-    input_file = $("<input/>", {
-        type: "file",
-        name: "attach_" + counter_image,
-        size: 20
-    });
-
-    link_remove = $("<a/>", {
-        onclick: "remove_image_form(\'" + new_elem + "\')",
-        style: "cursor: pointer"
-    });
-
-    img_remove = $("<img/>", {
-        src: "' . Display::returnIconPath('delete.png') . '"
-    });
-
-    new_filepath_id = $("#filepath_" + counter_image);
-    new_filepath_id.append(input_file, link_remove.append(img_remove));
-
-    if (counter_image === 6) {
-        var link_attach = $("#link-more-attach");
-        if (link_attach) {
-            $(link_attach).css("display", "none");
-        }
-    }
-}
-</script>
-
-<style>
-div.row div.label2 {
-    float:left;
-    width:10%;
-}
-div.row div.formw2 {
-    width:90%;
-    float:left
-}
-div.divTicket {
-    padding-top: 100px;
-}
-</style>';
-$types = TicketManager::get_all_tickets_categories('category.name ASC');
-$htmlHeadXtra[] = '<script language="javascript">
-    var projects = ' . js_array($types, 'projects', 'project_id') . '
-    var course_required = ' . js_array($types, 'course_required', 'course_required') . '
-    var other_area = ' . js_array($types, 'other_area', 'other_area') . '
-    var email = ' . js_array($types, 'email', 'email') .
-'</script>';
-
-
-/**
- * @param $s
- * @return string
- */
-function js_str($s)
-{
-    return '"' . addcslashes($s, "\0..\37\"\\") . '"';
-}
-
-/**
- * @param $array
- * @param $name
- * @param $key
- * @return string
- */
-function js_array($array, $name, $key)
-{
-    $return = "new Array(); ";
-    foreach ($array as $value) {
-        $return .= $name . "['" . $value['category_id'] . "'] ='" . $value[$key] . "'; ";
-    }
-
-    return $return;
-}
-
-/**
- *
- */
-function show_form_send_ticket()
-{
-    global $types, $plugin;
-
-    // Category List
-    $categoryList = array();
-    foreach ($types as $type) {
-        $categoryList[$type['category_id']] = $type['name'].': '.$type['description'];
-    }
-
-    // Status List
-    $statusList = array();
-    $statusAttributes = array(
-        'style' => 'display: none;',
-        'id' => 'status_id',
-        'for' => 'status_id'
-    );
-
-    $statusList[TicketManager::STATUS_NEW] = $plugin->get_lang('StatusNew');
-    if (api_is_platform_admin()) {
-        $statusAttributes = array(
-            'id' => 'status_id',
-            'for' => 'status_id',
-            'style' => 'width: 562px;'
-        );
-        $statusList[TicketManager::STATUS_PENDING] = $plugin->get_lang('StatusPending');
-        $statusList[TicketManager::STATUS_UNCONFIRMED] = $plugin->get_lang('StatusUnconfirmed');
-        $statusList[TicketManager::STATUS_CLOSE] = $plugin->get_lang('StatusClose');
-        $statusList[TicketManager::STATUS_FORWARDED] = $plugin->get_lang('StatusForwarded');
-    }
-    //End Status List
-
-    // Source List
-    $sourceList = array();
-    $sourceAttributes = array(
-        'style' => 'display: none;',
-        'id' => 'source_id',
-        'for' => 'source_id'
-    );
-    $sourceList[TicketManager::SOURCE_PLATFORM] = $plugin->get_lang('SrcPlatform');
-    if (api_is_platform_admin()) {
-        $sourceAttributes = array(
-            'id' => 'source_id',
-            'for' => 'source_id',
-            'style' => 'width: 562px;'
-        );
-        $sourceList[TicketManager::SOURCE_EMAIL] = $plugin->get_lang('SrcEmail');
-        $sourceList[TicketManager::SOURCE_PHONE] = $plugin->get_lang('SrcPhone');
-        $sourceList[TicketManager::SOURCE_PRESENTIAL] = $plugin->get_lang('SrcPresential');
-    }
-
-    // Priority List
-    $priorityList = array();
-    $priorityList[TicketManager::PRIORITY_NORMAL] = $plugin->get_lang('PriorityNormal');
-    $priorityList[TicketManager::PRIORITY_HIGH] = $plugin->get_lang('PriorityHigh');
-    $priorityList[TicketManager::PRIORITY_LOW] = $plugin->get_lang('PriorityLow');
-
-    $form = new FormValidator(
-        'send_ticket',
-        'POST',
-        api_get_self(),
-        '',
-        array(
-            'enctype' => 'multipart/form-data',
-            'onsubmit' => 'return validate()'
-        )
-    );
-
-    $form->addElement(
-        'hidden',
-        'user_id_request',
-        '',
-        array(
-            'id' => 'user_id_request'
-        )
-    );
-
-    $form->addElement(
-        'hidden',
-        'project_id',
-        '',
-        array(
-            'id' => 'project_id'
-        )
-    );
-
-    $form->addElement(
-        'hidden',
-        'other_area',
-        '',
-        array(
-            'id' => 'other_area'
-        )
-    );
-
-    $form->addElement(
-        'hidden',
-        'email',
-        '',
-        array(
-            'id' => 'email'
-        )
-    );
-
-    $form->addElement(
-        'select',
-        'category_id',
-        get_lang('Category'),
-        $categoryList,
-        array(
-            'onchange' => 'changeType()',
-            'id' => 'category_id',
-            'for' => 'category_id',
-            'style' => 'width: 562px;'
-        )
-    );
-
-    $form->addElement(
-        'text',
-        'subject',
-        get_lang('Subject'),
-        array(
-            'id' => 'subject'
-        )
-    );
-
-    $form->addHtmlEditor(
-        'content',
-        get_lang('Message'),
-        false,
-        false,
-        array(
-            'ToolbarSet' => 'Profile',
-            'Height' => '250'
-        )
-    );
-
-    //if (api_is_platform_admin()) {
-        $form->addElement(
-            'SelectAjax',
-            'user_id',
-            get_lang('Assign'),
-            null,
-            ['url' => api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_like']
-        );
-    //}
-
-    $form->addElement(
-        'text',
-        'personal_email',
-        $plugin->get_lang('PersonalEmail'),
-        array(
-            'id' => 'personal_email'
-        )
-    );
-
-    $form->addLabel('',
-        Display::div(
-            '',
-            array(
-                'id' => 'user_request'
-            )
-        )
-    );
-
-    $form->addElement(
-        'select',
-        'status_id',
-        get_lang('Status'),
-        $statusList,
-        $statusAttributes
-    );
-
-    $form->addElement(
-        'select',
-        'priority_id',
-        $plugin->get_lang('Priority'),
-        $priorityList,
-        array(
-            'id' => 'priority_id',
-            'for' => 'priority_id'
-        )
-    );
-
-    $form->addElement(
-        'select',
-        'source_id',
-        $plugin->get_lang('Source'),
-        $sourceList,
-        $sourceAttributes
-    );
-
-    $form->addElement(
-        'text',
-        'phone',
-        get_lang('Phone') . ' (' . $plugin->get_lang('Optional') . ')',
-        array(
-            'id' => 'phone'
-        )
-    );
-
-    $form->addElement('file', 'attach_1', get_lang('FilesAttachment'));
-    $form->addLabel('', '<span id="filepaths"><div id="filepath_1"></div></span>');
-
-    $form->addLabel('',
-        '<span id="link-more-attach">
-         <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span>
-         </span>
-         ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')
-    ');
-
-    $form->addElement('html', '<br/>');
-    $form->addElement(
-        'button',
-        'compose',
-        get_lang('SendMessage'),
-        null,
-        null,
-        null,
-        'btn btn-primary',
-        array(
-            'id' => 'btnsubmit'
-        )
-    );
-
-    $form->display();
-}
-
-/**
- *
- */
-function save_ticket()
-{
-    global $plugin;
-    $category_id = $_POST['category_id'];
-    $content = $_POST['content'];
-    if ($_POST['phone'] != '') {
-        $content .= '<p style="color:red">&nbsp;' . get_lang('Phone') . ': ' . Security::remove_XSS($_POST['phone']). '</p>';
-    }
-    $course_id = isset($_POST['course_id']) ? $_POST['course_id'] : 0;
-    $project_id = $_POST['project_id'];
-    $subject = $_POST['subject'];
-    $other_area = (int) $_POST['other_area'];
-    $email = $_POST['email'];
-    $personal_email = $_POST['personal_email'];
-    $source = $_POST['source_id'];
-    $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : 0;
-    $priority = $_POST['priority_id'];
-    $status = $_POST['status_id'];
-    $file_attachments = $_FILES;
-
-    if (TicketManager::insert_new_ticket(
-        $category_id,
-        $course_id,
-        $project_id,
-        $other_area,
-        $email,
-        $subject,
-        $content,
-        $personal_email,
-        $file_attachments,
-        $source,
-        $priority,
-        $status,
-        $user_id
-    )) {
-        Display::addFlash(
-            Display::return_message($plugin->get_lang('TckSuccessSave'), 'success')
-        );
-        header('Location:' . api_get_path(WEB_PLUGIN_PATH) . PLUGIN_NAME . '/src/myticket.php');
-        exit;
-    } else {
-        Display::display_header(get_lang('ComposeMessage'));
-        Display::display_error_message($plugin->get_lang('ErrorRegisterMessage'));
-    }
-}
-
-/**
- * Get the total number of users on the platform
- * @return int  The number of users
- * @see SortableTable#get_total_number_of_items()
- */
-function get_number_of_users()
-{
-    $user_table = Database :: get_main_table(TABLE_MAIN_USER);
-    $sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
-    if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
-        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-        $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
-    }
-    if (isset($_GET['keyword'])) {
-        $keyword = Database::escape_string(trim($_GET['keyword']));
-        $sql .= " WHERE (u.firstname LIKE '%$keyword%' OR
-                  u.lastname LIKE '%$keyword%'  OR
-                  concat(u.firstname,' ',u.lastname) LIKE '%$keyword%'  OR
-                  concat(u.lastname,' ',u.firstname) LIKE '%$keyword%' OR
-                  u.username LIKE '%$keyword%' OR
-                  u.email LIKE '%$keyword%'  OR
-                  u.official_code LIKE '%$keyword%') ";
-    }
-    $res = Database::query($sql);
-    $obj = Database::fetch_object($res);
-
-    return $obj->total_number_of_items;
-}
-
-/**
- * Get the users to display on the current page (fill the sortable-table)
- * @param   int     offset of first user to recover
- * @param   int     Number of users to get
- * @param   int     Column to sort on
- * @param   string  Order (ASC,DESC)
- * @return  array   A list of users with their data
- * @see SortableTable#get_table_data($from)
- */
-function get_user_data($from, $number_of_items, $column, $direction)
-{
-    $user_table = Database :: get_main_table(TABLE_MAIN_USER);
-
-    if (api_is_western_name_order()) {
-        $col34 = "u.firstname AS col3,
-                  u.lastname AS col4,";
-    } else {
-        $col34 = "u.lastname AS col3,
-                  u.firstname AS col4,";
-    }
-
-    $sql = "SELECT
-                u.user_id AS col0,
-                u.official_code AS col2,
-                $col34
-                u.username AS col5,
-                u.email AS col6,
-                u.status AS col7,
-                u.active AS col8,
-                u.user_id AS col9 ,
-                u.expiration_date AS exp
-            FROM $user_table u ";
-
-    if (isset($_GET['keyword'])) {
-        $keyword = Database::escape_string(trim($_GET['keyword']));
-        $sql .= " WHERE (u.firstname LIKE '%$keyword%' OR
-                  u.lastname LIKE '%$keyword%' OR
-                  concat(u.firstname,' ',u.lastname) LIKE '%$keyword%' OR
-                  concat(u.lastname,' ',u.firstname) LIKE '%$keyword%' OR
-                  u.username LIKE '%$keyword%'  OR
-                  u.official_code LIKE '%$keyword%' OR
-                  u.email LIKE '%$keyword%' )";
-    }
-    if (!in_array($direction, array('ASC', 'DESC'))) {
-        $direction = 'ASC';
-    }
-    $column = intval($column);
-    $from = intval($from);
-    $number_of_items = intval($number_of_items);
-
-    $sql .= " ORDER BY col$column $direction ";
-    $sql .= " LIMIT $from, $number_of_items";
-
-    $res = Database::query($sql);
-
-    $users = array();
-    while ($user = Database::fetch_row($res)) {
-        $user_id = $user[0];
-        $userPicture = UserManager::getUserPicture($user_id);
-        $photo = '<img src="' . $userPicture. '" alt="' . api_get_person_name($user[2], $user[3]) . '" title="' . api_get_person_name($user[2], $user[3]) . '" />';
-        $button = '<a  href="javascript:void(0)" onclick="load_course_list(\'div_' . $user_id . '\',' . $user_id . ', \'' . $user[5] . '\')">'
-                    . Display::return_icon('view_more_stats.gif', get_lang('Info')) .
-                   '</a>&nbsp;&nbsp;';
-        $users[] = array(
-            $photo,
-            $user_id,
-            $user[2],
-            $user[3],
-            $user[4],
-            $user[5],
-            $button,
-        );
-    }
-
-    return $users;
-}
-
-
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
-
-if (!isset($_POST['compose'])) {
-    if (api_is_platform_admin()) {
-        Display::display_header(get_lang('ComposeMessage'));
-    } else {
-        $userInfo = api_get_user_info();
-        $htmlHeadXtra[] = "
-             <script>
-                $(document).ready(function(){
-                    load_course_list('div_{$userInfo['user_id']}', '{$userInfo['user_id']}', '{$userInfo['email']}');
-                });
-             </script>
-             ";
-        Display::display_header(get_lang('ComposeMessage'));
-    }
-    show_form_send_ticket();
-} else {
-    save_ticket();
-}
-
-Display::display_footer();

+ 0 - 324
plugin/ticket/src/report.php

@@ -1,324 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-$cidReset = true;
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-api_block_anonymous_users();
-
-if (!api_is_allowed_to_edit()) {
-    api_not_allowed();
-}
-
-$this_section = 'Reports';
-unset($_SESSION['this_section']);
-
-$htmlHeadXtra[] = '
-<script language="javascript">
-$(document).ready(function(){
-    $( "#keyword_start_date_start" ).datepicker({ dateFormat: ' . "'yy-mm-dd'" . ' });
-    $( "#keyword_start_date_end" ).datepicker({ dateFormat: ' . "'yy-mm-dd'" . ' });
-});
-
-function validate() {
-    if( $("#keyword_start_date_start").val() != "" &&  $("#keyword_start_date_end").val() != ""){
-        datestart = $("#keyword_start_date_start").val();
-        dateend = $("#keyword_start_date_end").val();
-        dif = $.datepicker.parseDate("dd/mm/yy", datestart) -  $.datepicker.parseDate("dd/mm/yy", dateend);
-        if(dif > 0){
-            alert("La fecha final no puede ser mayor a la fecha inicial");
-            return false;
-        }
-    }
-}
-
-function load_course_list (div_course,my_user_id) {
-	 $.ajax({
-		contentType: "application/x-www-form-urlencoded",
-		type: "GET",
-		url: "course_user_list.php",
-		data: "user_id="+my_user_id,
-		success: function(datos) {
-			$("div#user_request").html(datos);
-			$("#btnsubmit").attr("disabled", false);
-		}
-	});
-}
-</script>
-
-<style>
-div.row div.label2 {
-	float:left;
-	width:10%;
-}
-div.row div.formw2 {
-    width:90%;
-	float:left
-}
-div.ticket-form {
-    width: 70%;
-    float: center;
-    margin-left: 15%;
-
-}
-
-</style>';
-$types = TicketManager::get_all_tickets_categories();
-$tools = array();
-$tools['todas'] = array('id' => '', 'name' => get_lang('Todas'));
-$tools['announcement'] = array('id' => 'announcement', 'name' => get_lang('Announcement'));
-// $tools[]= array('id'=>'assignment','name'=>get_lang('Assignment'));
-$tools['calendar_event'] = array('id' => 'calendar_event', 'name' => get_lang('Calendar_event'));
-$tools['chat'] = array('id' => 'chat', 'name' => get_lang('Chat'));
-$tools['conference'] = array('id' => 'conference', 'name' => get_lang('Conference'));
-$tools['course_description'] = array('id' => 'course_description', 'name' => get_lang('Course_description'));
-$tools['document'] = array('id' => 'document', 'name' => get_lang('Document'));
-$tools['dropbox'] = array('id' => 'dropbox', 'name' => get_lang('Dropbox'));
-$tools['group'] = array('id' => 'group', 'name' => get_lang('Group'));
-$tools['learnpath'] = array('id' => 'learnpath', 'name' => get_lang('Learnpath'));
-$tools['link'] = array('id' => 'link', 'name' => get_lang('Link'));
-$tools['quiz'] = array('id' => 'quiz', 'name' => get_lang('Quiz'));
-$tools['student_publication'] = array('id' => 'student_publication', 'name' => get_lang('Student_publication'));
-$tools['user'] = array('id' => 'user', 'name' => get_lang('User'));
-$tools['forum'] = array('id' => 'forum', 'name' => get_lang('Forum'));
-
-/**
- * Returns the escaped string.
- * @param string $s
- * @return string
- */
-function js_str($s)
-{
-    return '"' . addcslashes($s, "\0..\37\"\\") . '"';
-}
-/**
- * This function is to show the ticket form
- * @global array $tools
- */
-function show_form()
-{
-    global $tools;
-    echo '<div class="ticket-form">';
-    echo '<form enctype="multipart/form-data" action="' . api_get_self() . '" method="post" name="send_ticket" id="send_ticket"
- 	onsubmit="return validate()" style="width:100%">';
-    $select_course = '<div id="user_request" >
-	 </div>';
-    echo $select_course;
-    //select status
-    $select_tool = '<div class="row"  >
-	<div class="label2"  >' . get_lang('Tool') .':</div>
-	<div class="formw2">';
-    $select_tool .= '<select style="width: 95%; " name = "tool" id="tool" >';
-
-    foreach ($tools as $tool) {
-        $select_tool .= "<option value = '" . $tool['id'] . "' selected >" . $tool['name'] . "</option>";
-    }
-    $select_tool .= "</select>";
-    $select_tool .= '</div></div>';
-    echo $select_tool;
-    echo '<div class="row">
-	      <div class="label2">' . get_lang('From') . ':</div>
-              <div class="formw2"><input id="keyword_start_date_start" name="keyword_start_date_start" type="text"></div>
-          </div>
-	  <div class="row">
-	      <div class="label2"> ' . get_lang('To') . '</div>
-	      <div class="formw2"><input id="keyword_start_date_end" name="keyword_start_date_end" type="text"></div>
-	  </div>';
-    echo '</div>';
-    echo '<div class="row">
-		<div class="label2">
-		</div>
-		<div class="formw2">
-			<button class="save" name="report" type="submit" id="btnsubmit" disabled="disabled">' . get_lang('CompleteReport') .'</button>
-		</div>
-	</div>';
-}
-
-/**
- * Get the total number of users on the platform
- * @see SortableTable#get_total_number_of_items()
- */
-function get_number_of_users()
-{
-    $user_table = Database :: get_main_table(TABLE_MAIN_USER);
-    $sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
-    if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
-        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-        $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
-    }
-    if (isset($_GET['keyword'])) {
-        $keyword = Database::escape_string(trim($_GET['keyword']));
-        $sql .= " WHERE (u.firstname LIKE '%$keyword%' OR
-                  u.lastname LIKE '%$keyword%'  OR
-                  concat(u.firstname,' ',u.lastname) LIKE '%$keyword%' OR
-                  concat(u.lastname,' ',u.firstname) LIKE '%$keyword%' OR
-                  u.username LIKE '%$keyword%' OR
-                  u.email LIKE '%$keyword %'  OR
-                  u.official_code LIKE '%$keyword%') ";
-    }
-    $res = Database::query($sql);
-    $obj = Database::fetch_object($res);
-    return $obj->total_number_of_items;
-}
-
-/**
- * Get the users to display on the current page (fill the sortable-table)
- * @param   int     offset of first user to recover
- * @param   int     Number of users to get
- * @param   int     Column to sort on
- * @param   string  Order (ASC,DESC)
- * @see SortableTable#get_table_data($from)
- */
-function get_user_data($from, $number_of_items, $column, $direction)
-{
-    $user_table = Database :: get_main_table(TABLE_MAIN_USER);
-
-    if (api_is_western_name_order()) {
-        $col34 = "u.firstname AS col3,
-                  u.lastname AS col4,";
-    } else {
-        $col34 = "u.lastname AS col3,
-                  u.firstname AS col4,";
-    }
-
-    $sql = "SELECT
-                 u.user_id AS col0,
-                 u.official_code AS col2,
-		        $col34
-                 u.username AS col5,
-                 u.email AS col6,
-                 u.status AS col7,
-                 u.active AS col8,
-                 u.user_id AS col9,
-              u.expiration_date AS exp
-           FROM $user_table u ";
-
-    if (isset($_GET['keyword'])) {
-        $keyword = Database::escape_string(trim($_GET['keyword']));
-        $sql .= " WHERE (u.firstname LIKE '%$keyword%' OR
-                  u.lastname LIKE '%$keyword%' OR
-                  concat(u.firstname,' ',u.lastname) LIKE '%$keyword%' OR
-                  concat(u.lastname,' ',u.firstname) LIKE '%$keyword%' OR
-                  u.username LIKE '%$keyword%'  OR
-                  u.official_code LIKE '%$keyword%'
-                  OR u.email LIKE '%$keyword%' )";
-    }
-    if (!in_array($direction, array('ASC', 'DESC'))) {
-        $direction = 'ASC';
-    }
-    $column = intval($column);
-    $from = intval($from);
-    $number_of_items = intval($number_of_items);
-
-    $sql .= " ORDER BY col$column $direction ";
-    $sql .= " LIMIT $from, $number_of_items";
-
-    $res = Database::query($sql);
-
-    $users = array();
-    $webPath = api_get_path(WEB_PATH);
-    while ($user = Database::fetch_row($res)) {
-        $userPicture = UserManager::getUserPicture($user[0]);
-        $photo = '<img src="' . $userPicture . '" alt="' . api_get_person_name($user[2], $user[3]) . '" title="' . api_get_person_name($user[2], $user[3]) . '" />';
-        $user_id = $user[0];
-        $button = '<a  href="javascript:void(0)" onclick="load_course_list(\'div_' . $user_id . '\',' . $user_id . ')">
-					<img onclick="load_course_list(\'div_' . $user_id . '\',' . $user_id . ')"  src="' . $webPath . 'img/view_more_stats.gif" title="' . get_lang('Courses') . '" alt="' . get_lang('Courses') . '"/>
-					</a>&nbsp;&nbsp;';
-        $users[] = array(
-            $photo,
-            $user[1],
-            $user[2],
-            $user[3],
-            $user[4],
-            $user[5],
-            $button,
-        );
-    }
-
-    return $users;
-}
-
-Display::display_header('Reports');
-echo '<div class="actions">
-    <form action="' . api_get_self() . '" method="get" name="search_simple" id="search_simple">
-        <input name="user_id_request" id="user_id_request" type="hidden" value="">
-        <span><label for="keyword">B&uacute;squeda del usuario: </label><input size="25" name="keyword" type="text" id="keyword"></span>
-        <span><button class="search" name="submit" type="submit">Buscar</button></span>
-        <div class="clear">&nbsp;</div>
-    </form></div>';
-if (isset($_GET['keyword'])) {
-    $table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() || api_sort_by_first_name()) ? 3 : 2);
-    $table->set_header(0, '', false, 'width="18px"');
-    $table->set_header(0, get_lang('Photo'), false);
-    $table->set_header(1, get_lang('OfficialCode'));
-    if (api_is_western_name_order()) {
-        $table->set_header(2, get_lang('FirstName'));
-        $table->set_header(3, get_lang('LastName'));
-    } else {
-        $table->set_header(2, get_lang('LastName'));
-        $table->set_header(3, get_lang('FirstName'));
-    }
-    $table->set_header(4, get_lang('LoginName'));
-    $table->set_header(5, get_lang('Email'));
-    $table->set_header(6, get_lang('Action'));
-    $table->display();
-}
-
-if (isset($_POST['report'])) {
-    $course_info = api_get_course_info_by_id($course_id);
-    $course_id = Database::escape_string($_POST['course_id']);
-    $tool = Database::escape_string($_POST['tool']);
-    $user_id = intval($_POST['user_id_request']);
-
-    $sql = "SELECT
-                u.username , CONCAT(u.lastname, ' ', u.firstname) AS fullname,
-                DATE_SUB(access.access_date,INTERVAL 5 HOUR) AS  access_date,
-                c.title AS course, access_tool AS tool
-            FROM  " . Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS) . " access
-            LEFT JOIN  " . Database::get_main_table(TABLE_MAIN_USER) . " u ON access.access_user_id = u.user_id
-            LEFT JOIN  " . Database::get_main_table(TABLE_MAIN_COURSE) . " c ON access.c_id = c.id
-            WHERE access.c_id = " . $course_info['real_id'] . " AND u.user_id = $user_id ";
-    if ($tool != '') {
-        $sql.="AND access.access_tool = '$tool' ";
-    }
-
-    $start_date = Database::escape_string($_POST['keyword_start_date_start']);
-    $end_date = Database::escape_string($_POST['keyword_start_date_end']);
-
-    if ($start_date != '' || $end_date != '') {
-        $sql .= " HAVING ";
-        if ($start_date != '')
-            $sql .= "  access_date >= '$start_date'   ";
-        if ($end_date != '') {
-            $sql = ($start_date == '') ? $sql : ($sql . " AND ");
-            $sql .= "  access_date <= '$end_date'   ";
-        }
-    }
-    $result = Database::query($sql);
-    $table_result = new SortableTable();
-    $table_result->set_header(0, get_lang('User'), false);
-    $table_result->set_header(1, get_lang('Fullname'), false);
-    $table_result->set_header(2, get_lang('Date'), false);
-    $table_result->set_header(3, get_lang('Course'), false);
-    $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'])
-        );
-        $table_result->addRow($row);
-    }
-    $table_result->display();
-} else {
-    show_form();
-}
-
-Display::display_footer();

+ 0 - 38
plugin/ticket/src/ticket_assign_log.php

@@ -1,38 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-
-$plugin = TicketPlugin::create();
-
-$ticket_id = intval($_POST['ticket_id']);
-$history = TicketManager::get_assign_log($ticket_id);
-?>
-<table width="350px" border="0" cellspacing="2" cellpadding="2">
-    <?php
-    if (count($history) == 0) {
-        ?>
-        <tr>
-            <td colspan="2"><?php echo api_ucfirst(('Sin Historial')); ?></td>
-        </tr>
-        <?php
-    }
-    ?>
-    <?php for ($k = 0; $k < count($history); $k++) { ?>
-        <tr>
-            <td width="125px">
-                <?php echo api_convert_encoding($history[$k]['assignuser'], 'UTF-8', $charset); ?>
-            </td>
-            <td width="100px">
-                <?php echo api_convert_encoding($history[$k]['assigned_date'], 'UTF-8', $charset); ?>
-            </td>
-            <td width="125px">
-                <?php echo api_convert_encoding($history[$k]['insertuser'], 'UTF-8', $charset); ?>
-            </td>
-        </tr>
-    <?php } ?>
-</table>

+ 0 - 577
plugin/ticket/src/ticket_details.php

@@ -1,577 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- *
- * @package chamilo.plugin.ticket
- */
-$cidReset = true;
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-api_block_anonymous_users();
-
-$user_id = api_get_user_id();
-$isAdmin = api_is_platform_admin();
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
-$interbreadcrumb[] = array('url' => '#', 'name' => $plugin->get_lang('TicketDetail'));
-
-$disableReponseButtons = '';
-/*if ($isAdmin) {
-    $disableReponseButtons = "$('#responseyes').attr('disabled', 'disabled');
-                              $('#responseno').attr('disabled', 'disabled');";
-}*/
-
-$htmlHeadXtra[] = '<script>
-$(document).ready(function() {
-	$("#dialog-form").dialog({
-		autoOpen: false,
-		height: 450,
-		width: 600,
-		modal: true,
-		buttons: {
-            ' . get_lang('Accept') . ': function(){
-                $("#frmResponsable").submit()
-            },
-            ' . ucfirst(get_lang('Close')) . ': function() {
-                $(this).dialog("close");
-            }
-            }
-        });
-
-        $("a#assign").click(function () {
-            $( "#dialog-form" ).dialog( "open" );
-        });
-
-        $(".responseyes").click(function () {
-            if(!confirm("' . $plugin->get_lang('AreYouSure') . ' : ' . strtoupper(get_lang('Yes')) . '. ' . $plugin->get_lang('IfYouAreSureTheTicketWillBeClosed') . '")){
-                return false;
-            }
-        });
-
-        $("input#responseno").click(function () {
-            if(!confirm("' . $plugin->get_lang('AreYouSure') . ' : ' . strtoupper(get_lang('No')) . '")){
-                return false;
-            }
-        });
-
-        $("#unassign").click(function () {
-            if (!confirm("' . $plugin->get_lang('AreYouSureYouWantToUnassignTheTicket') . '")) {
-                return false;
-            }
-        });
-
-        $("#close").click(function () {
-            if (!confirm("' . $plugin->get_lang('AreYouSureYouWantToCloseTheTicket') . '")) {
-                return false;
-            }
-        });
-        '.$disableReponseButtons.'
-});
-
-function validate() {
-    fckEditor1val = CKEDITOR.instances["content"].getData();
-    document.getElementById("content").value= fckEditor1val;
-    if(fckEditor1val == ""){
-        alert("' . $plugin->get_lang('YouMustWriteAMessage') . '");
-        return false;
-    }
-}
-
-var counter_image = 1;
-
-function remove_image_form(element_id) {
-    $("#" + element_id).remove();
-    counter_image = counter_image - 1;
-    $("#link-more-attach").css("display", "block");
-}
-
-function add_image_form() {
-    // Multiple filepaths for image form
-    var filepaths = $("#filepaths");
-    var new_elem, input_file, link_remove, img_remove, new_filepath_id;
-
-    if ($("#filepath_"+counter_image)) {
-        counter_image = counter_image + 1;
-    }  else {
-        counter_image = counter_image;
-    }
-
-    new_elem = "filepath_"+counter_image;
-
-    $("<div/>", {
-        id: new_elem,
-        class: "controls"
-    }).appendTo(filepaths);
-
-    input_file = $("<input/>", {
-        type: "file",
-        name: "attach_" + counter_image,
-        size: 20
-    });
-
-    link_remove = $("<a/>", {
-        onclick: "remove_image_form(\'" + new_elem + "\')",
-        style: "cursor: pointer"
-    });
-
-    img_remove = $("<img/>", {
-        src: "' . Display::returnIconPath('delete.png').'"
-    });
-
-    new_filepath_id = $("#filepath_" + counter_image);
-    new_filepath_id.append(input_file, link_remove.append(img_remove));
-
-    if (counter_image === 6) {
-        var link_attach = $("#link-more-attach");
-        if (link_attach) {
-            $(link_attach).css("display", "none");
-        }
-    }
-}
-</script>';
-
-$htmlHeadXtra[] = '<style>
-div.row div.label2 {
-	float:left;
-	text-align: right;
-	width:22%;
-}
-div.row div.formw2 {
-    width:50%;
-	margin-left: 2%;
-	margin-right: 16%;
-	float:left;
-}
-.messageuser, .messagesupport {
-    border: 1px solid;
-    margin: 10px 0px;
-    padding:15px 10px 15px 50px;
-    background-repeat: no-repeat;
-    background-position: 10px center;
-    width:50%;
-	behavior: url(/pie/PIE.htc);
-}
-.messageuser {
-    color: #00529B;
-    -moz-border-radius: 15px 15px 15px 15px;
-    -webkit-border-radius: 15px 15px 15px 15px;
-    background-color: #BDE5F8;
-    margin-left:20%;
-    border-radius:15px;
-    float: left;
-}
-.messagesupport {
-    color: #4F8A10;
-    -moz-border-radius: 15px 15px 15px 15px;
-    -webkit-border-radius: 15px 15px 15px 15px;
-    background-color: #DFF2BF;
-    margin-right: 20%;
-    float: right;
-    border-radius:15px;
-}
-.attachment-link {
-    margin: 12px;
-}
-#link-more-attach {
-    color: white;
-    cursor: pointer;
-    width: 120px;
-}
-</style>';
-
-$ticket_id = $_GET['ticket_id'];
-$ticket = TicketManager::get_ticket_detail_by_id($ticket_id, $user_id);
-if (!isset($ticket['ticket'])) {
-    api_not_allowed();
-}
-if (!isset($_GET['ticket_id'])) {
-    header('location:myticket.php');
-    exit;
-}
-if (isset($_POST['response'])) {
-    if ($user_id == $ticket['ticket']['request_user']) {
-        $response = ($_POST['response'] == "1") ? true : ($_POST['response'] == "0" ? false : null);
-        if ($response && $ticket['ticket']['status_id'] == TicketManager::STATUS_UNCONFIRMED) {
-            TicketManager::close_ticket($_GET['ticket_id'], $user_id);
-            $ticket['ticket']['status_id'] = TicketManager::STATUS_CLOSE;
-            $ticket['ticket']['status'] = $plugin->get_lang('Closed');
-        } else if (!is_null($response) && $ticket['ticket']['status_id'] == TicketManager::STATUS_UNCONFIRMED) {
-            TicketManager::update_ticket_status(TicketManager::STATUS_PENDING, $_GET['ticket_id'], $user_id);
-            $ticket['ticket']['status_id'] = TicketManager::STATUS_PENDING;
-            $ticket['ticket']['status'] = $plugin->get_lang('StatusPending');
-        }
-    }
-}
-if (isset($_REQUEST['action'])) {
-    $action = $_REQUEST['action'];
-    switch ($action) {
-        case 'assign':
-            if (api_is_platform_admin() && isset($_GET['ticket_id'])) {
-                TicketManager::assign_ticket_user($_GET['ticket_id'], $_POST['admins']);
-            }
-            Display::addFlash(Display::return_message(get_lang('Updated')));
-            header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id);
-            exit;
-            break;
-        case 'unassign':
-            if (api_is_platform_admin() && isset($_GET['ticket_id'])) {
-                TicketManager::assign_ticket_user($_GET['ticket_id'], 0);
-            }
-            Display::addFlash(Display::return_message(get_lang('Updated')));
-            header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id);
-            exit;
-            break;
-        default:
-            break;
-    }
-}
-
-$title = 'Ticket #' . $ticket['ticket']['ticket_code'];
-
-if (!isset($_POST['compose'])) {
-    if (isset($_REQUEST['close'])) {
-        TicketManager::close_ticket($_REQUEST['ticket_id'], $user_id);
-        $ticket['ticket']['status_id'] = TicketManager::STATUS_CLOSE;
-        $ticket['ticket']['status'] = $plugin->get_lang('Closed');
-    }
-    /*$ticket['ticket']['request_user'] = intval($ticket['ticket']['request_user']);
-    if ($ticket['ticket']['request_user'] == $user_id || intval($ticket['ticket']['assigned_last_user']) == $user_id) {
-        TicketManager::update_message_status($ticket_id, $ticket['ticket']['request_user']);
-    }*/
-    Display::display_header();
-    $form_close_ticket = '';
-        if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
-            $ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE &&
-            $isAdmin
-        ) {
-        if (intval($ticket['ticket']['assigned_last_user']) == $user_id) {
-            if ($ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE) {
-                $form_close_ticket.= '<a href="' . api_get_self() . '?close=1&ticket_id=' . $ticket['ticket']['ticket_id'] . '" id="close" class="btn btn-danger" >';
-                $form_close_ticket.= get_lang('Close') . '</a>';
-            }
-        }
-    }
-
-    $img_assing = '';
-    if (empty($ticket['ticket']['assigned_last_user'])) {
-        $img_assing = '<a href="#" id="assign" class="btn btn-success">'.get_lang('Assign').'</a>';
-    } else {
-        if ($isAdmin) {
-            $img_assing = '<a class="btn btn-warning" href="#" id="assign">
-                   '.get_lang('ChangeAssign').'
-                   </a>';
-        }
-    }
-    $bold = '';
-
-    if ($ticket['ticket']['status_id'] == TicketManager::STATUS_CLOSE) {
-        $bold = 'style = "font-weight: bold;"';
-        echo "<style>
-                #confirmticket {
-                    display: none;
-                }
-              </style>";
-    }
-    if ($isAdmin) {
-        $senderData = get_lang('AddedBy'). ' '.$ticket['ticket']['user_url'].' (' . $ticket['usuario']['username'] . ').';
-    } else {
-        $senderData = get_lang('AddedBy'). ' '.$ticket['usuario']['complete_name'].' (' . $ticket['usuario']['username']. ').';
-    }
-
-    echo '
-			<table width="100%" >
-				<tr>
-	              <td colspan="3">
-	              <h1>'.$title.' '.$form_close_ticket.' '.$img_assing.' </h1>
-	              <h2>'.$ticket['ticket']['subject'].'</h2>
-	              <p>
-	                '.$senderData.' ' .
-                    get_lang('Created') . ' '.
-                    Display::url(
-                        date_to_str_ago($ticket['ticket']['start_date_from_db']),
-                        '#',
-                        ['title' => $ticket['ticket']['start_date'], 'class' => 'boot-tooltip']
-                    ).'. '.
-                    $plugin->get_lang('TicketUpdated').' '.
-                    Display::url(
-                        date_to_str_ago($ticket['ticket']['sys_lastedit_datetime_from_db']),
-                        '#',
-                        ['title' => $ticket['ticket']['sys_lastedit_datetime'], 'class' => 'boot-tooltip']
-                    ).'
-	              </p>
-	              </td>
-	            </tr>
-	            <tr>
-	               <td><p><b>' . get_lang('Category') . ': </b>' . $ticket['ticket']['name'] . '</p></td>
-	            </tr>
-	            <tr>
-	               <td><p ' . $bold . '><b>' . get_lang('Status') . ':</b> ' . $ticket['ticket']['status'] . '</p></td>
-	            </tr>
-	            <tr>
-	                <td><p><b>' . $plugin->get_lang('Priority') . ': </b>' . $ticket['ticket']['priority'] . '<p></td>
-	            </tr>';
-
-    if (!empty($ticket['ticket']['assigned_last_user'])) {
-        $assignedUser = api_get_user_info($ticket['ticket']['assigned_last_user']);
-        echo '<tr>
-                <td><p><b>' . $plugin->get_lang('AssignedTo') . ': </b>' . $assignedUser['complete_name'] . '<p></td>
-            </tr>';
-    } else {
-        echo '<tr>
-                <td><p><b>' . $plugin->get_lang('AssignedTo') . ': </b>-<p></td>
-            </tr>';
-    }
-    if ($ticket['ticket']['course_url'] != null) {
-        echo '<tr>
-				<td><p>' . get_lang('Course') . ':</p></td>
-	            <td></td>
-			    <td>' . $ticket['ticket']['course_url'] . '</td>
-	            <td colspan="2"></td>
-	          </tr>';
-    }
-    echo '<tr>
-            <td>
-            <hr />
-            <b>' . get_lang('Description') . ':</b> <br />
-            '.$ticket['ticket']['message'].'
-            <hr />
-            </td>            
-         </tr>
-        ';
-
-    // Select admins
-    $select_admins = '<select  class ="chzn-select" style="width: 350px; " name = "admins" id="admins" ">';
-
-    $admins = UserManager::get_user_list_like(
-        array('status' => COURSEMANAGER), array('username'),
-        true
-    );
-
-    $select_admins .= '<option value="" >'.get_lang('None').'</option>';
-
-    foreach ($admins as $admin) {
-        $select_admins.= "<option value = '" . $admin['user_id'] . "' " . (($user_id == $admin['user_id']) ? ("selected='selected'") : '') . ">" .
-           $admin['complete_name'] . "</option>";
-    }
-    $select_admins .= "</select>";
-    echo '<div id="dialog-form" title="' . $plugin->get_lang('AssignTicket') . '" >';
-    echo '<form id="frmResponsable" method="POST" action="ticket_details.php?ticket_id=' . $ticket['ticket']['ticket_id'] . '">
-			<input type="hidden" name ="action" id="action" value="assign"/>
-			<div>
-				<div class="label">' . get_lang('Responsable') . ':</div>
-				<div class="formw">' . $select_admins . '</div>
-			</div>
-		  </form>';
-    echo '</div>';
-    echo '</table>';
-    $messages = $ticket['messages'];
-
-    $logs = TicketManager::get_assign_log($ticket_id);
-    $counter = 1;
-    foreach ($messages as $message) {
-        $date = Display::url(
-            date_to_str_ago($message['sys_insert_datetime']),
-            '#',
-            ['title' => api_get_local_time($message['sys_insert_datetime']), 'class' => 'boot-tooltip']
-        );
-
-        $receivedMessage = '';
-        if (!empty($message['subject'])) {
-            $receivedMessage = '<b>'.get_lang('Subject') . ': </b> '.$message['subject'].'<br/>';
-        }
-        $receivedMessage = '<b>'.get_lang('Message') . ':</b><br/>'.$message['message'].'<br/>';
-
-        $attachmentLinks = '';
-        if (isset($message['attachments'])) {
-            $attributeClass = array(
-                'class' => 'attachment-link'
-            );
-            foreach ($message['attachments'] as $attach) {
-                $attachmentLinks .= Display::tag('div', $attach['attachment_link'], $attributeClass);
-            }
-        }
-
-        $entireMessage = $receivedMessage . $attachmentLinks;
-        $counterLink = Display::url('#'.$counter, api_get_self().'?ticket_id='.$ticket_id.'#note-'.$counter);
-        echo '<a id="note-'.$counter.'"> </a><h4>' . sprintf($plugin->get_lang('UpdatedByX'), $message['user_created']).' '.$date.
-            ' <span class="pull-right">'.$counterLink.'</span></h4>';
-        echo Display::div(
-            $entireMessage, ['class' => 'well']
-        );
-        $counter++;
-    }
-
-    $subject = get_lang('ReplyShort') .': '.$ticket['ticket']['subject'];
-
-    if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
-        $ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE
-    ) {
-        if (!$isAdmin && $ticket['ticket']['status_id'] != TicketManager::STATUS_UNCONFIRMED) {
-            show_form_send_message($ticket['ticket']);
-        } else {
-            if (
-                $ticket['ticket']['assigned_last_user'] == $user_id ||
-                $ticket['ticket']['sys_insert_user_id'] == $user_id ||
-                $isAdmin
-            ) {
-                show_form_send_message($ticket['ticket']);
-            }
-        }
-    }
-
-    Display::display_footer();
-} else {
-    $ticket_id = $_POST['ticket_id'];
-    $content = $_POST['content'];
-    $subject = $_POST['subject'];
-    $message = isset($_POST['confirmation']) ? true : false;
-    $file_attachments = $_FILES;
-    $user_id = api_get_user_id();
-
-    TicketManager::insert_message(
-        $ticket_id,
-        $subject,
-        $content,
-        $file_attachments,
-        $user_id,
-        'NOL',
-        $message
-    );
-
-    if ($isAdmin) {
-        TicketManager::updateTicket(
-            [
-                'priority_id' => $_POST['priority_id'],
-                'status_id' => $_POST['status_id']
-            ],
-            $ticket_id,
-            api_get_user_id()
-        );
-    }
-    Display::addFlash(Display::return_message(get_lang('Saved')));
-    header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id);
-    exit;
-}
-
-/**
- * @param array $ticket
- */
-function show_form_send_message($ticket)
-{
-    global $isAdmin;
-    global $subject;
-    global $plugin;
-
-    $form = new FormValidator(
-        'send_ticket',
-        'POST',
-        api_get_self() . '?ticket_id=' . $ticket['ticket_id'],
-        '',
-        array(
-            'enctype' => 'multipart/form-data',
-            'onsubmit' => 'return validate()',
-            'class' => 'form-horizontal'
-        )
-    );
-
-    if ($isAdmin) {
-        $statusList[TicketManager::STATUS_NEW] = $plugin->get_lang('StatusNew');
-        $statusAttributes = array(
-            'id' => 'status_id',
-            'for' => 'status_id',
-            'style' => 'width: 562px;'
-        );
-        $statusList[TicketManager::STATUS_PENDING] = $plugin->get_lang('StatusPending');
-        $statusList[TicketManager::STATUS_UNCONFIRMED] = $plugin->get_lang('StatusUnconfirmed');
-        $statusList[TicketManager::STATUS_CLOSE] = $plugin->get_lang('StatusClose');
-        $statusList[TicketManager::STATUS_FORWARDED] = $plugin->get_lang('StatusForwarded');
-
-        $form->addElement(
-            'select',
-            'status_id',
-            get_lang('Status'),
-            $statusList,
-            $statusAttributes
-        );
-
-        $priorityList = array();
-        $priorityList[TicketManager::PRIORITY_NORMAL] = $plugin->get_lang('PriorityNormal');
-        $priorityList[TicketManager::PRIORITY_HIGH] = $plugin->get_lang('PriorityHigh');
-        $priorityList[TicketManager::PRIORITY_LOW] = $plugin->get_lang('PriorityLow');
-
-        $form->addElement(
-            'select',
-            'priority_id',
-            $plugin->get_lang('Priority'),
-            $priorityList,
-            array(
-                'id' => 'priority_id',
-                'for' => 'priority_id'
-            )
-        );
-
-        $form->setDefaults(
-            [
-                'priority_id' =>  $ticket['priority_id'],
-                'status_id' =>  $ticket['status_id'],
-            ]
-        );
-    }
-
-    $form->addElement(
-        'text',
-        'subject',
-        get_lang('Subject'),
-        array(
-            'for' => 'subject',
-            'value' => $subject,
-            'style' => 'width: 540px;'
-        )
-    );
-
-    $form->addElement('hidden', 'ticket_id', $ticket['ticket_id']);
-
-    $form->addHtmlEditor(
-        'content',
-        get_lang('Message'),
-        false,
-        false,
-        array(
-            'ToolbarSet' => 'Profile',
-            'Width' => '550',
-            'Height' => '250'
-        )
-    );
-
-    if ($isAdmin) {
-        $form->addElement(
-            'checkbox',
-            'confirmation',
-             null,
-            $plugin->get_lang('RequestConfirmation')
-        );
-    }
-
-    $form->addElement('file', 'attach_1', get_lang('FilesAttachment'));
-    $form->addLabel('', '<span id="filepaths"><div id="filepath_1"></div></span>');
-    $form->addLabel('',
-        '<span id="link-more-attach">
-         <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span>
-         </span>
-         ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')
-    ');
-
-    $form->addElement('html', '<br/>');
-    $form->addElement(
-        'button',
-        'compose',
-        get_lang('SendMessage'),
-        null,
-        null,
-        null,
-        'btn btn-primary'
-    );
-
-    $form->display();
-}

+ 0 - 107
plugin/ticket/src/tutor.php

@@ -1,107 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-require_once __DIR__.'/tutor_report.lib.php';
-
-$htmlHeadXtra[] = '
-	<script type="text/javascript">
-$(document).ready(function (){
-    $(".ajax").click(function() {
-        var url     = this.href;
-        var dialog  = $("#dialog");
-        if ($("#dialog").length == 0) {
-                dialog  = $("' . '<div id="dialog" style="display:hidden"></div>' . '").appendTo("body");
-        }
-
-        // load remote content
-        dialog.load(
-            url,
-            {},
-            function(responseText, textStatus, XMLHttpRequest) {
-                dialog.dialog({
-                        modal	: true,
-                        width	: 540,
-                        height	: 400
-                });
-            }
-        );
-        //prevent the browser to follow the link
-        return false;
-    });
-});
-
-
-function showContent(div){
-	if($("div#"+div).attr("class")=="blackboard_hide"){
-		$("div#"+div).attr("class","blackboard_show");
-		$("div#"+div).attr("style","");
-	}else{
-		$("div#"+div).attr("class","blackboard_hide");
-		$("div#"+div).attr("style","");
-	}
-
-}
-
-function save() {
-	work_id = $("#work_id").val();
-	forum_id = $("#forum_id").val();
-	rs_id = $("#rs_id").val();
-	 $.ajax({
-		contentType: "application/x-www-form-urlencoded",
-		beforeSend: function(objeto) {
-		$("div#confirmation").html("<img src=\"' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/indicator.gif\" />"); },
-		type: "POST",
-		url: "update_report.php",
-		data: "work_id="+work_id+"&forum_id="+forum_id+"&rs_id="+rs_id,
-		success: function(data) {
-			$("div#confirmation").html(data);
-			 location.reload();
-		}
-	});
-}
-</script>
-<style>
-.blackboard_show {
-	float:left;
-	position:absolute;
-	border:1px solid black;
-	width: 350px;
-	background-color:white;
-	z-index:99; padding: 3px;
-	display: inline;
-}
-.blackboard_hide {
-	display: none;
-}
-.reports{
-	border:1px ;
-}
-.reports th {
-    border-bottom: 1px solid #DDDDDD;
-    line-height: normal;
-    text-align: center;
-    vertical-align: middle;
-    background-color: #F2F2F2;
-}
-</style>';
-
-$course_code = api_get_course_id();
-$results = initializeReport($course_code);
-if (isset($_GET['action'])) {
-    Export::arrayToXls($results['export'], "COURSE_USER_REPORT" . $course_code);
-} else {
-    Display::display_header();
-    api_protect_course_script();
-    if (!api_is_allowed_to_edit()) {
-        api_not_allowed();
-    }
-    echo $results['show'];
-    Display::display_footer();
-}

+ 0 - 219
plugin/ticket/src/tutor_report.lib.php

@@ -1,219 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Helper library for weekly reports
- * @package chamilo.plugin.ticket
- */
-
-/**
- * @param $course_code
- * @return array|bool
- */
-function initializeReport($course_code)
-{
-    $course_info = api_get_course_info($course_code);
-    $table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
-    $table_students_report = Database::get_main_table('rp_students_report');
-    $table_semanas_curso = Database::get_main_table('rp_semanas_curso');
-    $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
-    $table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-    $table_post = Database::get_course_table(TABLE_FORUM_POST);
-    $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
-    $course_code = Database::escape_string($course_code);
-    $res = Database::query("SELECT COUNT(*) as cant FROM $table_reporte_semanas WHERE course_code = '" . $course_code . "'");
-    $sqlWeeks = "SELECT semanas FROM $table_semanas_curso WHERE course_code = '$course_code'";
-    $resWeeks = Database::query($sqlWeeks);
-    $weeks = Database::fetch_object($resWeeks);
-    $obj = Database::fetch_object($res);
-    $weeksCount = (!isset($_POST['weeksNumber'])) ? (($weeks->semanas == 0) ? 7 : $weeks->semanas) : $_POST['weeksNumber'];
-    $weeksCount = Database::escape_string($weeksCount);
-    Database::query("REPLACE INTO $table_semanas_curso (course_code , semanas) VALUES ('$course_code','$weeksCount')");
-    if (intval($obj->cant) != $weeksCount) {
-
-        if (intval($obj->cant) > $weeksCount) {
-            $sql = "DELETE FROM $table_reporte_semanas
-                    WHERE  week_id > $weeksCount AND course_code = '$course_code'";
-            Database::query($sql);
-        } else {
-            for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
-                if (!Database::query("INSERT INTO $table_reporte_semanas (week_id, course_code, forum_id, work_id, quiz_id, pc_id)
-						VALUES ($i, '$course_code', '0', '0', '0', '0' )")) {
-                    return false;
-                }
-            }
-        }
-    }
-
-
-    $sql = "REPLACE INTO $table_students_report (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)
-			SELECT cu.user_id, rs.id, 0, 0, 0, 0
-			FROM $table_course_rel_user cu
-			INNER JOIN $courseTable c
-			ON (c.id = cu.c_id)
-			LEFT JOIN $table_reporte_semanas rs ON c.code = rs.course_code
-			WHERE cu.status = 5 AND rs.course_code = '$course_code'
-			ORDER BY cu.user_id, rs.id";
-    if (!Database::query($sql)) {
-        return false;
-    } else {
-        $page = (!isset($_GET['page'])) ? 1 : $_GET['page'];
-
-        Database::query("UPDATE $table_students_report sr SET sr.work_ok = 1
-		WHERE CONCAT (sr.user_id,',',sr.week_report_id)
-		IN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)
-		FROM $table_work w  JOIN $table_reporte_semanas rs ON w.parent_id = rs.work_id)");
-        Database::query("UPDATE $table_students_report sr SET sr.thread_ok = 1
-		WHERE CONCAT (sr.user_id,',',sr.week_report_id)
-		IN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)
-		FROM $table_post f  JOIN $table_reporte_semanas rs ON f.thread_id = rs.forum_id)");
-
-        return showResults($course_info, $weeksCount, $page);
-    }
-}
-
-/**
- * @param $courseInfo
- * @param $weeksCount
- * @param $page
- * @return array
- */
-function showResults($courseInfo, $weeksCount, $page)
-{
-    $course_code = $courseInfo['code'];
-    $page = intval($page);
-    $weeksCount = intval($weeksCount);
-
-    $tableWeeklyReport = Database::get_main_table('rp_reporte_semanas');
-    $tableStudentsReport = Database::get_main_table('rp_students_report');
-    //$table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-    $tableUser = Database::get_main_table(TABLE_MAIN_USER);
-    $tableThread = Database::get_course_table(TABLE_FORUM_THREAD);
-    $tableWork = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
-
-    $results = array();
-    $tableExport = array();
-    $sqlHeader = "SELECT rs.id as id,rs.week_id, w.title AS work_title,  t.thread_title ,'EVALUATION' as eval_title ,'QUIZ' as pc_title
-                    FROM $tableWeeklyReport rs
-                    LEFT JOIN $tableThread t ON t.thread_id =  rs.forum_id
-                    LEFT JOIN $tableWork w ON w.id = rs.work_id
-                    WHERE rs.course_code = '$course_code'
-                    ORDER BY rs.week_id";
-    $resultHeader = Database::query($sqlHeader);
-    $ids = array();
-    $line = '<tr>
-        <th ></th>';
-    $lineHeaderExport = array(null, null);
-    $lineHeaderExport2 = array(null, ull);
-    while ($rowe = Database::fetch_assoc($resultHeader)) {
-        $lineHeaderExport[] = utf8_decode('Work' . $rowe['week_id']);
-        $lineHeaderExport[] = utf8_decode('Forum' . $rowe['week_id']);
-        //$fila_export_encabezado[] =  utf8_decode('Eval'.$rowe['week_id']);
-        //$fila_export_encabezado[] =  utf8_decode('PC'.$rowe['week_id']);
-        $lineHeaderExport2[] = utf8_decode($rowe['work_title']);
-        $lineHeaderExport2[] = utf8_decode($rowe['thread_title']);
-        //$fila_export_encabezado2[] = utf8_decode($rowe['eval_title']);
-        //$fila_export_encabezado2[] = utf8_decode($rowe['pc_title']);
-        $fila_export = array('Work' . $rowe['week_id'], 'Forum' . $rowe['week_id'], 'Eval' . $rowe['week_id'], 'PC' . $rowe['week_id']);
-        if ($rowe['week_id'] > (($page - 1) * 7) && $rowe['week_id'] <= (7 * $page)) {
-            $ids[$rowe['week_id']] = $rowe['id'];
-            $line.='<th>
-                <a href="#" onClick="showContent(' . "'tarea" . $rowe['week_id'] . "'" . ');">Work' . $rowe['week_id'] . '
-                        <div class="blackboard_hide" id="tarea' . $rowe['week_id'] . '">' . $rowe['work_title'] . '</div>
-                </a></th>';
-            $line.= '<th>
-                <a href="#" onClick="showContent(' . "'foro" . $rowe['week_id'] . "'" . ');">Forum' . $rowe['week_id'] . '
-                        <div class="blackboard_hide" id="foro' . $rowe['week_id'] . '">' . $rowe['thread_title'] . '</div>
-                </a>
-                </th>';
-        }
-    }
-    $tableExport[] = $lineHeaderExport;
-    $tableExport[] = $lineHeaderExport2;
-    $line.= '</tr>';
-
-    $html = '<form action="tutor.php" name="semanas" id="semanas" method="POST">
-            <div class="row">
-            ' . get_lang('SelectWeeksSpan') . '
-            <select name="weeksNumber" id="weeksNumber" onChange="submit();">
-            <option value="7" ' . (($weeksCount == 7) ? 'selected="selected"' : "") . '>7 weeks</option>
-            <option value="14" ' . (($weeksCount == 14) ? 'selected="selected"' : "") . '>14 weeks</option>
-            </select>';
-
-    if ($weeksCount == 14) {
-        $html .= '<span style="float:right;"><a href="tutor.php?page=' . (($page == 1) ? 2 : 1) . '">' . (($page == 1) ? "Siguiente" : "Anterior") . '</a></span>';
-    }
-    $html .= '<span style="float:right;"><a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '">' . Display::return_icon('export_excel.png', get_lang('Export'), '', '32') . '</a></span>';
-
-    $html .= '</form>';
-    $html .= '<table class="reports">';
-    $html .= '<tr>
-            <th ></th>';
-    for ($i = (7 * $page - 6); $i <= $page * 7; $i++) {
-        $html .= '<th colspan="2">Week ' . $i . '<a href="assign_tickets.php?id=' . $ids[$i] . '" class="ajax">' . Display::return_icon('edit.png', get_lang('Edit'), array('width' => '16', 'height' => '16'), 22) . '</a></th>';
-    }
-    $html .= '</tr>';
-    $html .= $line;
-    $sql = "SELECT u.username , u.user_id , CONCAT(u.lastname,' ', u.firstname ) as fullname , rs.week_id , sr.work_ok ,sr.thread_ok , sr.quiz_ok , sr.pc_ok , rs.course_code
-            FROM $tableStudentsReport sr
-            JOIN $tableWeeklyReport rs ON sr.week_report_id = rs.id
-            JOIN $tableUser u ON u.user_id = sr.user_id
-            WHERE rs.course_code = '$course_code'
-            ORDER BY u.lastname , u.username , rs.week_id
-    ";
-    $result = Database::query($sql);
-    while ($row = Database::fetch_assoc($result)) {
-        $resultadose[$row['username']][$row['week_id']] = $row;
-        if ($row['week_id'] > (($page - 1) * 7) && $row['week_id'] <= (7 * $page)) {
-            $results[$row['username']][$row['week_id']] = $row;
-            if (count($results[$row['username']]) == 7) {
-                $html.= showStudentResult($results[$row['username']], $page);
-            }
-        }
-        if (count($resultadose[$row['username']]) == $weeksCount) {
-            $tableExport[] = showStudentResultExport($resultadose[$row['username']], $weeksCount);
-        }
-    }
-    $html .= '
-          </table>';
-
-    return array('show' => $html, 'export' => $tableExport);
-}
-
-/**
- * @param $datos
- * @param $pagina
- * @return string
- */
-function showStudentResult($datos, $pagina)
-{
-    $inicio = (7 * $pagina - 6);
-    $fila = '<tr>';
-
-    $fila.= '<td><a href="' . api_get_path(WEB_CODE_PATH) . 'user/userInfo.php?' . api_get_cidreq() . '&uInfo=' . $datos[$inicio]['user_id'] . '">' . $datos[$inicio]['username'] . '</a></td>';
-    foreach ($datos as $dato) {
-        $fila.= '<td align="center">' . (($dato['work_ok'] == 1) ? Display::return_icon('check.png') : Display::return_icon('aspa.png')) . '</td>';
-        $fila.= '<td align="center">' . (($dato['thread_ok'] == 1) ? Display::return_icon('check.png') : Display::return_icon('aspa.png')) . '</td>';
-    }
-    $fila.= '</tr>';
-
-    return $fila;
-}
-
-/**
- * @param $data
- * @param $numero_semanas
- * @return array
- */
-function showStudentResultExport($data, $numero_semanas)
-{
-    $fila = array();
-    $fila[] = utf8_decode($data[1]['username']);
-    $fila[] = utf8_decode($data[1]['fullname']);
-    foreach ($data as $line) {
-        $fila[] = ($line['work_ok'] == 1) ? get_lang('Yes') : get_lang('No');
-        $fila[] = ($line['thread_ok'] == 1) ? get_lang('Yes') : get_lang('No');
-    }
-
-    return $fila;
-}

+ 0 - 24
plugin/ticket/src/update_report.php

@@ -1,24 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * @package chamilo.plugin.ticket
- */
-
-require_once __DIR__.'/../config.php';
-$plugin = TicketPlugin::create();
-
-$work_id = intval($_POST['work_id']);
-$forum_id = intval($_POST['forum_id']);
-$rs_id = intval($_POST['rs_id']);
-api_protect_course_script();
-
-if (!api_is_allowed_to_edit()) {
-    Display::display_error_message($plugin->get_lang("DeniedAccess"));
-} else {
-    $sql = "UPDATE " . Database::get_main_table('rp_reporte_semanas') . "
-            SET work_id = '$work_id', forum_id = '$forum_id'
-            WHERE  id ='$rs_id'";
-    Database::query($sql);
-    Display::display_confirmation_message(get_lang('UpdatedSuccessfully'));
-}