Add project_id

remotes/angel/1.11.x
Julio 9 years ago
parent d0ddf6f846
commit e8551d5606
  1. 49
      main/inc/lib/TicketManager.php
  2. 2
      main/inc/lib/course_category.lib.php
  3. 1
      main/ticket/assign_tickets.php
  4. 154
      main/ticket/categories.php
  5. 11
      main/ticket/categories_add_user.php
  6. 43
      main/ticket/new_ticket.php
  7. 130
      main/ticket/projects.php
  8. 5
      main/ticket/report.php
  9. 80
      main/ticket/ticket_details.php
  10. 67
      main/ticket/tickets.php

@ -37,21 +37,24 @@ class TicketManager
* Get categories of tickets
* @return array
*/
public static function get_all_tickets_categories($order = '')
public static function get_all_tickets_categories($projectId, $order = '')
{
$table_support_category = Database::get_main_table(TABLE_TICKET_CATEGORY);
$table_support_project = Database::get_main_table(TABLE_TICKET_PROJECT);
$order = empty($order) ? 'category.total_tickets DESC' : $order;
$projectId = (int) $projectId;
$sql = "SELECT
category.*,
category.id category_id,
project.other_area,
project.email
FROM
$table_support_category category,
$table_support_category category INNER JOIN
$table_support_project project
WHERE project.id = category.project_id
ON project.id = category.project_id
WHERE project.id = $projectId
ORDER BY $order";
$result = Database::query($sql);
$types = array();
@ -62,7 +65,7 @@ class TicketManager
return $types;
}
/**
/**
* @param $from
* @param $numberItems
* @param $column
@ -263,7 +266,7 @@ class TicketManager
* @param int $assigned_user
* @return bool
*/
public static function insert_new_ticket(
public static function add(
$category_id,
$course_id,
$project_id,
@ -1875,11 +1878,12 @@ class TicketManager
* @param string $url
* @return FormValidator
*/
public static function getCategoryForm($url)
public static function getCategoryForm($url, $projectId)
{
$form = new FormValidator('category', 'post', $url);
$form->addText('name', get_lang('Name'));
$form->addHtmlEditor('description', get_lang('Description'));
$form->addHidden('project_id', $projectId);
$form->addButtonUpdate(get_lang('Save'));
return $form;
@ -1917,7 +1921,6 @@ class TicketManager
return $list;
}
/**
* @return array
*/
@ -1931,7 +1934,10 @@ class TicketManager
$list[] = [
'id' => $row->getId(),
'0' => $row->getId(),
'1' => $row->getName(),
'1' => Display::url(
$row->getName(),
api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$row->getId()
),
'2' => $row->getDescription(),
'3' => $row->getId()
];
@ -1940,6 +1946,33 @@ class TicketManager
return $list;
}
/**
* @return array
*/
public static function getProjectsSimple()
{
$projects = Database::getManager()->getRepository('ChamiloTicketBundle:Project')->findAll();
$list = [];
/** @var Project $row */
foreach ($projects as $row) {
$list[] = [
'id' => $row->getId(),
'0' => $row->getId(),
'1' => Display::url(
$row->getName(),
api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$row->getId()
),
'2' => $row->getDescription()
];
}
return $list;
}
/**
* @return int
*/

@ -913,7 +913,7 @@ class CourseCategory
$whereCondition = " AND a.access_url_id = ".api_get_current_access_url_id();
$sql = "SELECT c.*, c.name as text FROM $tableCategory c $conditions
WHERE c.id IN $list $whereCondition";
WHERE c.id IN $list $whereCondition";
$result = Database::query($sql);
return Database::store_result($result, 'ASSOC');

@ -7,7 +7,6 @@
*/
require_once __DIR__.'/../inc/global.inc.php';
$plugin = TicketPlugin::create();
api_protect_course_script();
if (!api_is_allowed_to_edit()) {

@ -1,12 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* 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__.'/../inc/global.inc.php';
@ -17,6 +18,8 @@ $toolName = get_lang('Categories');
$libPath = api_get_path(LIBRARY_PATH);
$webLibPath = api_get_path(WEB_LIBRARY_PATH);
$user_id = api_get_user_id();
$isAdmin = api_is_platform_admin();
$this_section = 'tickets';
unset($_SESSION['this_section']);
@ -34,84 +37,82 @@ if ($table->per_page == 0) {
$formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
Session::write('project_id', $projectId);
$action = isset($_GET['action']) ? $_GET['action'] : '';
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$projectId,
'name' => 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' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=add';
$form = TicketManager::getCategoryForm($url);
$formToString = $form->returnForm();
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(),
'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' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=edit&id='.$id;
$form = TicketManager::getCategoryForm($url);
$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;
}
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' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=add&project_id='.$projectId;
$form = TicketManager::getCategoryForm($url, $projectId);
$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(),
'course_required' => '',
'project_id' => $projectId
];
TicketManager::addCategory($params);
Display::addFlash(Display::return_message(get_lang('Added')));
header("Location: ".api_get_self().'?project_id='.$projectId);
exit;
}
break;
case 'edit':
$toolName = get_lang('Edit');
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php?project_id='.$projectId,
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=edit&project_id='.$projectId.'&id='.$id;
$form = TicketManager::getCategoryForm($url, $projectId);
$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().'?project_id='.$projectId);
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
@ -121,19 +122,20 @@ $isAdmin = api_is_platform_admin();
*/
function modify_filter($id, $params, $row)
{
$projectId = Session::read('project_id');
$result = Display::url(
Display::return_icon('edit.png', get_lang('Edit')),
"categories.php?action=edit&id={$row['id']}"
"categories.php?action=edit&id={$row['id']}&project_id=".$projectId
);
$result .= Display::url(
Display::return_icon('user.png', get_lang('AssignUser')),
"categories_add_user.php?id={$row['id']}"
"categories_add_user.php?id={$row['id']}&project_id=".$projectId
);
$result .= Display::url(
Display::return_icon('delete.png', get_lang('Delete')),
"categories.php?action=delete&id={$row['id']}"
"categories.php?action=delete&id={$row['id']}&project_id=".$projectId
);
return $result;
@ -150,7 +152,7 @@ Display::display_header($toolName);
$items = [
[
'url' => 'categories.php?action=add',
'url' => 'categories.php?action=add&project_id='.$projectId,
'content' => Display::return_icon('new_folder.png', null, null, ICON_SIZE_MEDIUM)
]
];

@ -5,13 +5,14 @@
*
* @package chamilo.plugin.ticket
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$plugin = TicketPlugin::create();
api_protect_admin_script(true);
$categoryId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
$categoryInfo = TicketManager::getCategory($categoryId);
if (empty($categoryInfo)) {
@ -45,16 +46,16 @@ if ($form->validate()) {
TicketManager::deleteAllUserInCategory($categoryId);
TicketManager::addUsersToCategory($categoryId, $values['users']);
Display::addFlash(Display::return_message(get_lang('Updated')));
header("Location: ".api_get_self()."?id=".$categoryId);
header("Location: ".api_get_self()."?id=".$categoryId.'&project_id='.$projectId);
exit;
}
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$projectId,
'name' => get_lang('MyTickets')
);
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php?project_id='.$projectId,
'name' => get_lang('Categories')
);
Display::display_header(get_lang('Users'));

