Minor - code styling for tickets management plugin - refs #6715

1.9.x
Yannick Warnier 12 years ago
parent 1352442dd6
commit 17681a74b5
  1. 174
      plugin/ticket/database.php
  2. 4
      plugin/ticket/index.php
  3. 1
      plugin/ticket/install.php
  4. 8
      plugin/ticket/lib/tck.lib.php
  5. 25
      plugin/ticket/lib/tck_api.php
  6. 89
      plugin/ticket/lib/tck_plugin.class.php
  7. 2
      plugin/ticket/plugin.php
  8. 2
      plugin/ticket/readme.txt
  9. 6
      plugin/ticket/start.php
  10. 2
      plugin/ticket/uninstall.php

@ -2,122 +2,122 @@
$table = Database::get_main_table('tck_assigned_log');
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
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,
KEY FK_ticket_assigned_log (ticket_id) )";
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,
KEY FK_ticket_assigned_log (ticket_id) )";
Database::query($sql);
$table = Database::get_main_table('tck_category');
$sql = "CREATE TABLE ".$table." (
project_id char(3) NOT NULL,
category_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 (project_id,category_id) )";
project_id char(3) NOT NULL,
category_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 (project_id,category_id) )";
Database::query($sql);
$table = Database::get_main_table('tck_message');
$sql = "CREATE TABLE ".$table." (
ticket_id int UNSIGNED NOT NULL,
message_id int UNSIGNED NOT NULL,
subject varchar(150) 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 (ticket_id,message_id),
KEY FK_tick_message (ticket_id) )";
ticket_id int UNSIGNED NOT NULL,
message_id int UNSIGNED NOT NULL,
subject varchar(150) 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 (ticket_id,message_id),
KEY FK_tick_message (ticket_id) )";
Database::query($sql);
$table = Database::get_main_table('tck_message_attch');
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
ticket_id int UNSIGNED NOT NULL,
message_id char(2) NOT NULL,
message_attch_id char(2) 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 (ticket_id,message_id,message_attch_id),
KEY ticket_message_id_fk (message_id) ))";
ticket_id int UNSIGNED NOT NULL,
message_id char(2) NOT NULL,
message_attch_id char(2) 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 (ticket_id,message_id,message_attch_id),
KEY ticket_message_id_fk (message_id) ))";
Database::query($sql);
$table = Database::get_main_table('tck_priority');
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
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 (priority_id))";
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 (priority_id))";
Database::query($sql);
$table = Database::get_main_table('tck_project');
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
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 (project_id))";
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 (project_id))";
Database::query($sql);
$table = Database::get_main_table('tck_status');
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
status_id char(3) NOT NULL,
name varchar(100) NOT NULL,
description varchar(255) DEFAULT NULL,
PRIMARY KEY (status_id))";
status_id char(3) NOT NULL,
name varchar(100) NOT NULL,
description varchar(255) DEFAULT NULL,
PRIMARY KEY (status_id))";
Database::query($sql);
$table = Database::get_main_table('tck_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,
request_user int UNSIGNED NOT NULL,
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',
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))";
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,
request_user int UNSIGNED NOT NULL,
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',
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);
// Menu main tabs

