Completed
Push — master ( e29d63...8b3aec )
by Julito
101:03 queued 68:16
created
plugin/buycourses/src/buy_course_plugin.class.php 1 patch
Doc Comments   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     /**
43 43
      *
44
-     * @return StaticPlugin
44
+     * @return BuyCoursesPlugin
45 45
      */
46 46
     static function create()
47 47
     {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     /**
265 265
      * Save a transfer account information
266 266
      * @param array $params The transfer account
267
-     * @return int Rows affected. Otherwise return false
267
+     * @return false|string Rows affected. Otherwise return false
268 268
      */
269 269
     public function saveTransferAccount($params)
270 270
     {
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
     /**
677 677
      * Get session info
678 678
      * @param array $sessionId The session ID
679
-     * @return array
679
+     * @return Session
680 680
      */
681 681
     public function getSessionInfo($sessionId)
682 682
     {
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      * Register a sale
770 770
      * @param int $itemId The product ID
771 771
      * @param int $paymentType The payment type
772
-     * @return boolean
772
+     * @return false|string
773 773
      */
774 774
     public function registerSale($itemId, $paymentType)
775 775
     {
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 
952 952
     /**
953 953
      * Get payment types
954
-     * @return array
954
+     * @return string[]
955 955
      */
956 956
     public function getPaymentTypes()
957 957
     {
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 
990 990
     /**
991 991
      * Get the statuses for sales
992
-     * @return array
992
+     * @return string[]
993 993
      */
994 994
     public function getSaleStatuses()
995 995
     {
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 
1003 1003
     /**
1004 1004
      * Get the statuses for Payouts
1005
-     * @return array
1005
+     * @return string[]
1006 1006
      */
1007 1007
     public function getPayoutStatuses()
1008 1008
     {
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
     /**
1017 1017
      * Get the list of product types
1018
-     * @return array
1018
+     * @return string[]
1019 1019
      */
1020 1020
     public function getProductTypes()
1021 1021
     {
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
     /**
1397 1397
      * Register a item
1398 1398
      * @param array $itemData The item data
1399
-     * @return int The item ID. Otherwise return false
1399
+     * @return false|string The item ID. Otherwise return false
1400 1400
      */
1401 1401
     public function registerItem(array $itemData)
1402 1402
     {
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
     /**
1555 1555
      * Verify if the beneficiary have a paypal account
1556 1556
      * @param int $userId
1557
-     * @return true if the user have a paypal account, false if not
1557
+     * @return boolean if the user have a paypal account, false if not
1558 1558
      */
1559 1559
     public function verifyPaypalAccountByBeneficiary($userId)
1560 1560
     {
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
     /**
1677 1677
      * Register addicional service
1678 1678
      * @param array params $service
1679
-     * @return mixed response
1679
+     * @return string|false response
1680 1680
      */
1681 1681
     public function storeService($service)
1682 1682
     {
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
 
1835 1835
     /**
1836 1836
      * Get the statuses for sales
1837
-     * @return array
1837
+     * @return string[]
1838 1838
      */
1839 1839
     public function getServiceSaleStatuses()
1840 1840
     {
Please login to merge, or discard this patch.
plugin/buycourses/src/configuration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
 // breadcrumbs
25 25
 $interbreadcrumb[] = [
26
-    'url' => api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php',
26
+    'url' => api_get_path(WEB_PLUGIN_PATH).'buycourses/index.php',
27 27
     'name' => $plugin->get_lang('Home')
28 28
 ];
29 29
 
Please login to merge, or discard this patch.
plugin/buycourses/src/service_error.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         Display::return_message($plugin->get_lang('OrderCancelled'), 'error', false)
23 23
     );
24 24
 
25
-    header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
25
+    header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
26 26
     exit;
27 27
 }
28 28
 
@@ -30,6 +30,6 @@  discard block
 block discarded – undo
30 30
     Display::return_message($plugin->get_lang('ErrorOccurred'), 'error', false)
31 31
 );
32 32
 
33
-header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
33
+header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
34 34
 
35 35
 exit;
Please login to merge, or discard this patch.
plugin/buycourses/src/service_sales_report.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     $toolbar .= Display::toolbarButton(
62 62
         $plugin->get_lang('PaypalPayoutCommissions'),
63
-        api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/paypal_payout.php',
63
+        api_get_path(WEB_PLUGIN_PATH).'buycourses/src/paypal_payout.php',
64 64
         'paypal',
65 65
         'primary',
66 66
         ['title' => $plugin->get_lang('PaypalPayoutCommissions')]
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     $toolbar .= Display::toolbarButton(
76 76
         $plugin->get_lang('PayoutReport'),
77
-        api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/payout_report.php',
77
+        api_get_path(WEB_PLUGIN_PATH).'buycourses/src/payout_report.php',
78 78
         'money',
79 79
         'info',
80 80
         ['title' => $plugin->get_lang('PayoutReport')]
Please login to merge, or discard this patch.
plugin/buycourses/src/culqi.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,2 +1,2 @@
 block discarded – undo
1 1
 <?php
2
-    define('CULQI_SDK_VERSION', '1.1.0'); class UrlAESCipher { protected $key; protected $cipher = MCRYPT_RIJNDAEL_128; protected $mode = MCRYPT_MODE_CBC; function __construct($spec63bf = null) { $this->setBase64Key($spec63bf); } public function setBase64Key($spec63bf) { $this->key = base64_decode($spec63bf); } private function sp42f8e2() { if ($this->key != null) { return true; } else { return false; } } private function sp4b5aaf() { return mcrypt_create_iv(16, MCRYPT_RAND); } public function urlBase64Encrypt($sp755f74) { if ($this->sp42f8e2()) { $sp6bc36d = mcrypt_get_block_size($this->cipher, $this->mode); $sp810031 = UrlAESCipher::pkcs5_pad($sp755f74, $sp6bc36d); $sp1c42c6 = $this->sp4b5aaf(); return trim(UrlAESCipher::base64_encode_url($sp1c42c6 . mcrypt_encrypt($this->cipher, $this->key, $sp810031, $this->mode, $sp1c42c6))); } else { throw new Exception('Invlid params!'); } } public function urlBase64Decrypt($sp755f74) { if ($this->sp42f8e2()) { $spcc5dfb = UrlAESCipher::base64_decode_url($sp755f74); $sp1c42c6 = substr($spcc5dfb, 0, 16); $sp20ef79 = substr($spcc5dfb, 16); return trim(UrlAESCipher::pkcs5_unpad(mcrypt_decrypt($this->cipher, $this->key, $sp20ef79, $this->mode, $sp1c42c6))); } else { throw new Exception('Invlid params!'); } } public static function pkcs5_pad($sp2dbdda, $sp6bc36d) { $spf187c8 = $sp6bc36d - strlen($sp2dbdda) % $sp6bc36d; return $sp2dbdda . str_repeat(chr($spf187c8), $spf187c8); } public static function pkcs5_unpad($sp2dbdda) { $spf187c8 = ord($sp2dbdda[strlen($sp2dbdda) - 1]); if ($spf187c8 > strlen($sp2dbdda)) { return false; } if (strspn($sp2dbdda, chr($spf187c8), strlen($sp2dbdda) - $spf187c8) != $spf187c8) { return false; } return substr($sp2dbdda, 0, -1 * $spf187c8); } protected function base64_encode_url($sp36c362) { return strtr(base64_encode($sp36c362), '+/', '-_'); } protected function base64_decode_url($sp36c362) { return base64_decode(strtr($sp36c362, '-_', '+/')); } } class Culqi { public static $llaveSecreta; public static $codigoComercio; public static $servidorBase = 'https://pago.culqi.com'; public static function cifrar($sp3231b0) { $spadece1 = new UrlAESCipher(); $spadece1->setBase64Key(Culqi::$llaveSecreta); return $spadece1->urlBase64Encrypt($sp3231b0); } public static function decifrar($sp3231b0) { $spadece1 = new UrlAESCipher(); $spadece1->setBase64Key(Culqi::$llaveSecreta); return $spadece1->urlBase64Decrypt($sp3231b0); } } class Pago { const URL_VALIDACION_AUTORIZACION = '/api/v1/web/crear/'; const URL_ANULACION = '/api/v1/devolver/'; const URL_CONSULTA = '/api/v1/consultar/'; const PARAM_COD_COMERCIO = 'codigo_comercio'; const PARAM_EXTRA = 'extra'; const PARAM_SDK_INFO = 'sdk'; const PARAM_NUM_PEDIDO = 'numero_pedido'; const PARAM_MONTO = 'monto'; const PARAM_MONEDA = 'moneda'; const PARAM_DESCRIPCION = 'descripcion'; const PARAM_COD_PAIS = 'cod_pais'; const PARAM_CIUDAD = 'ciudad'; const PARAM_DIRECCION = 'direccion'; const PARAM_NUM_TEL = 'num_tel'; const PARAM_INFO_VENTA = 'informacion_venta'; const PARAM_TICKET = 'ticket'; const PARAM_VIGENCIA = 'vigencia'; const PARAM_CORREO_ELECTRONICO = 'correo_electronico'; const PARAM_NOMBRES = 'nombres'; const PARAM_APELLIDOS = 'apellidos'; const PARAM_ID_USUARIO_COMERCIO = 'id_usuario_comercio'; private static function getSdkInfo() { return array('v' => CULQI_SDK_VERSION, 'lng_n' => 'php', 'lng_v' => phpversion(), 'os_n' => PHP_OS, 'os_v' => php_uname()); } public static function crearDatospago($sp821fb9, $sp37cd46 = null) { Pago::validateParams($sp821fb9); $sp327f8d = Pago::getCipherData($sp821fb9, $sp37cd46); $spa944fe = array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio, Pago::PARAM_INFO_VENTA => $sp327f8d); $spd4bb0a = Pago::validateAuth($spa944fe); if (!empty($spd4bb0a) && array_key_exists(Pago::PARAM_TICKET, $spd4bb0a)) { $spd3ecee = array(Pago::PARAM_COD_COMERCIO => $spd4bb0a[Pago::PARAM_COD_COMERCIO], Pago::PARAM_TICKET => $spd4bb0a[Pago::PARAM_TICKET]); $spd4bb0a[Pago::PARAM_INFO_VENTA] = Culqi::cifrar(json_encode($spd3ecee)); } return $spd4bb0a; } public static function consultar($sp517f27) { $sp327f8d = Pago::getCipherData(array(Pago::PARAM_TICKET => $sp517f27)); $sp821fb9 = array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio, Pago::PARAM_INFO_VENTA => $sp327f8d); return Pago::postJson(Culqi::$servidorBase . Pago::URL_CONSULTA, $sp821fb9); } public static function anular($sp517f27) { $sp327f8d = Pago::getCipherData(array(Pago::PARAM_TICKET => $sp517f27)); $sp821fb9 = array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio, Pago::PARAM_INFO_VENTA => $sp327f8d); return Pago::postJson(Culqi::$servidorBase . Pago::URL_ANULACION, $sp821fb9); } private static function getCipherData($sp821fb9, $sp37cd46 = null) { $sp4c1514 = array_merge(array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio), $sp821fb9); if (!empty($sp37cd46)) { $sp4c1514[Pago::PARAM_EXTRA] = $sp37cd46; } $sp4c1514[Pago::PARAM_SDK_INFO] = Pago::getSdkInfo(); $spe828da = json_encode($sp4c1514); return Culqi::cifrar($spe828da); } private static function validateAuth($sp821fb9) { return Pago::postJson(Culqi::$servidorBase . Pago::URL_VALIDACION_AUTORIZACION, $sp821fb9); } private static function validateParams($sp821fb9) { if (!isset($sp821fb9[Pago::PARAM_MONEDA]) or empty($sp821fb9[Pago::PARAM_MONEDA])) { throw new InvalidParamsException('[Error] Debe existir una moneda'); } else { if (strlen(trim($sp821fb9[Pago::PARAM_MONEDA])) != 3) { throw new InvalidParamsException('[Error] La moneda debe contener exactamente 3 caracteres.'); } } if (!isset($sp821fb9[Pago::PARAM_MONTO]) or empty($sp821fb9[Pago::PARAM_MONTO])) { throw new InvalidParamsException('[Error] Debe existir un monto'); } else { if (is_numeric($sp821fb9[Pago::PARAM_MONTO])) { if (!ctype_digit($sp821fb9[Pago::PARAM_MONTO])) { throw new InvalidParamsException('[Error] El monto debe ser un número entero, no flotante.'); } } else { throw new InvalidParamsException('[Error] El monto debe ser un número entero.'); } } } private static function postJson($sp954ec6, $sp821fb9) { $sp2523af = array('http' => array('header' => "Content-Type: application/json\r\n" . "User-Agent: php-context\r\n", 'method' => 'POST', 'content' => json_encode($sp821fb9), 'ignore_errors' => true)); $spc35bfb = stream_context_create($sp2523af); $spd4bb0a = file_get_contents($sp954ec6, false, $spc35bfb); $spbfb5b7 = Culqi::decifrar($spd4bb0a); return json_decode($spbfb5b7, true); } } class InvalidParamsException extends Exception { }
2
+    define('CULQI_SDK_VERSION', '1.1.0'); class UrlAESCipher { protected $key; protected $cipher = MCRYPT_RIJNDAEL_128; protected $mode = MCRYPT_MODE_CBC; function __construct($spec63bf = null) { $this->setBase64Key($spec63bf); } public function setBase64Key($spec63bf) { $this->key = base64_decode($spec63bf); } private function sp42f8e2() { if ($this->key != null) { return true; } else { return false; } } private function sp4b5aaf() { return mcrypt_create_iv(16, MCRYPT_RAND); } public function urlBase64Encrypt($sp755f74) { if ($this->sp42f8e2()) { $sp6bc36d = mcrypt_get_block_size($this->cipher, $this->mode); $sp810031 = UrlAESCipher::pkcs5_pad($sp755f74, $sp6bc36d); $sp1c42c6 = $this->sp4b5aaf(); return trim(UrlAESCipher::base64_encode_url($sp1c42c6.mcrypt_encrypt($this->cipher, $this->key, $sp810031, $this->mode, $sp1c42c6))); } else { throw new Exception('Invlid params!'); } } public function urlBase64Decrypt($sp755f74) { if ($this->sp42f8e2()) { $spcc5dfb = UrlAESCipher::base64_decode_url($sp755f74); $sp1c42c6 = substr($spcc5dfb, 0, 16); $sp20ef79 = substr($spcc5dfb, 16); return trim(UrlAESCipher::pkcs5_unpad(mcrypt_decrypt($this->cipher, $this->key, $sp20ef79, $this->mode, $sp1c42c6))); } else { throw new Exception('Invlid params!'); } } public static function pkcs5_pad($sp2dbdda, $sp6bc36d) { $spf187c8 = $sp6bc36d - strlen($sp2dbdda) % $sp6bc36d; return $sp2dbdda.str_repeat(chr($spf187c8), $spf187c8); } public static function pkcs5_unpad($sp2dbdda) { $spf187c8 = ord($sp2dbdda[strlen($sp2dbdda) - 1]); if ($spf187c8 > strlen($sp2dbdda)) { return false; } if (strspn($sp2dbdda, chr($spf187c8), strlen($sp2dbdda) - $spf187c8) != $spf187c8) { return false; } return substr($sp2dbdda, 0, -1 * $spf187c8); } protected function base64_encode_url($sp36c362) { return strtr(base64_encode($sp36c362), '+/', '-_'); } protected function base64_decode_url($sp36c362) { return base64_decode(strtr($sp36c362, '-_', '+/')); } } class Culqi { public static $llaveSecreta; public static $codigoComercio; public static $servidorBase = 'https://pago.culqi.com'; public static function cifrar($sp3231b0) { $spadece1 = new UrlAESCipher(); $spadece1->setBase64Key(Culqi::$llaveSecreta); return $spadece1->urlBase64Encrypt($sp3231b0); } public static function decifrar($sp3231b0) { $spadece1 = new UrlAESCipher(); $spadece1->setBase64Key(Culqi::$llaveSecreta); return $spadece1->urlBase64Decrypt($sp3231b0); } } class Pago { const URL_VALIDACION_AUTORIZACION = '/api/v1/web/crear/'; const URL_ANULACION = '/api/v1/devolver/'; const URL_CONSULTA = '/api/v1/consultar/'; const PARAM_COD_COMERCIO = 'codigo_comercio'; const PARAM_EXTRA = 'extra'; const PARAM_SDK_INFO = 'sdk'; const PARAM_NUM_PEDIDO = 'numero_pedido'; const PARAM_MONTO = 'monto'; const PARAM_MONEDA = 'moneda'; const PARAM_DESCRIPCION = 'descripcion'; const PARAM_COD_PAIS = 'cod_pais'; const PARAM_CIUDAD = 'ciudad'; const PARAM_DIRECCION = 'direccion'; const PARAM_NUM_TEL = 'num_tel'; const PARAM_INFO_VENTA = 'informacion_venta'; const PARAM_TICKET = 'ticket'; const PARAM_VIGENCIA = 'vigencia'; const PARAM_CORREO_ELECTRONICO = 'correo_electronico'; const PARAM_NOMBRES = 'nombres'; const PARAM_APELLIDOS = 'apellidos'; const PARAM_ID_USUARIO_COMERCIO = 'id_usuario_comercio'; private static function getSdkInfo() { return array('v' => CULQI_SDK_VERSION, 'lng_n' => 'php', 'lng_v' => phpversion(), 'os_n' => PHP_OS, 'os_v' => php_uname()); } public static function crearDatospago($sp821fb9, $sp37cd46 = null) { Pago::validateParams($sp821fb9); $sp327f8d = Pago::getCipherData($sp821fb9, $sp37cd46); $spa944fe = array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio, Pago::PARAM_INFO_VENTA => $sp327f8d); $spd4bb0a = Pago::validateAuth($spa944fe); if (!empty($spd4bb0a) && array_key_exists(Pago::PARAM_TICKET, $spd4bb0a)) { $spd3ecee = array(Pago::PARAM_COD_COMERCIO => $spd4bb0a[Pago::PARAM_COD_COMERCIO], Pago::PARAM_TICKET => $spd4bb0a[Pago::PARAM_TICKET]); $spd4bb0a[Pago::PARAM_INFO_VENTA] = Culqi::cifrar(json_encode($spd3ecee)); } return $spd4bb0a; } public static function consultar($sp517f27) { $sp327f8d = Pago::getCipherData(array(Pago::PARAM_TICKET => $sp517f27)); $sp821fb9 = array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio, Pago::PARAM_INFO_VENTA => $sp327f8d); return Pago::postJson(Culqi::$servidorBase.Pago::URL_CONSULTA, $sp821fb9); } public static function anular($sp517f27) { $sp327f8d = Pago::getCipherData(array(Pago::PARAM_TICKET => $sp517f27)); $sp821fb9 = array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio, Pago::PARAM_INFO_VENTA => $sp327f8d); return Pago::postJson(Culqi::$servidorBase.Pago::URL_ANULACION, $sp821fb9); } private static function getCipherData($sp821fb9, $sp37cd46 = null) { $sp4c1514 = array_merge(array(Pago::PARAM_COD_COMERCIO => Culqi::$codigoComercio), $sp821fb9); if (!empty($sp37cd46)) { $sp4c1514[Pago::PARAM_EXTRA] = $sp37cd46; } $sp4c1514[Pago::PARAM_SDK_INFO] = Pago::getSdkInfo(); $spe828da = json_encode($sp4c1514); return Culqi::cifrar($spe828da); } private static function validateAuth($sp821fb9) { return Pago::postJson(Culqi::$servidorBase.Pago::URL_VALIDACION_AUTORIZACION, $sp821fb9); } private static function validateParams($sp821fb9) { if (!isset($sp821fb9[Pago::PARAM_MONEDA]) or empty($sp821fb9[Pago::PARAM_MONEDA])) { throw new InvalidParamsException('[Error] Debe existir una moneda'); } else { if (strlen(trim($sp821fb9[Pago::PARAM_MONEDA])) != 3) { throw new InvalidParamsException('[Error] La moneda debe contener exactamente 3 caracteres.'); } } if (!isset($sp821fb9[Pago::PARAM_MONTO]) or empty($sp821fb9[Pago::PARAM_MONTO])) { throw new InvalidParamsException('[Error] Debe existir un monto'); } else { if (is_numeric($sp821fb9[Pago::PARAM_MONTO])) { if (!ctype_digit($sp821fb9[Pago::PARAM_MONTO])) { throw new InvalidParamsException('[Error] El monto debe ser un número entero, no flotante.'); } } else { throw new InvalidParamsException('[Error] El monto debe ser un número entero.'); } } } private static function postJson($sp954ec6, $sp821fb9) { $sp2523af = array('http' => array('header' => "Content-Type: application/json\r\n"."User-Agent: php-context\r\n", 'method' => 'POST', 'content' => json_encode($sp821fb9), 'ignore_errors' => true)); $spc35bfb = stream_context_create($sp2523af); $spd4bb0a = file_get_contents($sp954ec6, false, $spc35bfb); $spbfb5b7 = Culqi::decifrar($spd4bb0a); return json_decode($spbfb5b7, true); } } class InvalidParamsException extends Exception { }
Please login to merge, or discard this patch.
plugin/buycourses/src/service_information.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 }
30 30
 
31 31
 $template = new Template(false);
32
-$template->assign('pageUrl', api_get_path(WEB_PATH) . "service/{$serviceId}/information/");
32
+$template->assign('pageUrl', api_get_path(WEB_PATH)."service/{$serviceId}/information/");
33 33
 $template->assign('service', $service);
34 34
 $template->assign('essence', Essence\Essence::instance());
35 35
 
Please login to merge, or discard this patch.
plugin/buycourses/src/service_process.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 require_once '../config.php';
14 14
 
15 15
 if (!isset($_REQUEST['t'], $_REQUEST['i'])) {
16
-    header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
16
+    header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
17 17
 }
18 18
 
19 19
 $currentUserId = api_get_user_id();
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 $typeUser = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_USER;
38 38
 $typeCourse = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_COURSE;
39 39
 $typeSession = intval($_REQUEST['t']) === BuyCoursesPlugin::SERVICE_TYPE_SESSION;
40
-$queryString = 'i=' . intval($_REQUEST['i']) . '&t=' . intval($_REQUEST['t']).$additionalQueryString;
40
+$queryString = 'i='.intval($_REQUEST['i']).'&t='.intval($_REQUEST['t']).$additionalQueryString;
41 41
 
42 42
 $serviceInfo = $plugin->getServices(intval($_REQUEST['i']));
43 43
 $userInfo = api_get_user_info($currentUserId);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         Display::addFlash(
52 52
             Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
53 53
         );
54
-        header('Location:' . api_get_self() . '?' . $queryString);
54
+        header('Location:'.api_get_self().'?'.$queryString);
55 55
         exit;
56 56
     }
57 57
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         Display::addFlash(
60 60
             Display::return_message($plugin->get_lang('AdditionalInfoRequired'), 'error', false)
61 61
         );
62
-        header('Location:' . api_get_self() . '?' . $queryString);
62
+        header('Location:'.api_get_self().'?'.$queryString);
63 63
         exit;
64 64
     }
65 65
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         Display::addFlash(
70 70
             Display::return_message($plugin->get_lang('StoreNameAlreadyExist'), 'error', false)
71 71
         );
72
-        header('Location:' . api_get_self() . '?' . $queryString);
72
+        header('Location:'.api_get_self().'?'.$queryString);
73 73
         exit;
74 74
     }