@ -5,7 +5,6 @@
* @package chamilo.plugin.ticket
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true') {
@ -34,7 +33,7 @@ function load_course_list (div_course, my_user_id, user_email) {
function changeType() {
var selected = document.getElementById("category_id").selectedIndex;
var id = $("#category_id").val();
$("#project_id").val(projects[id]);
//$("#project_id").val(projects[id]);
$("#other_area").val(other_area[id]);
$("#email").val(email[id]);
if (parseInt(course_required[id]) == 0){
@ -148,7 +147,9 @@ div.divTicket {
padding-top: 100px;
}
</style>';
$types = TicketManager::get_all_tickets_categories('category.name ASC');
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
$types = TicketManager::get_all_tickets_categories($projectId, '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') . '
@ -187,7 +188,7 @@ function js_array($array, $name, $key)
*/
function show_form_send_ticket()
{
global $types, $plugin;
global $types;
// Category List
$categoryList = array();
@ -204,19 +205,6 @@ function show_form_send_ticket()
);
$statusList = TicketManager::getStatusList();
/*$statusList[TicketManager::STATUS_NEW] = get_lang('StatusNew');
if (api_is_platform_admin()) {
$statusAttributes = array(
'id' => 'status_id',
'for' => 'status_id',
'style' => 'width: 562px;'
);
$statusList[TicketManager::STATUS_PENDING] = get_lang('StatusPending');
$statusList[TicketManager::STATUS_UNCONFIRMED] = get_lang('StatusUnconfirmed');
$statusList[TicketManager::STATUS_CLOSE] = get_lang('StatusClose');
$statusList[TicketManager::STATUS_FORWARDED] = get_lang('StatusForwarded');
}*/
//End Status List
// Source List
$sourceList = array();
@ -238,16 +226,13 @@ function show_form_send_ticket()
}
// Priority List
/*$priorityList = array();
$priorityList[TicketManager::PRIORITY_NORMAL] = get_lang('PriorityNormal');
$priorityList[TicketManager::PRIORITY_HIGH] = get_lang('PriorityHigh');
$priorityList[TicketManager::PRIORITY_LOW] = get_lang('PriorityLow');*/
$priorityList = TicketManager::getPriorityList();
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
$form = new FormValidator(
'send_ticket',
'POST',
api_get_self(),
api_get_self().'?project_id='.$projectId,
'',
array(
'enctype' => 'multipart/form-data',
@ -267,10 +252,7 @@ function show_form_send_ticket()
$form->addElement(
'hidden',
'project_id',
'',
array(
'id' => 'project_id'
)
$projectId
);
$form->addElement(
@ -427,18 +409,17 @@ function save_ticket()
}
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
$project_id = $_POST['project_id'];
$project_id = 1;
$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'];
$priority = isset($_POST['priority_id']) ? $_POST['priority_id'] : '';
$status = isset($_POST['status_id']) ? $_POST['status_id'] : '';
$file_attachments = $_FILES;
if (TicketManager::insert_new_ticket(
if (TicketManager::add(
$category_id,
$course_id,
$project_id,
@ -454,7 +435,7 @@ function save_ticket()
$user_id
)) {
Display::addFlash(
Display::return_message(get_lang('TckSuccessSave'), 'success')
Display::return_message(get_lang('Saved'), 'success')
);
header('Location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit;

@ -6,9 +6,6 @@
* @package chamilo.plugin.ticket
*/
$cidReset = true;
// needed in order to load the plugin lang variables
$course_plugin = 'ticket';
require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script(true);
@ -34,78 +31,75 @@ if ($table->per_page == 0) {
$formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$action = isset($_GET['action']) ? $_GET['action'] : '';
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/tickets.php',
'name' => get_lang('MyTickets')
);
if (isset($_GET['action'])) {
global $table;
$action = $_GET['action'];
switch ($action) {
case 'delete':
TicketManager::deleteProject($id);
Display::addFlash(Display::return_message(get_lang('Deleted')));
switch ($action) {
case 'delete':
TicketManager::deleteProject($id);
Display::addFlash(Display::return_message(get_lang('Deleted')));
header("Location: ".api_get_self());
break;
case 'add':
$toolName = get_lang('Add');
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=add';
$form = TicketManager::getProjectForm($url);
$formToString = $form->returnForm();
if ($form->validate()) {
$values =$form->getSubmitValues();
$params = [
'name' => $values['name'],
'description' => $values['description']
];
TicketManager::addProject($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' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=edit&id='.$id;
$form = TicketManager::getProjectForm($url);
$item = TicketManager::getProject($_GET['id']);
$form->setDefaults([
'name' => $item->getName(),
'description' => $item->getDescription()]
);
$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::updateProject($_GET['id'], $params);
Display::addFlash(Display::return_message(get_lang('Updated')));
header("Location: ".api_get_self());
break;
case 'add':
$toolName = get_lang('Add');
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=add';
$form = TicketManager::getProjectForm($url);
$formToString = $form->returnForm();
if ($form->validate()) {
$values =$form->getSubmitValues();
$params = [
'name' => $values['name'],
'description' => $values['description']
];
TicketManager::addProject($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' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
'name' => get_lang('Categories')
);
$url = api_get_self().'?action=edit&id='.$id;
$form = TicketManager::getProjectForm($url);
$item = TicketManager::getProject($_GET['id']);
$form->setDefaults([
'name' => $item->getName(),
'description' => $item->getDescription()]
);
$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::updateProject($_GET['id'], $params);
Display::addFlash(Display::return_message(get_lang('Updated')));
header("Location: ".api_get_self());
exit;
}
break;
default:
break;
}
exit;
}
break;
default:
break;
}
$user_id = api_get_user_id();

@ -5,9 +5,7 @@
* @package chamilo.plugin.ticket
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$plugin = TicketPlugin::create();
api_block_anonymous_users();
@ -18,8 +16,7 @@ if (!api_is_allowed_to_edit()) {
$this_section = 'Reports';
unset($_SESSION['this_section']);
$htmlHeadXtra[] = '
<script language="javascript">
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$( "#keyword_start_date_start" ).datepicker({ dateFormat: ' . "'yy-mm-dd'" . ' });
$( "#keyword_start_date_end" ).datepicker({ dateFormat: ' . "'yy-mm-dd'" . ' });

@ -5,7 +5,6 @@
*
* @package chamilo.plugin.ticket
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
@ -276,38 +275,37 @@ if (!isset($_POST['compose'])) {
$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']
).'. '.
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>' . get_lang('Priority') . ': </b>' . $ticket['ticket']['priority'] . '<p></td>
</tr>';
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']
).'. '.
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>' . 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']);
@ -473,17 +471,6 @@ function show_form_send_message($ticket)
);
if ($isAdmin) {
/*$statusList[TicketManager::STATUS_NEW] = get_lang('StatusNew');
$statusAttributes = array(
'id' => 'status_id',
'for' => 'status_id',
'style' => 'width: 562px;'
);
$statusList[TicketManager::STATUS_PENDING] = get_lang('StatusPending');
$statusList[TicketManager::STATUS_UNCONFIRMED] = get_lang('StatusUnconfirmed');
$statusList[TicketManager::STATUS_CLOSE] = get_lang('StatusClose');
$statusList[TicketManager::STATUS_FORWARDED] = get_lang('StatusForwarded');*/
$statusList = TicketManager::getStatusList();
$form->addElement(
'select',
@ -492,11 +479,6 @@ function show_form_send_message($ticket)
$statusList
);
/*$priorityList = array();
$priorityList[TicketManager::PRIORITY_NORMAL] = get_lang('PriorityNormal');
$priorityList[TicketManager::PRIORITY_HIGH] = get_lang('PriorityHigh');
$priorityList[TicketManager::PRIORITY_LOW] = get_lang('PriorityLow');*/
$priorityList = TicketManager::getPriorityList();
$form->addElement(
'select',

@ -6,9 +6,6 @@
* @package chamilo.plugin.ticket
*/
$cidReset = true;
// needed in order to load the plugin lang variables
$course_plugin = 'ticket';
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
@ -70,6 +67,7 @@ if ($table->per_page == 0) {
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
$projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
switch ($action) {
case 'assign':
@ -90,7 +88,7 @@ switch ($action) {
case 'export':
$data = array(
array(
get_lang('TicketNum'),
'#',
get_lang('Date'),
get_lang('DateLastEdition'),
get_lang('Category'),
@ -127,12 +125,21 @@ switch ($action) {
break;
}
if (empty($projectId)) {
$projects = TicketManager::getProjectsSimple();
if (!empty($projects) && isset($projects[0])) {
$project = $projects[0];
header('Location: '.api_get_self().'?project_id='.$project['id']);
exit;
}
}
$user_id = api_get_user_id();
$isAdmin = api_is_platform_admin();
Display::display_header(get_lang('MyTickets'));
if ($isAdmin) {
if (!empty($projectId))
if ($isAdmin ) {
$getParameters = [
'keyword',
'keyword_status',
@ -171,7 +178,7 @@ if ($isAdmin) {
// Select categories
$selectTypes = [];
$types = TicketManager::get_all_tickets_categories();
$types = TicketManager::get_all_tickets_categories($projectId);
foreach ($types as $type) {
$selectTypes[$type['category_id']] = $type['name'];
}
@ -215,30 +222,23 @@ if ($isAdmin) {
echo '<div class="actions" >';
if (api_is_platform_admin()) {
echo '<span class="left">' .
'<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php">' .
Display::return_icon('add.png', get_lang('TckNew'), '', ICON_SIZE_MEDIUM) . '</a>' .
'<a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '">' .
'<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php?project_id='.$projectId.'">' .
Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM) . '</a>' .
'<a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '&project_id='.$projectId.'">' .
Display::return_icon('export_excel.png', get_lang('Export'), '', ICON_SIZE_MEDIUM) . '</a>';
if (api_get_setting('ticket_allow_category_edition')) {
echo Display::url(
Display::return_icon('folder_document.gif'),
api_get_path(WEB_CODE_PATH) . 'ticket/categories.php'
Display::return_icon('folder_document.gif', get_lang('Categories')),
api_get_path(WEB_CODE_PATH) . 'ticket/categories.php?project_id='.$projectId
);
echo Display::url(
Display::return_icon('folder_document.gif'),
Display::return_icon('folder_document.gif', get_lang('Projects')),
api_get_path(WEB_CODE_PATH) . 'ticket/projects.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>';
@ -246,7 +246,7 @@ if ($isAdmin) {
$advancedSearchForm = new FormValidator(
'advanced_search',
'get',
api_get_self(),
api_get_self().'&project_id='.$projectId,
null,
['style' => 'display:"none"', 'id' => 'advanced_search_form']
);
@ -267,15 +267,31 @@ if ($isAdmin) {
echo '<div class="actions" >';
echo '<span style="float:right;">' .
'<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php">' .
Display::return_icon('add.png', get_lang('TckNew'), '', '32') .
Display::return_icon('add.png', get_lang('Add'), '', '32') .
'</a>' .
'</span>';
echo '</div>';
}
}
if (empty($projectId)) {
$table = new SortableTable(
'TicketProject',
array('TicketManager', 'getProjectsCount'),
array('TicketManager', 'getProjectsSimple'),
1
);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Title'), false);
$table->set_header(2, get_lang('Description'), true, array("style" => "width:200px"));
$table->display();
Display::display_footer();
}
if ($isAdmin) {
$table->set_header(0, get_lang('TicketNum'), true);
$table->set_header(0, '#', true);
$table->set_header(1, get_lang('Date'), true);
$table->set_header(2, get_lang('DateLastEdition'), true);
$table->set_header(3, get_lang('Category'), true);
@ -286,10 +302,7 @@ if ($isAdmin) {
} else {
echo '<center><h1>' . get_lang('MyTickets') . '</h1></center>';
echo '<center><p>' . get_lang('MsgWelcome') . '</p></center>';
if (isset($_GET['message'])) {
Display::display_confirmation_message(get_lang('TckSuccessSave'));
}
$table->set_header(0, get_lang('TicketNum'), true);
$table->set_header(0, '#', true);
$table->set_header(1, get_lang('Date'), true);
$table->set_header(2, get_lang('DateLastEdition'), true);
$table->set_header(3, get_lang('Category'));

Loading…
Cancel
Save