@ -1,3 +1 @@
<?php
?>
<?php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php and generally
* includes things to execute in the main database (settings_current table)

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script initiates a videoconference session, calling the BigBlueButton
* API
* @package chamilo.plugin.bigbluebutton
* This class defines the basis of the ticket management system plugin
* @package chamilo.plugin.ticket
*/
/**
* BigBlueButton-Chamilo connector class
* Ticket class
*/
class Ticket {

@ -1,25 +0,0 @@
<?php
/*
* Ticket Support
*/
class TckBlueButtonBN {
private $_securitySalt;
private $_bbbServerBaseUrl;
/* ___________ General Methods for the BigBlueButton Class __________ */
function __construct() {
/*
Establish just our basic elements in the constructor:
*/
// BASE CONFIGS - set these for your BBB server in config.php and they will
// simply flow in here via the constants:
$this->_securitySalt = CONFIG_SECURITY_SALT;
$this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL;
}
} // END OF BIGBLUEBUTTON CLASS
?>

@ -1,6 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class TicketPlugin definition file
* @package chamilo.plugin.ticket
*/
/**
* Class TicketPlugin
*/
class TicketPlugin extends Plugin
{
static function create() {
@ -13,49 +19,48 @@ class TicketPlugin extends Plugin
}
function install() {
// Create database tables
require_once api_get_path(SYS_PLUGIN_PATH).PLUGIN_NAME.'/database.php';
// Create link tab
$homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
$menutabs = 'home_tabs'; //menutabs for tabs Menu
$menuf = $menutabs;
$ext = '.html'; //ext for HTML Extension - when used frequently, variables are faster than hardcoded strings
$lang = ''; //el for "Edit Language"
if (!empty($_SESSION['user_language_choice'])) {
$lang = $_SESSION['user_language_choice'];
} elseif (!empty($_SESSION['_user']['language'])) {
$lang = $_SESSION['_user']['language'];
} else {
$lang = api_get_setting('platformLanguage');
}
$link_url = api_get_path(WEB_PLUGIN_PATH).'ticket/s/myticket.php';
// Create database tables
require_once api_get_path(SYS_PLUGIN_PATH).PLUGIN_NAME.'/database.php';
// Create link tab
$homep = api_get_path(SYS_PATH).'home/'; //homep for Home Path
$menutabs = 'home_tabs'; //menutabs for tabs Menu
$menuf = $menutabs;
$ext = '.html'; //ext for HTML Extension - when used frequently, variables are faster than hardcoded strings
$lang = ''; //el for "Edit Language"
if (!empty($_SESSION['user_language_choice'])) {
$lang = $_SESSION['user_language_choice'];
} elseif (!empty($_SESSION['_user']['language'])) {
$lang = $_SESSION['_user']['language'];
} else {
$lang = api_get_setting('platformLanguage');
}
$link_url = api_get_path(WEB_PLUGIN_PATH).'ticket/s/myticket.php';
$home_menu = '<li class="show_menu"><a href="'.$link_url.'" target="_self"><span>Ticket</span></a></li>';
$home_menu = '<li class="show_menu"><a href="'.$link_url.'" target="_self"><span>Ticket</span></a></li>';
// Write
if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
if (is_writable($homep.$menuf.'_'.$lang.$ext)) {
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
fclose($fp);
if (file_exists($homep.$menuf.$ext)) {
if (is_writable($homep.$menuf.$ext)) {
$fpo = fopen($homep.$menuf.$ext, 'w');
fputs($fpo, $home_menu);
fclose($fpo);
}
}
} else {
$errorMsg = get_lang('HomePageFilesNotWritable');
}
} else {
//File does not exist
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
fclose($fp);
}
// Write
if (file_exists($homep.$menuf.'_'.$lang.$ext)) {
if (is_writable($homep.$menuf.'_'.$lang.$ext)) {
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
fclose($fp);
if (file_exists($homep.$menuf.$ext)) {
if (is_writable($homep.$menuf.$ext)) {
$fpo = fopen($homep.$menuf.$ext, 'w');
fputs($fpo, $home_menu);
fclose($fpo);
}
}
} else {
$errorMsg = get_lang('HomePageFilesNotWritable');
}
} else {
//File does not exist
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w');
fputs($fp, $home_menu);
fclose($fp);
}
}

@ -1,4 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
require_once dirname(__FILE__).'/config.php';
$plugin_info = TicketPlugin::create()->get_info();

@ -1 +1 @@
This plugin Ticket Support
This plugin provides the support ticket management system features

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script initiates a videoconference session, calling the BigBlueButton API
* @package chamilo.plugin.bigbluebutton
* This script initiates a ticket management system session
* @package chamilo.plugin.ticket
*/
/**
* Initialization
*/
$course_plugin = 'ticket'; //needed in order to load the plugin lang variables
require_once dirname(__FILE__).'/config.php';
$tool_name = get_lang('Ticket');

@ -1,5 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both

Loading…
Cancel
Save