75 75
     
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 
108 108
                 unset($_SESSION['bc_service_sale_id']);
109 109
 
110
-                header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/package_panel.php?id='.$serviceSale['id']);
110
+                header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/package_panel.php?id='.$serviceSale['id']);
111 111
                 exit;
112 112
             }
113 113
         }
114 114
         
115 115
         if ($wizard) {
116
-            header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_process_confirm.php?from=register');
116
+            header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_process_confirm.php?from=register');
117 117
         } else {
118
-            header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_process_confirm.php');
118
+            header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_process_confirm.php');
119 119
         }
120 120
     }
121 121
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 if ($typeUser) {
138 138
     $users = $em->getRepository('ChamiloUserBundle:User')->findAll();
139
-    $selectOptions[$userInfo['user_id']] = api_get_person_name($userInfo['firstname'], $userInfo['lastname']) . ' (' . get_lang('Myself') . ')';
139
+    $selectOptions[$userInfo['user_id']] = api_get_person_name($userInfo['firstname'], $userInfo['lastname']).' ('.get_lang('Myself').')';
140 140
     if (!empty($users)) {
141 141
         foreach ($users as $user) {
142 142
             if (intval($userInfo['user_id']) !== intval($user->getId())) {
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
     $trial = intval($serviceInfo['allow_trial']);
168 168
 
169 169
     if ($trial) {
170
-        $trialTime = $serviceInfo['trial_period'] == 'Month' ? get_lang($serviceInfo['trial_period']) . '(es)' : get_lang($serviceInfo['trial_period']) . '(s)';
170
+        $trialTime = $serviceInfo['trial_period'] == 'Month' ? get_lang($serviceInfo['trial_period']).'(es)' : get_lang($serviceInfo['trial_period']).'(s)';
171 171
         $form->addHtml('
172 172
             <div class="form-group ">
173 173
                 <label for="qf_373cc5" class="col-sm-6">
174
-                    ' . sprintf($plugin->get_lang('EnableTrialSubscription'), $serviceInfo['trial_frequency'] . ' ' . $trialTime) . '
174
+                    ' . sprintf($plugin->get_lang('EnableTrialSubscription'), $serviceInfo['trial_frequency'].' '.$trialTime).'
175 175
                 </label>
176 176
                 <div class="col-sm-6">
177 177
                     <input cols-size="" name="enable_trial" value="1" id="qf_373cc5" type="checkbox"></div>
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             </div>
180 180
             <div class="form-group ">
181 181
                 <div class="col-sm-12">
182
-                    <p class="help-block">' . sprintf($plugin->get_lang('EnableTrialSubscriptionHelpText'), $serviceInfo['trial_frequency'] . ' ' . $trialTime) . '</p>
182
+                    <p class="help-block">' . sprintf($plugin->get_lang('EnableTrialSubscriptionHelpText'), $serviceInfo['trial_frequency'].' '.$trialTime).'</p>
183 183
                 </div>
184 184
             </div>
185 185
         ');
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     $form->addHtml('
191 191
         <div class="form-group">
192 192
             <div class="col-sm-2 pull-right">
193
-                <a id="code-checker" class="btn btn-xs btn-warning">' . $plugin->get_lang('Check') . '</a>
193
+                <a id="code-checker" class="btn btn-xs btn-warning">' . $plugin->get_lang('Check').'</a>
194 194
             </div>
195 195
             <div id="code-verificator-text" class="col-sm-4 pull-right">
196 196
             </div>
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         </div>
201 201
         <div class="form-group">
202 202
             <div class="col-sm-12">
203
-                <p class="help-block">' . $plugin->get_lang('DiscountCodeInfoText') . '</p>
203
+                <p class="help-block">' . $plugin->get_lang('DiscountCodeInfoText').'</p>
204 204
             </div>
205 205
         </div>
206 206
     ');
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 $tpl = new Template($templateName);
220 220
 if (isset($_GET['from'])) {
221
-    if($_GET['from'] == 'register') {
221
+    if ($_GET['from'] == 'register') {
222 222
         $tpl->assign('wizard', true);
223 223
     }
224 224
 }
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 1 patch
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                     return $msg;
178 178
                 }
179 179
             } else {
180
-                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='" . $name . "'");
180
+                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'");
181 181
                 if (Database::num_rows($rs)) {
182 182
                     $msg = get_lang('SessionNameAlreadyExists');
183 183
                     return $msg;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     public static function session_name_exists($name)
291 291
     {
292 292
         $name = Database::escape_string($name);
293
-        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
293
+        $sql = "SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)."
294 294
                 WHERE name = '$name'";
295 295
         $result = Database::fetch_array(Database::query($sql));
296 296
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             $where .= " AND (
322 322
                             s.session_admin_id = $user_id  OR
323 323
                             sru.user_id = '$user_id' AND
324
-                            sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
324
+                            sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
325 325
                             )
326 326
                       ";
327 327
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             $where_condition = str_replace('category_name', 'sc.name', $where_condition);
340 340
             $where_condition = str_replace(
341 341
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
342
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
342
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
343 343
                 , $where_condition
344 344
             );
345 345
             $where_condition = str_replace(
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
             $access_url_id = api_get_current_access_url_id();
386 386
             if ($access_url_id != -1) {
387
-                $where.= " AND ar.access_url_id = $access_url_id ";
387
+                $where .= " AND ar.access_url_id = $access_url_id ";
388 388
 
389 389
                 $sql = "SELECT count(id) as total_rows FROM (
390 390
                 SELECT DISTINCT
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
             if (api_is_session_admin() &&
435 435
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
436 436
             ) {
437
-                $where .=" AND s.session_admin_id = $user_id ";
437
+                $where .= " AND s.session_admin_id = $user_id ";
438 438
             }
439 439
         }
440 440
 
441 441
         if (!api_is_platform_admin() && api_is_teacher() &&
442 442
             api_get_setting('allow_teachers_to_create_sessions') == 'true'
443 443
         ) {
444
-            $where .=" AND s.id_coach = $user_id ";
444
+            $where .= " AND s.id_coach = $user_id ";
445 445
         }
446 446
 
447 447
         $extra_field = new ExtraFieldModel('session');
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
         $query = "$select FROM $tbl_session s $inject_joins $where $inject_where";
493 493
 
494 494
         if (api_is_multiple_url_enabled()) {
495
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
495
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
496 496
             $access_url_id = api_get_current_access_url_id();
497 497
             if ($access_url_id != -1) {
498
-                $where.= " AND ar.access_url_id = $access_url_id ";
498
+                $where .= " AND ar.access_url_id = $access_url_id ";
499 499
                 $query = "$select
500 500
                         FROM $tbl_session s $inject_joins
501 501
                         INNER JOIN $table_access_url_rel_session ar
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                 INNER JOIN $tbl_lp l ON l.id = v.lp_id
600 600
                 INNER JOIN $tbl_user u ON u.user_id = v.user_id
601 601
                 INNER JOIN $tbl_course c
602
-                WHERE v.session_id = " . $sessionId;
602
+                WHERE v.session_id = ".$sessionId;
603 603
         $result_rows = Database::query($sql);
604 604
         $row = Database::fetch_array($result_rows);
605 605
         $num = $row['total_rows'];
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 
652 652
         $limit = null;
653 653
         if (!empty($options['limit'])) {
654
-            $limit = " LIMIT " . $options['limit'];
654
+            $limit = " LIMIT ".$options['limit'];
655 655
         }
656 656
 
657 657
         if (!empty($options['where'])) {
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
         $order = null;
662 662
         if (!empty($options['order'])) {
663
-            $order = " ORDER BY " . $options['order'];
663
+            $order = " ORDER BY ".$options['order'];
664 664
         }
665 665
 
666 666
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
             foreach ($lessons as $lesson) {
720 720
                 $data[$lesson['id']] = (!empty($user_lessons[$lesson['id']]['progress'])) ? $user_lessons[$lesson['id']]['progress'] : 0;
721 721
                 $progress += $data[$lesson['id']];
722
-                $data[$lesson['id']] = $data[$lesson['id']] . '%';
722
+                $data[$lesson['id']] = $data[$lesson['id']].'%';
723 723
                 $count++;
724 724
             }
725 725
             if ($count == 0) {
726 726
                 $data['total'] = 0;
727 727
             } else {
728
-                $data['total'] = round($progress / $count, 2) . '%';
728
+                $data['total'] = round($progress / $count, 2).'%';
729 729
             }
730 730
             $table[] = $data;
731 731
         }
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
         $limit = null;
768 768
         if (!empty($options['limit'])) {
769
-            $limit = " LIMIT " . $options['limit'];
769
+            $limit = " LIMIT ".$options['limit'];
770 770
         }
771 771
 
772 772
         if (!empty($options['where'])) {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
         $order = null;
777 777
         if (!empty($options['order'])) {
778
-            $order = " ORDER BY " . $options['order'];
778
+            $order = " ORDER BY ".$options['order'];
779 779
         }
780 780
 
781 781
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 
878 878
         $limit = null;
879 879
         if (!empty($options['limit'])) {
880
-            $limit = " LIMIT " . $options['limit'];
880
+            $limit = " LIMIT ".$options['limit'];
881 881
         }
882 882
 
883 883
         if (!empty($options['where'])) {
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 
887 887
         $order = null;
888 888
         if (!empty($options['order'])) {
889
-            $order = " ORDER BY " . $options['order'];
889
+            $order = " ORDER BY ".$options['order'];
890 890
         }
891 891
 
892 892
         //TODO, fix create report without session
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
         /**
920 920
          *  Lessons
921 921
          */
922
-        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s ";  //AND session_id = %s
922
+        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s
923 923
         $sql_query = sprintf($sql, $course['real_id']);
924 924
         $result = Database::query($sql_query);
925 925
         $arrLesson = array(array());
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
             if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
928 928
                 $arrLesson[$row['session_id']]['lessons_total'] = 1;
929 929
             } else {
930
-                $arrLesson[$row['session_id']]['lessons_total'] ++;
930
+                $arrLesson[$row['session_id']]['lessons_total']++;
931 931
             }
932 932
         }
933 933
 
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
                 $course['real_id']
1004 1004
             );
1005 1005
             foreach ($user_list as $user_id) {
1006
-                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id] ++ : $survey_user_list[$user_id] = 1;
1006
+                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
1007 1007
             }
1008 1008
         }
1009 1009
 
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
             $assignments_done = Tracking::count_student_assignments($user['user_id'], $course['code'], $user['id_session']);
1058 1058
             $assignments_left = $assignments_total - $assignments_done;
1059 1059
             if (!empty($assignments_total)) {
1060
-                $assignments_progress = round((( $assignments_done * 100 ) / $assignments_total), 2);
1060
+                $assignments_progress = round((($assignments_done * 100) / $assignments_total), 2);
1061 1061
             } else {
1062 1062
                 $assignments_progress = 0;
1063 1063
             }
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
             $wiki_read = $row['count'];
1088 1088
             $wiki_unread = $wiki_total - $wiki_read;
1089 1089
             if (!empty($wiki_total)) {
1090
-                $wiki_progress = round((( $wiki_read * 100 ) / $wiki_total), 2);
1090
+                $wiki_progress = round((($wiki_read * 100) / $wiki_total), 2);
1091 1091
             } else {
1092 1092
                 $wiki_progress = 0;
1093 1093
             }
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
             $surveys_done = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0);
1097 1097
             $surveys_left = $surveys_total - $surveys_done;
1098 1098
             if (!empty($surveys_total)) {
1099
-                $surveys_progress = round((( $surveys_done * 100 ) / $surveys_total), 2);
1099
+                $surveys_progress = round((($surveys_done * 100) / $surveys_total), 2);
1100 1100
             } else {
1101 1101
                 $surveys_progress = 0;
1102 1102
             }
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
             );
1110 1110
             $forums_left = $forums_total - $forums_done;
1111 1111
             if (!empty($forums_total)) {
1112
-                $forums_progress = round((( $forums_done * 100 ) / $forums_total), 2);
1112
+                $forums_progress = round((($forums_done * 100) / $forums_total), 2);
1113 1113
             } else {
1114 1114
                 $forums_progress = 0;
1115 1115
             }
@@ -1117,58 +1117,58 @@  discard block
 block discarded – undo
1117 1117
             //Overall Total
1118 1118
             $overall_total = ($course_description_progress + $exercises_progress + $forums_progress + $assignments_progress + $wiki_progress + $surveys_progress) / 6;
1119 1119
 
1120
-            $link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . $user[0] . '&details=true&course=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1121
-            $linkForum = '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1122
-            $linkWork = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1123
-            $linkWiki = '<a href="' . api_get_path(WEB_CODE_PATH) . 'wiki/index.php?cidReq=' . $course['code'] . '&session_id=' . $user['id_session'] . '&action=statistics"> %s </a>';
1124
-            $linkSurvey = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1120
+            $link = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user[0].'&details=true&course='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1121
+            $linkForum = '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1122
+            $linkWork = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1123
+            $linkWiki = '<a href="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?cidReq='.$course['code'].'&session_id='.$user['id_session'].'&action=statistics"> %s </a>';
1124
+            $linkSurvey = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1125 1125
 
1126 1126
             $table[] = array(
1127 1127
                 'lastname' => $user[1],
1128 1128
                 'firstname' => $user[2],
1129 1129
                 'username' => $user[3],
1130 1130
                 #'profile'   => '',
1131
-                'total' => round($overall_total, 2) . '%',
1132
-                'courses' => sprintf($link, $course_description_progress . '%'),
1133
-                'lessons' => sprintf($link, $lessons_progress . '%'),
1134
-                'exercises' => sprintf($link, $exercises_progress . '%'),
1135
-                'forums' => sprintf($link, $forums_progress . '%'),
1136
-                'homeworks' => sprintf($link, $assignments_progress . '%'),
1137
-                'wikis' => sprintf($link, $wiki_progress . '%'),
1138
-                'surveys' => sprintf($link, $surveys_progress . '%'),
1131
+                'total' => round($overall_total, 2).'%',
1132
+                'courses' => sprintf($link, $course_description_progress.'%'),
1133
+                'lessons' => sprintf($link, $lessons_progress.'%'),
1134
+                'exercises' => sprintf($link, $exercises_progress.'%'),
1135
+                'forums' => sprintf($link, $forums_progress.'%'),
1136
+                'homeworks' => sprintf($link, $assignments_progress.'%'),
1137
+                'wikis' => sprintf($link, $wiki_progress.'%'),
1138
+                'surveys' => sprintf($link, $surveys_progress.'%'),
1139 1139
                 //course description
1140
-                'course_description_progress' => $course_description_progress . '%',
1140
+                'course_description_progress' => $course_description_progress.'%',
1141 1141
                 //lessons
1142 1142
                 'lessons_total' => sprintf($link, $lessons_total),
1143 1143
                 'lessons_done' => sprintf($link, $lessons_done),
1144 1144
                 'lessons_left' => sprintf($link, $lessons_left),
1145
-                'lessons_progress' => sprintf($link, $lessons_progress . '%'),
1145
+                'lessons_progress' => sprintf($link, $lessons_progress.'%'),
1146 1146
                 //exercises
1147 1147
                 'exercises_total' => sprintf($link, $exercises_total),
1148 1148
                 'exercises_done' => sprintf($link, $exercises_done),
1149 1149
                 'exercises_left' => sprintf($link, $exercises_left),
1150
-                'exercises_progress' => sprintf($link, $exercises_progress . '%'),
1150
+                'exercises_progress' => sprintf($link, $exercises_progress.'%'),
1151 1151
                 //forums
1152 1152
                 'forums_total' => sprintf($linkForum, $forums_total),
1153 1153
                 'forums_done' => sprintf($linkForum, $forums_done),
1154 1154
                 'forums_left' => sprintf($linkForum, $forums_left),
1155
-                'forums_progress' => sprintf($linkForum, $forums_progress . '%'),
1155
+                'forums_progress' => sprintf($linkForum, $forums_progress.'%'),
1156 1156
                 //assignments
1157 1157
                 'assignments_total' => sprintf($linkWork, $assignments_total),
1158 1158
                 'assignments_done' => sprintf($linkWork, $assignments_done),
1159 1159
                 'assignments_left' => sprintf($linkWork, $assignments_left),
1160
-                'assignments_progress' => sprintf($linkWork, $assignments_progress . '%'),
1160
+                'assignments_progress' => sprintf($linkWork, $assignments_progress.'%'),
1161 1161
                 //wiki
1162 1162
                 'wiki_total' => sprintf($linkWiki, $wiki_total),
1163 1163
                 'wiki_revisions' => sprintf($linkWiki, $wiki_revisions),
1164 1164
                 'wiki_read' => sprintf($linkWiki, $wiki_read),
1165 1165
                 'wiki_unread' => sprintf($linkWiki, $wiki_unread),
1166
-                'wiki_progress' => sprintf($linkWiki, $wiki_progress . '%'),
1166
+                'wiki_progress' => sprintf($linkWiki, $wiki_progress.'%'),
1167 1167
                 //survey
1168 1168
                 'surveys_total' => sprintf($linkSurvey, $surveys_total),
1169 1169
                 'surveys_done' => sprintf($linkSurvey, $surveys_done),
1170 1170
                 'surveys_left' => sprintf($linkSurvey, $surveys_left),
1171
-                'surveys_progress' => sprintf($linkSurvey, $surveys_progress . '%'),
1171
+                'surveys_progress' => sprintf($linkSurvey, $surveys_progress.'%'),
1172 1172
             );
1173 1173
         }
1174 1174
 
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
         $limit = null;
1252 1252
         if (!empty($options['limit'])) {
1253
-            $limit = " LIMIT " . $options['limit'];
1253
+            $limit = " LIMIT ".$options['limit'];
1254 1254
         }
1255 1255
 
1256 1256
         if (!empty($options['where'])) {
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
         $order = null;
1261 1261
         if (!empty($options['order'])) {
1262
-            $order = " ORDER BY " . $options['order'];
1262
+            $order = " ORDER BY ".$options['order'];
1263 1263
         }
1264 1264
 
1265 1265
         //TODO add course name
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
                     " : "
1273 1273
                     u.lastname,
1274 1274
                     u.firstname,
1275
-                ") . "
1275
+                ")."
1276 1276
                 a.logout_course_date,
1277 1277
                 a.counter,
1278 1278
                 c.title,
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
             if (Database::num_rows($result) > 0) {
1355 1355
                 $row = Database::fetch_array($result);
1356 1356
                 $count = $row['count'] + 1;
1357
-                $session_name = $session_name . '_' . $count;
1357
+                $session_name = $session_name.'_'.$count;
1358 1358
                 $result = self::session_name_exists($session_name);
1359 1359
                 if (!$result) {
1360 1360
                     return $session_name;
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
         // Delete users from the session
1862 1862
         if ($empty_users === true) {
1863 1863
             $sql = "DELETE FROM $tbl_session_rel_user
1864
-                    WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
1864
+                    WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."";
1865 1865
             Database::query($sql);
1866 1866
         }
1867 1867
 
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
             $enreg_user = Database::escape_string($enreg_user);
1873 1873
             $nbr_users++;
1874 1874
             $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1875
-                    VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
1875
+                    VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
1876 1876
             Database::query($sql);
1877 1877
         }
1878 1878
 
@@ -1962,9 +1962,9 @@  discard block
 block discarded – undo
1962 1962
         is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo;
1963 1963
 
1964 1964
         $statusCondition = null;
1965
-        if (isset($status) && !is_null($status))  {
1965
+        if (isset($status) && !is_null($status)) {
1966 1966
             $status = intval($status);
1967
-            $statusCondition  = " AND status = $status";
1967
+            $statusCondition = " AND status = $status";
1968 1968
         }
1969 1969
 
1970 1970
         foreach ($userList as $userId) {
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
             if (empty($count)) {
2097 2097
                 // If user is not registered to a session then add it.
2098 2098
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
2099
-                        VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
2099
+                        VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
2100 2100
                 Database::query($sql);
2101 2101
 
2102 2102
                 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
                 WHERE
2140 2140
                     session_id = $session_id AND
2141 2141
                     user_id = $user_id AND
2142
-                    relation_type <> " . SESSION_RELATION_TYPE_RRHH . "";
2142
+                    relation_type <> ".SESSION_RELATION_TYPE_RRHH."";
2143 2143
         $result = Database::query($sql);
2144 2144
         $return = Database::affected_rows($result);
2145 2145
 
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
                 FROM $tbl_session_rel_user
2225 2225
                 WHERE
2226 2226
                     session_id = $sessionId AND
2227
-                    relation_type<>" . SESSION_RELATION_TYPE_RRHH;
2227
+                    relation_type<>".SESSION_RELATION_TYPE_RRHH;
2228 2228
         $result = Database::query($sql);
2229 2229
         $user_list = Database::store_result($result);
2230 2230
 
@@ -2235,7 +2235,7 @@  discard block
 block discarded – undo
2235 2235
 
2236 2236
                     $sql = "DELETE FROM $tbl_session_rel_course
2237 2237
                             WHERE
2238
-                                c_id = " . $existingCourse['c_id'] . " AND
2238
+                                c_id = ".$existingCourse['c_id']." AND
2239 2239
                                 session_id = $sessionId";
2240 2240
                     Database::query($sql);
2241 2241
 
@@ -2298,7 +2298,7 @@  discard block
 block discarded – undo
2298 2298
                             $links = $cat->get_links(null, false, $courseInfo['code'], 0);
2299 2299
 
2300 2300
                             $cat->set_session_id($sessionId);
2301
-                            $oldCategoryId= $cat->get_id();
2301
+                            $oldCategoryId = $cat->get_id();
2302 2302
                             $newId = $cat->add();
2303 2303
                             $newCategoryIdList[$oldCategoryId] = $newId;
2304 2304
                             $parentId = $cat->get_parent_id();
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
         $return_value = false;
2486 2486
         $sql = "SELECT c_id FROM $tbl_session_course
2487 2487
                 WHERE
2488
-                  session_id = " . intval($session_id) . " AND
2488
+                  session_id = ".intval($session_id)." AND
2489 2489
                   c_id = " . intval($courseId);
2490 2490
         $result = Database::query($sql);
2491 2491
         $num = Database::num_rows($result);
@@ -2509,8 +2509,8 @@  discard block
 block discarded – undo
2509 2509
         }
2510 2510
 
2511 2511
         $sql = 'SELECT *
2512
-		        FROM ' . $tbl_session . '
2513
-		        WHERE name = "' . Database::escape_string($session_name) . '"';
2512
+		        FROM ' . $tbl_session.'
2513
+		        WHERE name = "' . Database::escape_string($session_name).'"';
2514 2514
         $result = Database::query($sql);
2515 2515
         $num = Database::num_rows($result);
2516 2516
         if ($num > 0) {
@@ -2550,8 +2550,8 @@  discard block
 block discarded – undo
2550 2550
         $month_end = intval($smonth_end);
2551 2551
         $day_end = intval($sday_end);
2552 2552
 
2553
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2554
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2553
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2554
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2555 2555
 
2556 2556
         if (empty($name)) {
2557 2557
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2628,8 +2628,8 @@  discard block
 block discarded – undo
2628 2628
         $month_end = intval($smonth_end);
2629 2629
         $day_end = intval($sday_end);
2630 2630
         $id = intval($id);
2631
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2632
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2631
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2632
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2633 2633
 
2634 2634
         if (empty($name)) {
2635 2635
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2649,13 +2649,13 @@  discard block
 block discarded – undo
2649 2649
         if ($date_end <> null) {
2650 2650
             $sql = "UPDATE $tbl_session_category
2651 2651
                     SET
2652
-                        name = '" . Database::escape_string($name) . "',
2652
+                        name = '".Database::escape_string($name)."',
2653 2653
                         date_start = '$date_start' ,
2654 2654
                         date_end = '$date_end'
2655 2655
                     WHERE id= $id";
2656 2656
         } else {
2657 2657
             $sql = "UPDATE $tbl_session_category SET
2658
-                        name = '" . Database::escape_string($name) . "',
2658
+                        name = '".Database::escape_string($name)."',
2659 2659
                         date_start = '$date_start',
2660 2660
                         date_end = NULL
2661 2661
                     WHERE id= $id";
@@ -2685,10 +2685,10 @@  discard block
 block discarded – undo
2685 2685
 
2686 2686
         //Setting session_category_id to 0
2687 2687
         $sql = "UPDATE $tbl_session SET session_category_id = 0
2688
-                WHERE session_category_id IN (" . $id_checked . ")";
2688
+                WHERE session_category_id IN (".$id_checked.")";
2689 2689
         Database::query($sql);
2690 2690
 
2691
-        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")";
2691
+        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
2692 2692
         $result = Database::query($sql);
2693 2693
         while ($rows = Database::fetch_array($result)) {
2694 2694
             $session_id = $rows['id'];
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
                 }
2701 2701
             }
2702 2702
         }
2703
-        $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")";
2703
+        $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")";
2704 2704
         Database::query($sql);
2705 2705
 
2706 2706
         // Add event to system log
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
                 $value = Database::escape_string($options['value']);
2774 2774
                 $sql_query .= ' AND ';
2775 2775
                 if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) {
2776
-                    $sql_query .= $field . " $operator '" . $value . "'";
2776
+                    $sql_query .= $field." $operator '".$value."'";
2777 2777
                 }
2778 2778
             }
2779 2779
         }
@@ -2840,8 +2840,8 @@  discard block
 block discarded – undo
2840 2840
     {
2841 2841
         $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2842 2842
         $id = api_get_current_access_url_id();
2843
-        $sql = 'SELECT * FROM ' . $tbl_session_category . '
2844
-                WHERE access_url_id = ' . $id . '
2843
+        $sql = 'SELECT * FROM '.$tbl_session_category.'
2844
+                WHERE access_url_id = ' . $id.'
2845 2845
                 ORDER BY name ASC';
2846 2846
         $result = Database::query($sql);
2847 2847
         if (Database::num_rows($result) > 0) {
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
         $sql = "DELETE FROM $tbl_session_rel_user
2995 2995
                 WHERE
2996 2996
                     session_id = $sessionId AND                            
2997
-                    relation_type =" . SESSION_RELATION_TYPE_RRHH;
2997
+                    relation_type =".SESSION_RELATION_TYPE_RRHH;
2998 2998
         Database::query($sql);
2999 2999
 
3000 3000
         return true;
@@ -3048,12 +3048,12 @@  discard block
 block discarded – undo
3048 3048
                         ON (a.session_id = s.session_id)
3049 3049
                         WHERE
3050 3050
                             s.user_id = $userId AND
3051
-                            relation_type = " . SESSION_RELATION_TYPE_RRHH . " AND
3051
+                            relation_type = ".SESSION_RELATION_TYPE_RRHH." AND
3052 3052
                             access_url_id = " . api_get_current_access_url_id();
3053 3053
             } else {
3054 3054
                 $sql = "SELECT s.session_id 
3055 3055
                         FROM $tbl_session_rel_user s
3056
-                        WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH;
3056
+                        WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH;
3057 3057
             }
3058 3058
             $result = Database::query($sql);
3059 3059
 
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
                             WHERE
3064 3064
                                 session_id = {$row['session_id']} AND
3065 3065
                                 user_id = $userId AND
3066
-                                relation_type =" . SESSION_RELATION_TYPE_RRHH;
3066
+                                relation_type =".SESSION_RELATION_TYPE_RRHH;
3067 3067
                     Database::query($sql);
3068 3068
                 }
3069 3069
             }
@@ -3077,8 +3077,8 @@  discard block
 block discarded – undo
3077 3077
                         VALUES (
3078 3078
                             $session_id,
3079 3079
                             $userId,
3080
-                            '" . SESSION_RELATION_TYPE_RRHH . "',
3081
-                            '" . api_get_utc_datetime() . "'
3080
+                            '".SESSION_RELATION_TYPE_RRHH."',
3081
+                            '" . api_get_utc_datetime()."'
3082 3082
                         )";
3083 3083
                 Database::query($sql);
3084 3084
                 $affected_rows++;
@@ -3119,8 +3119,8 @@  discard block
 block discarded – undo
3119 3119
                     WHERE
3120 3120
                         sru.user_id = '$userId' AND
3121 3121
                         sru.session_id = '$sessionId' AND
3122
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND
3123
-                        access_url_id = " . api_get_current_access_url_id() . "
3122
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
3123
+                        access_url_id = " . api_get_current_access_url_id()."
3124 3124
                         ";
3125 3125
         } else {
3126 3126
             $sql = "$select FROM $tbl_session s
@@ -3129,7 +3129,7 @@  discard block
 block discarded – undo
3129 3129
                         sru.session_id = s.id AND
3130 3130
                         sru.user_id = '$userId' AND
3131 3131
                         sru.session_id = '$sessionId' AND
3132
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
3132
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
3133 3133
                     ";
3134 3134
         }
3135 3135
 
@@ -3229,7 +3229,7 @@  discard block
 block discarded – undo
3229 3229
 
3230 3230
         $limitCondition = null;
3231 3231
         if (!empty($start) && !empty($limit)) {
3232
-            $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
3232
+            $limitCondition = " LIMIT ".intval($start).", ".intval($limit);
3233 3233
         }
3234 3234
 
3235 3235
         if (empty($orderCondition)) {
@@ -3306,26 +3306,26 @@  discard block
 block discarded – undo
3306 3306
 
3307 3307
         $sessions = array();
3308 3308
         if (Database::num_rows($result) > 0) {
3309
-            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/';
3310
-            $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/';
3309
+            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
3310
+            $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
3311 3311
             $imgPath = Display::return_icon('session_default_small.png', null, null, null, null, true);
3312 3312
 
3313 3313
             $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
3314
-            $sql = "SELECT id FROM " . $tableExtraFields . "
3314
+            $sql = "SELECT id FROM ".$tableExtraFields."
3315 3315
                     WHERE extra_field_type = 3 AND variable='image'";
3316 3316
             $resultField = Database::query($sql);
3317 3317
             $imageFieldId = Database::fetch_assoc($resultField);
3318 3318
 
3319 3319
             while ($row = Database::fetch_array($result)) {
3320 3320
 
3321
-                $row['image'] =  null;
3322
-                $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3321
+                $row['image'] = null;
3322
+                $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3323 3323
 
3324 3324
                 if (is_file($sessionImage)) {
3325
-                    $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3325
+                    $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3326 3326
                     $row['image'] = $sessionImage;
3327 3327
                 } else {
3328
-                    $row['image'] =  $imgPath;
3328
+                    $row['image'] = $imgPath;
3329 3329
                 }
3330 3330
 
3331 3331
                 if ($row['display_start_date'] == '0000-00-00 00:00:00' || $row['display_start_date'] == '0000-00-00') {
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
                 return intval($count['count']);
3426 3426
             }
3427 3427
 
3428
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3428
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3429 3429
                 $courses[$row['real_id']] = $row;
3430 3430
             }
3431 3431
         }
@@ -3469,7 +3469,7 @@  discard block
 block discarded – undo
3469 3469
         }
3470 3470
 
3471 3471
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
3472
-        $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3472
+        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3473 3473
 
3474 3474
         if ($getCount) {
3475 3475
             $select = "SELECT COUNT(DISTINCT(c.code)) as count ";
@@ -3494,7 +3494,7 @@  discard block
 block discarded – undo
3494 3494
 		        ";
3495 3495
         if ($getCount) {
3496 3496
             $result = Database::query($sql);
3497
-            $row = Database::fetch_array($result,'ASSOC');
3497
+            $row = Database::fetch_array($result, 'ASSOC');
3498 3498
             return $row['count'];
3499 3499
         }
3500 3500
 
@@ -3509,7 +3509,7 @@  discard block
 block discarded – undo
3509 3509
         $courses = array();
3510 3510
 
3511 3511
         if ($num_rows > 0) {
3512
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3512
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3513 3513
                 $courses[$row['id']] = $row;
3514 3514
             }
3515 3515
         }
@@ -3587,7 +3587,7 @@  discard block
 block discarded – undo
3587 3587
         $result = Database::query($sql);
3588 3588
         $num_rows = Database::num_rows($result);
3589 3589
         if ($num_rows > 0) {
3590
-            $row = Database::fetch_array($result,'ASSOC');
3590
+            $row = Database::fetch_array($result, 'ASSOC');
3591 3591
             return $row['count'];
3592 3592
         }
3593 3593
 
@@ -3706,9 +3706,9 @@  discard block
 block discarded – undo
3706 3706
 
3707 3707
             if ($access_url_id != -1) {
3708 3708
                 $sql = 'SELECT DISTINCT session.*
3709
-                    FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url
3709
+                    FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
3710 3710
                     ON (session.id = session_rel_url.session_id)
3711
-                    WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id;
3711
+                    WHERE '.$sqlCoach.' access_url_id = '.$access_url_id;
3712 3712
             }
3713 3713
         }
3714 3714
         $sql .= ' ORDER by name';
@@ -3742,8 +3742,8 @@  discard block
 block discarded – undo
3742 3742
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3743 3743
                 WHERE
3744 3744
                     session_rcru.user_id = user.user_id AND
3745
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3746
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3745
+                    session_rcru.session_id = '".intval($session_id)."' AND
3746
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3747 3747
                     user.user_id = " . intval($user_id);
3748 3748
 
3749 3749
         $result = Database::query($sql);
@@ -3774,8 +3774,8 @@  discard block
 block discarded – undo
3774 3774
         $sql = "SELECT session_rcru.status
3775 3775
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3776 3776
                 WHERE session_rcru.user_id = user.user_id AND
3777
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3778
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3777
+                    session_rcru.session_id = '".intval($session_id)."' AND
3778
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3779 3779
                     user.user_id = " . intval($user_id);
3780 3780
         $result = Database::query($sql);
3781 3781
         $status = false;
@@ -3852,7 +3852,7 @@  discard block
 block discarded – undo
3852 3852
         // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251
3853 3853
         $now = time() - date('Z');
3854 3854
         // Timestamp in one month
3855
-        $inOneMonth = $now + (30*24*3600);
3855
+        $inOneMonth = $now + (30 * 24 * 3600);
3856 3856
         $inOneMonth = api_get_local_time($inOneMonth);
3857 3857
         if (api_strtotime($s['access_start_date']) < $now) {
3858 3858
             $s['access_start_date'] = api_get_local_time($now);
@@ -3874,16 +3874,16 @@  discard block
 block discarded – undo
3874 3874
         }
3875 3875
         // Now try to create the session
3876 3876
         $sid = self::create_session(
3877
-            $s['name'] . ' ' . get_lang('CopyLabelSuffix'),
3877
+            $s['name'].' '.get_lang('CopyLabelSuffix'),
3878 3878
             $s['access_start_date'],
3879 3879
             $s['access_end_date'],
3880 3880
             $s['display_start_date'],
3881 3881
             $s['display_end_date'],
3882 3882
             $s['coach_access_start_date'],
3883 3883
             $s['coach_access_end_date'],
3884
-            (int)$s['id_coach'],
3884
+            (int) $s['id_coach'],
3885 3885
             $s['session_category_id'],
3886
-            (int)$s['visibility'],
3886
+            (int) $s['visibility'],
3887 3887
             true
3888 3888
         );
3889 3889
 
@@ -3997,7 +3997,7 @@  discard block
 block discarded – undo
3997 3997
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
3998 3998
         $sql = "SELECT DISTINCT id
3999 3999
 	         	FROM $session_table
4000
-	         	WHERE session.id_coach =  '" . $user_id . "' AND id = '$session_id'";
4000
+	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
4001 4001
         $result = Database::query($sql);
4002 4002
         if ($result && Database::num_rows($result)) {
4003 4003
             return true;
@@ -4016,7 +4016,7 @@  discard block
 block discarded – undo
4016 4016
         $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
4017 4017
         $sql = "SELECT count(id) FROM $session_table s";
4018 4018
         if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
4019
-            $sql .= ", $access_url_rel_session_table u " .
4019
+            $sql .= ", $access_url_rel_session_table u ".
4020 4020
                 " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
4021 4021
         }
4022 4022
         $res = Database::query($sql);
@@ -4255,7 +4255,7 @@  discard block
 block discarded – undo
4255 4255
 
4256 4256
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
4257 4257
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
4258
-        $tbl_session_course  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4258
+        $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4259 4259
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4260 4260
 
4261 4261
         $sessions = array();
@@ -4391,10 +4391,10 @@  discard block
 block discarded – undo
4391 4391
                     $suffix = null;
4392 4392
                     while (!$unique_name) {
4393 4393
                         if ($i > 1) {
4394
-                            $suffix = ' - ' . $i;
4394
+                            $suffix = ' - '.$i;
4395 4395
                         }
4396
-                        $sql = 'SELECT 1 FROM ' . $tbl_session . '
4397
-                                WHERE name="' . Database::escape_string($session_name). $suffix . '"';
4396
+                        $sql = 'SELECT 1 FROM '.$tbl_session.'
4397
+                                WHERE name="' . Database::escape_string($session_name).$suffix.'"';
4398 4398
                         $rs = Database::query($sql);
4399 4399
 
4400 4400
                         if (Database::result($rs, 0, 0)) {
@@ -4407,14 +4407,14 @@  discard block
 block discarded – undo
4407 4407
 
4408 4408
                     // Creating the session.
4409 4409
                     $sql = "INSERT IGNORE INTO $tbl_session SET
4410
-                            name = '" . Database::escape_string($session_name). "',
4410
+                            name = '".Database::escape_string($session_name)."',
4411 4411
                             id_coach = '$coach_id',
4412 4412
                             access_start_date = '$dateStart',
4413 4413
                             access_end_date = '$dateEnd',
4414 4414
                             display_start_date = '$dateStart',
4415 4415
                             display_end_date = '$dateEnd',
4416 4416
                             visibility = '$visibilityAfterExpirationPerSession',                            
4417
-                            session_admin_id = " . $defaultUserId . " 
4417
+                            session_admin_id = ".$defaultUserId." 
4418 4418
                             $sessionCondition $extraParameters $extraSessionParameters";
4419 4419
                     Database::query($sql);
4420 4420
 
@@ -4480,7 +4480,7 @@  discard block
 block discarded – undo
4480 4480
 
4481 4481
                             // Delete session-user relation only for students
4482 4482
                             $sql = "DELETE FROM $tbl_session_user
4483
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4483
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4484 4484
                             Database::query($sql);
4485 4485
 
4486 4486
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4571,7 +4571,7 @@  discard block
 block discarded – undo
4571 4571
 
4572 4572
                             // Delete session-user relation only for students
4573 4573
                             $sql = "DELETE FROM $tbl_session_user
4574
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4574
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4575 4575
                             Database::query($sql);
4576 4576
 
4577 4577
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4614,7 +4614,7 @@  discard block
 block discarded – undo
4614 4614
                             $sql = "INSERT IGNORE INTO $tbl_session_user SET
4615 4615
                                     user_id = '$user_id',
4616 4616
                                     session_id = '$session_id',
4617
-                                    registered_at = '" . api_get_utc_datetime() . "'";
4617
+                                    registered_at = '".api_get_utc_datetime()."'";
4618 4618
                             Database::query($sql);
4619 4619
                             if ($debug) {
4620 4620
                                 $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");
@@ -5265,7 +5265,7 @@  discard block
 block discarded – undo
5265 5265
 
5266 5266
         if (!empty($lastConnectionDate)) {
5267 5267
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
5268
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
5268
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
5269 5269
         }
5270 5270
 
5271 5271
         if (!empty($keyword)) {
@@ -5335,7 +5335,7 @@  discard block
 block discarded – undo
5335 5335
         $result = Database::query($sql);
5336 5336
         $result = Database::store_result($result);
5337 5337
 
5338
-        return $result ;
5338
+        return $result;
5339 5339
     }
5340 5340
 
5341 5341
     /**
@@ -5395,7 +5395,7 @@  discard block
 block discarded – undo
5395 5395
                     $userToString = null;
5396 5396
                     foreach ($userList as $userInfo) {
5397 5397
                         $newUserList[] = $userInfo['user_id'];
5398
-                        $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
5398
+                        $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />';
5399 5399
                     }
5400 5400
 
5401 5401
                     if (!empty($sessionsDestination)) {
@@ -5408,7 +5408,7 @@  discard block
 block discarded – undo
5408 5408
                                 $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
5409 5409
                                 continue;
5410 5410
                             }
5411
-                            $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
5411
+                            $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false);
5412 5412
                             SessionManager::subscribe_users_to_session(
5413 5413
                                 $sessionDestinationId,
5414 5414
                                 $newUserList,
@@ -5463,7 +5463,7 @@  discard block
 block discarded – undo
5463 5463
                 }
5464 5464
             }
5465 5465
         }
5466
-        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=';
5466
+        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session=';
5467 5467
 
5468 5468
         $htmlResult = null;
5469 5469
 
@@ -5478,7 +5478,7 @@  discard block
 block discarded – undo
5478 5478
                     $sessionInfo = self::fetch($sessionId);
5479 5479
                     $htmlResult .= '<br />';
5480 5480
                     $htmlResult .= Display::url(
5481
-                        get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank')
5481
+                        get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
5482 5482
                     );
5483 5483
                     $teacherList = array();
5484 5484
                     foreach ($coachList as $coachId) {
@@ -5591,7 +5591,7 @@  discard block
 block discarded – undo
5591 5591
                 }
5592 5592
 
5593 5593
                 $sessionIdList = array_map('intval', $sessionIdList);
5594
-                $sessionToString = implode("', '",  $sessionIdList);
5594
+                $sessionToString = implode("', '", $sessionIdList);
5595 5595
 
5596 5596
                 $course = Database::get_main_table(TABLE_MAIN_COURSE);
5597 5597
                 $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@@ -5603,7 +5603,7 @@  discard block
 block discarded – undo
5603 5603
                         INNER JOIN $courseUser cu ON (cu.c_id = c.id)
5604 5604
 		                WHERE src.session_id IN ('$sessionToString') AND cu.status = 1";
5605 5605
                 $result = Database::query($sql);
5606
-                while($row = Database::fetch_array($result, 'ASSOC')) {
5606
+                while ($row = Database::fetch_array($result, 'ASSOC')) {
5607 5607
                     $teacherListId[$row['user_id']] = $row['user_id'];
5608 5608
                 }
5609 5609
             } else {
@@ -5678,7 +5678,7 @@  discard block
 block discarded – undo
5678 5678
         $toolList = self::getCourseToolToBeManaged();
5679 5679
 
5680 5680
         foreach ($toolList as $tool) {
5681
-            $method = 'add' . $tool;
5681
+            $method = 'add'.$tool;
5682 5682
             if (method_exists(get_class(), $method)) {
5683 5683
                 self::$method($sessionId, $courseId);
5684 5684
             }
@@ -5697,7 +5697,7 @@  discard block
 block discarded – undo
5697 5697
         $toolList = self::getCourseToolToBeManaged();
5698 5698
 
5699 5699
         foreach ($toolList as $tool) {
5700
-            $method = 'remove' . $tool;
5700
+            $method = 'remove'.$tool;
5701 5701
             if (method_exists(get_class(), $method)) {
5702 5702
                 self::$method($sessionId, $courseId);
5703 5703
             }
@@ -5815,18 +5815,18 @@  discard block
 block discarded – undo
5815 5815
                         }
5816 5816
                     }
5817 5817
 
5818
-                    $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />';
5818
+                    $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />';
5819 5819
 
5820 5820
                     if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) {
5821
-                        $message .= get_lang('UserMustHaveTheDrhRole') . '<br />';
5821
+                        $message .= get_lang('UserMustHaveTheDrhRole').'<br />';
5822 5822
                         continue;
5823 5823
                     }
5824 5824
 
5825 5825
                     if (!empty($sessionList)) {
5826
-                        $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />';
5827
-                        $message .= implode(', ', $sessionList) . '<br /><br />';
5826
+                        $message .= '<strong>'.get_lang('Sessions').':</strong> <br />';
5827
+                        $message .= implode(', ', $sessionList).'<br /><br />';
5828 5828
                     } else {
5829
-                        $message .= get_lang('NoSessionProvided') . ' <br /><br />';
5829
+                        $message .= get_lang('NoSessionProvided').' <br /><br />';
5830 5830
                     }
5831 5831
                 }
5832 5832
             }
@@ -6006,8 +6006,8 @@  discard block
 block discarded – undo
6006 6006
 
6007 6007
         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
6008 6008
 
6009
-        $endDateInSeconds = $firstAccess + $duration*24*60*60;
6010
-        $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
6009
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
6010
+        $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
6011 6011
 
6012 6012
         return $leftDays;
6013 6013
     }
@@ -6299,7 +6299,7 @@  discard block
 block discarded – undo
6299 6299
                 FROM $table scu
6300 6300
                 INNER JOIN $tableUser u 
6301 6301
                 ON scu.user_id = u.id
6302
-                WHERE scu.session_id = " . intval($sessionId) ."
6302
+                WHERE scu.session_id = ".intval($sessionId)."
6303 6303
                 GROUP BY u.id";
6304 6304
 
6305 6305
         $result = Database::query($sql);
@@ -6337,7 +6337,7 @@  discard block
 block discarded – undo
6337 6337
             $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD);
6338 6338
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6339 6339
             // Join session field and session field values tables
6340
-            $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
6340
+            $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
6341 6341
             $fieldsArray = array();
6342 6342
             foreach ($extraFields as $field) {
6343 6343
                 $fieldsArray[] = Database::escape_string($field);
@@ -6380,14 +6380,14 @@  discard block
 block discarded – undo
6380 6380
                 for ($i = 1; $i < count($fieldsArray); $i++) {
6381 6381
                     $whereParams .= ', ?';
6382 6382
                 }
6383
-                $whereFieldVariables = ' variable IN ( ' . $whereParams .' )';
6384
-                $whereFieldIds = 'field_id IN ( ' . $whereParams .  ' )';
6383
+                $whereFieldVariables = ' variable IN ( '.$whereParams.' )';
6384
+                $whereFieldIds = 'field_id IN ( '.$whereParams.' )';
6385 6385
             }
6386 6386
             // Get session fields
6387 6387
             $extraField = new ExtraFieldModel('session');
6388 6388
             $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
6389 6389
             $fieldsList = $extraField->get_all(array(
6390
-                ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray,
6390
+                ' variable IN ( '.$questionMarks.' )' => $fieldsArray,
6391 6391
             ));
6392 6392
             // Index session fields
6393 6393
             foreach ($fieldsList as $field) {
@@ -6396,7 +6396,7 @@  discard block
 block discarded – undo
6396 6396
             // Get session field values
6397 6397
             $extra = new ExtraFieldValue('session');
6398 6398
             $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2);
6399
-            $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields))));
6399
+            $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields))));
6400 6400
             // Add session fields values to session list
6401 6401
             foreach ($sessionList as $id => &$session) {
6402 6402
                 foreach ($sessionFieldValueList as $sessionFieldValue) {
@@ -6449,7 +6449,7 @@  discard block
 block discarded – undo
6449 6449
             // Check the result
6450 6450
             if ($result < 1) {
6451 6451
                 // If not found any result, update error message
6452
-                $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
6452
+                $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName;
6453 6453
             } elseif (count($result) > 1 && !$force) {
6454 6454
                 // If found more than one result and force is disabled, update error message
6455 6455
                 $errorResult['errorMessage'] = 'Found many session categories';
@@ -6508,7 +6508,7 @@  discard block
 block discarded – undo
6508 6508
             // Check if session list query had result
6509 6509
             if (!empty($sessionList)) {
6510 6510
                 // implode all session id
6511
-                $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
6511
+                $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')';
6512 6512
                 // Get all field variables
6513 6513
                 $sessionFieldList = Database::select(
6514 6514
                     'id, variable',
@@ -6595,7 +6595,7 @@  discard block
 block discarded – undo
6595 6595
                 return $sessionList;
6596 6596
             } else {
6597 6597
                 // Not found result, update error message
6598
-                $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
6598
+                $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId;
6599 6599
             }
6600 6600
         }
6601 6601
 
@@ -6699,7 +6699,7 @@  discard block
 block discarded – undo
6699 6699
 
6700 6700
         $sessionExtraField = new ExtraFieldModel('session');
6701 6701
         $fieldList = $sessionExtraField->get_all(array(
6702
-            "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables,
6702
+            "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
6703 6703
         ));
6704 6704
 
6705 6705
         $fields = array();
@@ -6713,7 +6713,7 @@  discard block
 block discarded – undo
6713 6713
         $extra = new ExtraFieldValue('session');
6714 6714
         $sessionFieldValueList = $extra->get_all(
6715 6715
             array(
6716
-                "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields),
6716
+                "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields),
6717 6717
             )
6718 6718
         );
6719 6719
 
@@ -6785,7 +6785,7 @@  discard block
 block discarded – undo
6785 6785
                 INNER JOIN $sessionUserTable sru 
6786 6786
                 ON s.id = sru.id_session
6787 6787
                 WHERE
6788
-                    (sru.id_user IN (" . implode(', ', $userIdList) . ")
6788
+                    (sru.id_user IN (".implode(', ', $userIdList).")
6789 6789
                     AND sru.relation_type = 0
6790 6790
                 )";
6791 6791
 
@@ -6801,7 +6801,7 @@  discard block
 block discarded – undo
6801 6801
                         WHERE
6802 6802
                             srau.access_url_id = $accessUrlId
6803 6803
                             AND (
6804
-                                sru.id_user IN (" . implode(', ', $userIdList) . ")
6804
+                                sru.id_user IN (".implode(', ', $userIdList).")
6805 6805
                                 AND sru.relation_type = 0
6806 6806
                             )";
6807 6807
             }
@@ -7014,7 +7014,7 @@  discard block
 block discarded – undo
7014 7014
                     get_lang('CoachName'),
7015 7015
                     null,
7016 7016
                     [
7017
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach',
7017
+                        'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach',
7018 7018
                         'width' => '100%',
7019 7019
                     ]
7020 7020
                 );
@@ -7025,7 +7025,7 @@  discard block
 block discarded – undo
7025 7025
         $form->addHtml('<div id="ajax_list_coachs"></div>');
7026 7026
 
7027 7027
         $form->addButtonAdvancedSettings('advanced_params');
7028
-        $form->addElement('html','<div id="advanced_params_options" style="display:none">');
7028
+        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
7029 7029
 
7030 7030
         $form->addSelect(
7031 7031
             'session_category',
@@ -7197,16 +7197,16 @@  discard block
 block discarded – undo
7197 7197
         if (api_is_session_admin() &&
7198 7198
             api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
7199 7199
         ) {
7200
-            $where.=" WHERE s.session_admin_id = $user_id ";
7200
+            $where .= " WHERE s.session_admin_id = $user_id ";
7201 7201
         }
7202 7202
 
7203 7203
         if (!empty($options['where'])) {
7204 7204
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7205
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7205
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7206 7206
 
7207 7207
             $options['where'] = str_replace(
7208 7208
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7209
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7209
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7210 7210
                 , $options['where']
7211 7211
             );
7212 7212
 
@@ -7248,10 +7248,10 @@  discard block
 block discarded – undo
7248 7248
                        $where ";
7249 7249
 
7250 7250
         if (api_is_multiple_url_enabled()) {
7251
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7251
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7252 7252
             $access_url_id = api_get_current_access_url_id();
7253 7253
             if ($access_url_id != -1) {
7254
-                $where.= " AND ar.access_url_id = $access_url_id ";
7254
+                $where .= " AND ar.access_url_id = $access_url_id ";
7255 7255
 
7256 7256
                 $query_rows = "SELECT count(*) as total_rows
7257 7257
                                FROM $tbl_session s
@@ -7296,12 +7296,12 @@  discard block
 block discarded – undo
7296 7296
                     //get_lang('CourseTitle'),
7297 7297
                     get_lang('Visibility'),
7298 7298
                 );
7299
-                $column_model = array (
7300
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7301
-                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7302
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7303
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7304
-                    array('name'=>'visibility', 'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7299
+                $column_model = array(
7300
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7301
+                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7302
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7303
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7304
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7305 7305
                 );
7306 7306
                 break;
7307 7307
             case 'complete':
@@ -7314,12 +7314,12 @@  discard block
 block discarded – undo
7314 7314
                     get_lang('Visibility'),
7315 7315
                     get_lang('CourseTitle'),
7316 7316
                 );
7317
-                $column_model = array (
7318
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7319
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7320
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7321
-                    array('name'=>'coach_name', 'index'=>'coach_name',     'width'=>'70',   'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7322
-                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
7317
+                $column_model = array(
7318
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7319
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7320
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7321
+                    array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7322
+                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
7323 7323
                         // for the bottom bar
7324 7324
                         'searchoptions' => array(
7325 7325
                             'defaultValue'  => '1',
@@ -7327,8 +7327,8 @@  discard block
 block discarded – undo
7327 7327
                         // for the top bar
7328 7328
                         'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')),
7329 7329
                     ),
7330
-                    array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7331
-                    array('name'=>'course_title',    'index'=>'course_title',   'width'=>'50',   'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)),
7330
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7331
+                    array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)),
7332 7332
                 );
7333 7333
                 break;
7334 7334
         }
@@ -7337,14 +7337,14 @@  discard block
 block discarded – undo
7337 7337
         $session_field = new ExtraFieldModel('session');
7338 7338
         $rules = $session_field->getRules($columns, $column_model);
7339 7339
 
7340
-        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false');
7340
+        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false');
7341 7341
         $columns[] = get_lang('Actions');
7342 7342
 
7343 7343
         foreach ($column_model as $col_model) {
7344 7344
             $simple_column_name[] = $col_model['name'];
7345 7345
         }
7346 7346
 
7347
-        $return_array =  array(
7347
+        $return_array = array(
7348 7348
             'columns' => $columns,
7349 7349
             'column_model' => $column_model,
7350 7350
             'rules' => $rules,
@@ -7433,7 +7433,7 @@  discard block
 block discarded – undo
7433 7433
             if (api_is_session_admin() &&
7434 7434
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
7435 7435
             ) {
7436
-                $where.=" AND s.session_admin_id = $user_id ";
7436
+                $where .= " AND s.session_admin_id = $user_id ";
7437 7437
             }
7438 7438
         }
7439 7439
 
@@ -7515,11 +7515,11 @@  discard block
 block discarded – undo
7515 7515
             }
7516 7516
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7517 7517
 
7518
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7518
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7519 7519
 
7520 7520
             $options['where'] = str_replace(
7521 7521
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7522
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7522
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7523 7523
                 , $options['where']
7524 7524
             );
7525 7525
 
@@ -7554,10 +7554,10 @@  discard block
 block discarded – undo
7554 7554
             $where;
7555 7555
 
7556 7556
         if (api_is_multiple_url_enabled()) {
7557
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7557
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7558 7558
             $access_url_id = api_get_current_access_url_id();
7559 7559
             if ($access_url_id != -1) {
7560
-                $where.= " AND ar.access_url_id = $access_url_id ";
7560
+                $where .= " AND ar.access_url_id = $access_url_id ";
7561 7561
                 $query = "$select
7562 7562
                     FROM $tbl_session s
7563 7563
                     LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id)
@@ -7581,7 +7581,7 @@  discard block
 block discarded – undo
7581 7581
         $formatted_sessions = array();
7582 7582
 
7583 7583
         if (Database::num_rows($result)) {
7584
-            $sessions   = Database::store_result($result, 'ASSOC');
7584
+            $sessions = Database::store_result($result, 'ASSOC');
7585 7585
             foreach ($sessions as $session) {
7586 7586
                 $session_id = $session['id'];
7587 7587
                 $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
@@ -7596,14 +7596,14 @@  discard block
 block discarded – undo
7596 7596
 
7597 7597
                 switch ($session['visibility']) {
7598 7598
                     case SESSION_VISIBLE_READ_ONLY: //1
7599
-                        $session['visibility'] =  get_lang('ReadOnly');
7599
+                        $session['visibility'] = get_lang('ReadOnly');
7600 7600
                         break;
7601 7601
                     case SESSION_VISIBLE:           //2
7602 7602
                     case SESSION_AVAILABLE:         //4
7603
-                        $session['visibility'] =  get_lang('Visible');
7603
+                        $session['visibility'] = get_lang('Visible');
7604 7604
                         break;
7605 7605
                     case SESSION_INVISIBLE:         //3
7606
-                        $session['visibility'] =  api_ucfirst(get_lang('Invisible'));
7606
+                        $session['visibility'] = api_ucfirst(get_lang('Invisible'));
7607 7607
                         break;
7608 7608
                 }
7609 7609
 
@@ -7679,7 +7679,7 @@  discard block
 block discarded – undo
7679 7679
         if (empty($session)) {
7680 7680
             return false;
7681 7681
         }
7682
-        return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id;
7682
+        return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id;
7683 7683
     }
7684 7684
 
7685 7685
     /**
@@ -7697,7 +7697,7 @@  discard block
 block discarded – undo
7697 7697
             return false;
7698 7698
         }
7699 7699
         if (empty($courseId)) {
7700
-            return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id;
7700
+            return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id;
7701 7701
         } else {
7702 7702
             $courseInfo = api_get_course_info_by_id($courseId);
7703 7703
             if ($courseInfo) {
@@ -7908,7 +7908,7 @@  discard block
 block discarded – undo
7908 7908
             // sort $listCat by catSessionName
7909 7909
             usort($listCat, 'self::compareBySessionName');
7910 7910
             // in each catSession sort sessionList by sessionName
7911
-            foreach($listCat as $i => $listCatSessionInfo) {
7911
+            foreach ($listCat as $i => $listCatSessionInfo) {
7912 7912
                 $listSessionList = $listCatSessionInfo['sessionList'];
7913 7913
                 usort($listSessionList, 'self::compareCatSessionInfo');
7914 7914
                 $listCat[$i]['sessionList'] = $listSessionList;
@@ -7923,8 +7923,8 @@  discard block
 block discarded – undo
7923 7923
             );
7924 7924
 
7925 7925
             $userCatId = intval($userCatId);
7926
-            $listResults[$userCatId]['courseInUserCategoryId'] =  $userCatId;
7927
-            $listResults[$userCatId]['courseInUserCategoryTitle'] =  $userCatTitle;
7926
+            $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
7927
+            $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
7928 7928
             $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
7929 7929
         }
7930 7930
 
@@ -7950,7 +7950,7 @@  discard block
 block discarded – undo
7950 7950
     {
7951 7951
         if ($listA['sessionName'] == $listB['sessionName']) {
7952 7952
             return 0;
7953
-        } else if($listA['sessionName'] > $listB['sessionName']) {
7953
+        } else if ($listA['sessionName'] > $listB['sessionName']) {
7954 7954
             return 1;
7955 7955
         } else {
7956 7956
             return -1;
@@ -7970,7 +7970,7 @@  discard block
 block discarded – undo
7970 7970
             return 1;
7971 7971
         } else if ($listA['catSessionName'] == $listB['catSessionName']) {
7972 7972
             return 0;
7973
-        } else if($listA['catSessionName'] > $listB['catSessionName']) {
7973
+        } else if ($listA['catSessionName'] > $listB['catSessionName']) {
7974 7974
             return 1;
7975 7975
         } else {
7976 7976
             return -1;
@@ -7986,7 +7986,7 @@  discard block
 block discarded – undo
7986 7986
     {
7987 7987
         if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) {
7988 7988
             return 0;
7989
-        } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7989
+        } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7990 7990
             return 1;
7991 7991
         } else {
7992 7992
             return -1;
@@ -8002,7 +8002,7 @@  discard block
 block discarded – undo
8002 8002
     {
8003 8003
         if ($listA['title'] == $listB['title']) {
8004 8004
             return 0;
8005
-        } else if($listA['title'] > $listB['title']) {
8005
+        } else if ($listA['title'] > $listB['title']) {
8006 8006
             return 1;
8007 8007
         } else {
8008 8008
             return -1;
@@ -8048,8 +8048,8 @@  discard block
 block discarded – undo
8048 8048
 
8049 8049
                 $marginShift = 20;
8050 8050
                 if ($catSessionName != '') {
8051
-                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' .
8052
-                        CourseManager::course_item_html($listParamsCatSession, true) . '</div>';
8051
+                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'.
8052
+                        CourseManager::course_item_html($listParamsCatSession, true).'</div>';
8053 8053
                     $marginShift = 40;
8054 8054
                 }
8055 8055
 
Please login to merge, or discard this patch.