Minor - format code

pull/2588/merge
Julio Montoya 8 years ago
parent b711b72977
commit c7576364a7
  1. 32
      main/course_description/resources/js/main.js
  2. 36
      main/inc/lib/TicketManager.php
  3. 8
      main/inc/lib/plugin.class.php
  4. 4
      main/ticket/tickets.php
  5. 2
      plugin/learning_calendar/LearningCalendarPlugin.php

@ -1,44 +1,40 @@
function Proxy() {
}
function Proxy() {};
Proxy.prototype.root = function(){
Proxy.prototype.root = function () {
return www + '/main/inc/ajax/course_description.ajax.php';
}
Proxy.prototype.post = function(data, f){
if(typeof(sec_token)!=='undefined'){
Proxy.prototype.post = function (data, f) {
if (typeof(sec_token) !== 'undefined') {
data.sec_token = sec_token;
}
$.post(this.root(), data, f, 'json');
}
var CourseDescription = new Proxy();
CourseDescription.del = function(c_id, id, f)
{
CourseDescription.del = function (c_id, id, f) {
var data = {
c_id: c_id,
id: id,
c_id: c_id,
id: id,
action: 'delete'
};
this.post(data, f);
};
CourseDescription.delete_by_course = function(c_id, session_id, f)
{
CourseDescription.delete_by_course = function (c_id, session_id, f) {
var data = {
c_id: c_id,
session_id: session_id,
c_id: c_id,
session_id: session_id,
action: 'delete_by_course'
};
this.post(data, f);
};
var message = {};
message.update = function(data){
text = typeof(data)=='string' ? data : data.message;
$('#messages').html(text)
message.update = function (data) {
text = typeof(data) == 'string' ? data : data.message;
$('#messages').html(text);
}

@ -196,7 +196,7 @@ class TicketManager
$table = Database::get_main_table(TABLE_TICKET_CATEGORY_REL_USER);
foreach ($users as $userId) {
if (self::userIsAssignedToCategory($userId, $categoryId) == false) {
if (self::userIsAssignedToCategory($userId, $categoryId) === false) {
$params = [
'category_id' => $categoryId,
'user_id' => $userId,
@ -217,8 +217,8 @@ class TicketManager
public static function userIsAssignedToCategory($userId, $categoryId)
{
$table = Database::get_main_table(TABLE_TICKET_CATEGORY_REL_USER);
$userId = intval($userId);
$categoryId = intval($categoryId);
$userId = (int) $userId;
$categoryId = (int) $categoryId;
$sql = "SELECT * FROM $table
WHERE category_id = $categoryId AND user_id = $userId";
$result = Database::query($sql);
@ -234,7 +234,7 @@ class TicketManager
public static function getUsersInCategory($categoryId)
{
$table = Database::get_main_table(TABLE_TICKET_CATEGORY_REL_USER);
$categoryId = intval($categoryId);
$categoryId = (int) $categoryId;
$sql = "SELECT * FROM $table WHERE category_id = $categoryId";
$result = Database::query($sql);
@ -247,7 +247,7 @@ class TicketManager
public static function deleteAllUserInCategory($categoryId)
{
$table = Database::get_main_table(TABLE_TICKET_CATEGORY_REL_USER);
$categoryId = intval($categoryId);
$categoryId = (int) $categoryId;
$sql = "DELETE FROM $table WHERE category_id = $categoryId";
Database::query($sql);
}
@ -583,8 +583,8 @@ class TicketManager
$ticketId,
$userId
) {
$ticketId = intval($ticketId);
$userId = intval($userId);
$ticketId = (int) $ticketId;
$userId = (int) $userId;
if (empty($ticketId)) {
return false;
@ -636,8 +636,8 @@ class TicketManager
$status = 'NOL',
$sendConfirmation = false
) {
$ticketId = intval($ticketId);
$userId = intval($userId);
$ticketId = (int) $ticketId;
$userId = (int) $userId;
$table_support_messages = Database::get_main_table(TABLE_TICKET_MESSAGE);
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
if ($sendConfirmation) {
@ -764,24 +764,26 @@ class TicketManager
* @param int $number_of_items
* @param $column
* @param $direction
* @param int $userId
*
* @return array
*/
public static function get_tickets_by_user_id(
public static function getTicketsByCurrentUser(
$from,
$number_of_items,
$column,
$direction,
$userId = 0
$direction
) {
$table_support_category = Database::get_main_table(TABLE_TICKET_CATEGORY);
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
$table_support_priority = Database::get_main_table(TABLE_TICKET_PRIORITY);
$table_support_status = Database::get_main_table(TABLE_TICKET_STATUS);
$direction = !empty($direction) ? $direction : 'DESC';
$userId = !empty($userId) ? $userId : api_get_user_id();
$userId = api_get_user_id();
$userInfo = api_get_user_info($userId);
if (empty($userInfo)) {
return [];
}
$isAdmin = UserManager::is_admin($userId);
if (!isset($_GET['project_id'])) {
@ -995,11 +997,9 @@ class TicketManager
}
/**
* @param int $userId
*
* @return int
*/
public static function get_total_tickets_by_user_id($userId = 0)
public static function getTotalTicketsCurrentUser()
{
$table_support_category = Database::get_main_table(TABLE_TICKET_CATEGORY);
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
@ -1106,7 +1106,7 @@ class TicketManager
/**
* @param int $id
*
* @return MessageAttachment
* @return false|MessageAttachment
*/
public static function getTicketMessageAttachment($id)
{

@ -978,4 +978,12 @@ class Plugin
return $tool;
}
/**
* @param bool $value
*/
public function setHasPersonalEvents($value)
{
$this->hasPersonalEvents = $value;
}
}

@ -59,8 +59,8 @@ $projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : 0;
$table = new SortableTable(
'Tickets',
['TicketManager', 'get_total_tickets_by_user_id'],
['TicketManager', 'get_tickets_by_user_id'],
['TicketManager', 'getTotalTicketsCurrentUser'],
['TicketManager', 'getTicketsByCurrentUser'],
2,
20,
'DESC'

@ -15,10 +15,10 @@ class LearningCalendarPlugin extends Plugin
*/
protected function __construct()
{
$this->hasPersonalEvents = true;
$version = '0.1';
$author = 'Julio Montoya';
parent::__construct($version, $author, ['enabled' => 'boolean']);
$this->setHasPersonalEvents(true);
}
/**

Loading…
Cancel
Save