Add category edit option see BT#11081

ofaj
Julio 10 years ago
parent 135fc316a8
commit ec182dffd7
  1. 2
      main/inc/lib/plugin.class.php
  2. 13
      main/inc/lib/sortable_table.class.php
  3. 3
      plugin/ticket/lang/english.php
  4. 63
      plugin/ticket/src/categories.php
  5. 18
      plugin/ticket/src/myticket.php
  6. 20
      plugin/ticket/src/ticket_plugin.class.php

@ -325,6 +325,7 @@ class Plugin
//1. Loading english if exists
$english_path = $root.$plugin_name."/lang/english.php";
if (is_readable($english_path)) {
$strings = array();
include $english_path;
@ -332,6 +333,7 @@ class Plugin
}
$path = $root.$plugin_name."/lang/$language_interface.php";
//2. Loading the system language
if (is_readable($path)) {
include $path;

@ -245,7 +245,6 @@ class SortableTable extends HTML_Table
$empty_table = false;
$content = $this->get_table_html();
if ($this->get_total_number_of_items() == 0) {
$cols = $this->getColCount();
$this->setCellAttributes(1, 0, 'style="font-style: italic;text-align:center;" colspan='.$cols);
@ -954,10 +953,18 @@ class SortableTable extends HTML_Table
*/
public function get_table_data($from = null, $per_page = null, $column = null, $direction = null, $sort = null)
{
$data = [];
if (!is_null($this->get_data_function)) {
return call_user_func($this->get_data_function, $from, $this->per_page, $this->column, $this->direction);
$data = call_user_func(
$this->get_data_function,
$from,
$this->per_page,
$this->column,
$this->direction
);
}
return array();
return $data;
}

@ -85,3 +85,6 @@ $strings['PleaseBeforeRegisterATicketSelectOneUser'] = "Please select a user bef
$strings['RequestConfirmation'] = "Request confirmation";
$strings['TicketUpdated'] = "Ticket updated";
$strings['TicketClosed'] = "Ticket closed";
$strings['allow_category_edition'] = "Allow category edition";

@ -0,0 +1,63 @@
<?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 '../config.php';
$plugin = TicketPlugin::create();
api_protect_admin_script(true);
$tool_name = $plugin->get_lang('LastEdit');
$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', 'get_all_tickets_categories'),
1
);
if ($table->per_page == 0) {
$table->per_page = 20;
}
if (isset($_GET['action'])) {
global $table;
$action = $_GET['action'];
switch ($action) {
case 'assign':
if ($isAdmin && isset($_GET['ticket_id']))
TicketManager::assign_ticket_user($_GET['ticket_id'], $user_id);
break;
default:
break;
}
}
$user_id = api_get_user_id();
$isAdmin = api_is_platform_admin();
Display::display_header($plugin->get_lang('MyTickets'));
$table->set_header(0, $plugin->get_lang('Title'), true);
$table->set_header(1, get_lang('Description'), true, array("style" => "width:200px"));
$table->set_header(2, $plugin->get_lang('TotalTickets'), true);
$table->set_header(3, get_lang('Actions'), true);
echo $table->return_table();
Display::display_footer();

@ -12,8 +12,8 @@ $course_plugin = 'ticket';
require_once '../config.php';
$plugin = TicketPlugin::create();
$tool_name = $plugin->get_lang('LastEdit');
$tool_name = $plugin->get_lang('LastEdit');
api_block_anonymous_users();
$libPath = api_get_path(LIBRARY_PATH);
@ -289,12 +289,22 @@ if ($isAdmin) {
echo '<div class="actions" >';
if (api_is_platform_admin()) {
echo '<span class="fleft">' .
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'), '', '32') . '</a>' .
'<a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '">' .
Display::return_icon('export_excel.png', get_lang('Export'), '', '32') . '</a>' .
'</span>';
Display::return_icon('export_excel.png', get_lang('Export'), '', '32') . '</a>';
if ($plugin->get('allow_category_edition')) {
echo Display::url(
Display::return_icon('document.png'),
api_get_path(WEB_PLUGIN_PATH) . 'ticket/src/categories.php'
);
}
echo '</span>';
}
$form->display();
echo '</div>';

@ -12,21 +12,30 @@ class TicketPlugin extends Plugin
/**
* Set the result
* @staticvar null $result
* @return type
* @return TicketPlugin
*/
static function create()
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* TicketPlugin constructor.
*/
protected function __construct()
{
$settings = array(
'tool_enable' => 'boolean',
'allow_student_add' => 'boolean'
'allow_student_add' => 'boolean',
'allow_category_edition' => 'boolean'
);
parent::__construct(
'1.0',
'Kenny Rodas Chavez, Genesis Lopez, Francis Gonzales, Yannick Warnier, Julio Montoya',
$settings
);
parent::__construct('1.0', 'Kenny Rodas Chavez, Genesis Lopez, Francis Gonzales, Yannick Warnier', $settings);
}
/**
@ -36,7 +45,6 @@ class TicketPlugin extends Plugin
{
// Create database tables and insert a Tab
require_once api_get_path(SYS_PLUGIN_PATH) . PLUGIN_NAME . '/database.php';
}
/**
@ -87,4 +95,6 @@ class TicketPlugin extends Plugin
echo "<script>location.href = '" . $_SERVER['REQUEST_URI'] . "';</script>";
}
}
}

Loading…
Cancel
Save