Minor - update from 1.11.x

pull/3451/head
Julio Montoya 4 years ago
parent 64116b0fd0
commit 2a232d447e
  1. 27
      public/main/inc/lib/Compilatio.php
  2. 2
      public/main/inc/lib/NotificationEvent.php
  3. 10
      public/main/inc/lib/ScheduledAnnouncement.php
  4. 22
      public/main/inc/lib/sessionmanager.lib.php
  5. 8
      public/main/inc/lib/usergroup.lib.php
  6. 63
      public/main/user/subscribe_user.php

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
/**
* Build the comunication with the SOAP server Compilatio.net
* call severals methods for the file management in Compilatio.net.
* Build the communication with the SOAP server Compilatio.net
* call several methods for the file management in Compilatio.net.
*
* @version: 2.0
*/
@ -261,7 +261,7 @@ class Compilatio
if (!is_object($this->soapcli)) {
return "Error in constructor compilatio() $this->soapcli";
}
$idDocument = $this->soapcli->__call(
return $this->soapcli->__call(
'addDocumentBase64',
[
$this->key,
@ -273,7 +273,6 @@ class Compilatio
]
);
return $idDocument;
} catch (SoapFault $fault) {
return "Erreur sendDoc()".$fault->faultcode." ".$fault->faultstring;
}
@ -293,9 +292,8 @@ class Compilatio
return "Error in constructor compilatio() ".$this->soapcli;
}
$param = [$this->key, $compiHash];
$idDocument = $this->soapcli->__call('getDocument', $param);
return $idDocument;
return $this->soapcli->__call('getDocument', $param);
} catch (SoapFault $fault) {
return "Erreur getDoc()".$fault->faultcode." ".$fault->faultstring;
}
@ -315,9 +313,8 @@ class Compilatio
return "Error in constructor compilatio() ".$this->soapcli;
}
$param = [$this->key, $compiHash];
$idDocument = $this->soapcli->__call('getDocumentReportUrl', $param);
return $idDocument;
return $this->soapcli->__call('getDocumentReportUrl', $param);
} catch (SoapFault $fault) {
return "Erreur getReportUrl()".$fault->faultcode." ".$fault->faultstring;
}
@ -375,9 +372,8 @@ class Compilatio
return "Error in constructor compilatio() ".$this->soapcli;
}
$param = [$this->key];
$resultat = $this->soapcli->__call('getAccountQuotas', $param);
return $resultat;
return $this->soapcli->__call('getAccountQuotas', $param);
} catch (SoapFault $fault) {
return "Erreur getQuotas()".$fault->faultcode." ".$fault->faultstring;
}
@ -444,8 +440,6 @@ class Compilatio
$highThreshold
) {
$index = round($index);
$pour = round((50 * $index) / 100);
$return = '';
$class = 'error';
if ($index < $weakThreshold) {
$class = 'success';
@ -455,9 +449,7 @@ class Compilatio
}
}
$return .= Display::bar_progress($index, true, null, $class);
return $return;
return Display::bar_progress($index, true, null, $class);
}
/**
@ -543,7 +535,6 @@ class Compilatio
*/
public function giveWorkIdState($workId)
{
$compilatioImgFolder = api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/img/';
$courseId = api_get_course_int_id();
$compilatioId = $this->getCompilatioId($workId, $courseId);
@ -611,8 +602,6 @@ class Compilatio
}
}
$result = $workId.'|'.$actionCompilatio.'|'.$status.'|';
return $result;
return $workId.'|'.$actionCompilatio.'|'.$status.'|';
}
}

@ -56,11 +56,11 @@ class NotificationEvent extends Model
$list = $plugin->getList();
$list = array_column($list, 'name', 'id');
$form->addSelect('event_id', get_lang('JustificationType'), $list);
$form->freeze('event_id');
break;
default:
break;
}
$form->freeze('event_id');
$form->addText('title', get_lang('Title'));
$form->addTextarea('content', get_lang('Content'));

@ -321,10 +321,13 @@ class ScheduledAnnouncement extends Model
continue;
}
$coachList = [];
if ($users) {
$sendToCoaches = $extraFieldValue->get_values_by_handler_and_field_variable($result['id'], 'send_to_coaches');
$sendToCoaches = $extraFieldValue->get_values_by_handler_and_field_variable(
$result['id'],
'send_to_coaches'
);
$courseList = SessionManager::getCoursesInSession($sessionId);
$coachList = [];
if (!empty($sendToCoaches) && !empty($sendToCoaches['value']) && 1 == $sendToCoaches['value']) {
foreach ($courseList as $courseItemId) {
$coaches = SessionManager::getCoachesByCourseSession(
@ -346,6 +349,7 @@ class ScheduledAnnouncement extends Model
$courseInfo = api_get_course_info_by_id($courseId);
}
$message = '';
foreach ($users as $user) {
// Take original message
$message = $result['message'];
@ -397,6 +401,8 @@ class ScheduledAnnouncement extends Model
'((general_coach_email))' => $generalCoachEmail,
'((session_end_date))' => $endTime,
'((user_complete_name))' => $userInfo['complete_name'],
'((user_firstname))' => $userInfo['firstname'],
'((user_lastname))' => $userInfo['lastname'],
'((user_first_name))' => $userInfo['firstname'],
'((user_last_name))' => $userInfo['lastname'],
'((lp_progress))' => $progress,

@ -448,7 +448,7 @@ class SessionManager
LEFT JOIN $tbl_session_category sc
ON s.session_category_id = sc.id
INNER JOIN $tbl_user u
ON s.id_coach = u.user_id
ON s.id_coach = u.id
$courseCondition
$extraJoin
$where $where_condition ) as session_table";
@ -471,7 +471,7 @@ class SessionManager
FROM $tbl_session s
LEFT JOIN $tbl_session_category sc
ON s.session_category_id = sc.id
INNER JOIN $tbl_user u ON s.id_coach = u.user_id
INNER JOIN $tbl_user u ON s.id_coach = u.id
INNER JOIN $table_access_url_rel_session ar
ON ar.session_id = s.id
$courseCondition
@ -856,9 +856,9 @@ class SessionManager
$order = " ORDER BY ".$options['order'];
}
$sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
$sql = "SELECT u.id as user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
FROM $session_course_user s
INNER JOIN $user u ON u.user_id = s.user_id
INNER JOIN $user u ON u.id = s.user_id
$where
$order
$limit";
@ -978,9 +978,9 @@ class SessionManager
$order = " ORDER BY ".$options['order'];
}
$sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
$sql = "SELECT u.id as user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
FROM $session_course_user s
INNER JOIN $user u ON u.user_id = s.user_id
INNER JOIN $user u ON u.id = s.user_id
$where $order $limit";
$sql_query = sprintf($sql, intval($course['real_id']), $sessionId);
@ -8167,7 +8167,7 @@ class SessionManager
LEFT JOIN $tbl_session_category sc
ON s.session_category_id = sc.id
INNER JOIN $tbl_user u
ON s.id_coach = u.user_id
ON s.id_coach = u.id
INNER JOIN $sessionCourseUserTable scu
ON s.id = scu.session_id
INNER JOIN $courseTable c
@ -8184,7 +8184,7 @@ class SessionManager
LEFT JOIN $tbl_session_category sc
ON s.session_category_id = sc.id
INNER JOIN $tbl_user u
ON s.id_coach = u.user_id
ON s.id_coach = u.id
INNER JOIN $table_access_url_rel_session ar
ON ar.session_id = s.id $where ";
}
@ -8750,7 +8750,7 @@ class SessionManager
access_start_date,
access_end_date,
s.visibility,
u.user_id,
u.id as user_id,
$injectExtraFields
c.title as course_title,
s.id ";
@ -8799,7 +8799,7 @@ class SessionManager
LEFT JOIN $tbl_session_category sc
ON (s.session_category_id = sc.id)
INNER JOIN $tbl_user u
ON (s.id_coach = u.user_id)
ON (s.id_coach = u.id)
$where
$limit
";
@ -8821,7 +8821,7 @@ class SessionManager
LEFT JOIN $tbl_session_category sc
ON (s.session_category_id = sc.id)
INNER JOIN $tbl_user u
ON (s.id_coach = u.user_id)
ON (s.id_coach = u.id)
INNER JOIN $table_access_url_rel_session ar
ON (ar.session_id = s.id AND ar.access_url_id = $access_url_id)
$where

@ -295,7 +295,7 @@ class UserGroup extends Model
/**
* @param string $name
*
* @return mixed
* @return int
*/
public function getIdByName($name)
{
@ -306,7 +306,11 @@ class UserGroup extends Model
'first'
);
return $row['id'];
if ($row) {
return (int) $row['id'];
}
return 0;
}
/**

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt*/
use Chamilo\CoreBundle\Entity\ExtraField;
@ -235,7 +236,7 @@ function get_number_of_users()
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON
u.user_id = cu.user_id AND
u.id = cu.user_id AND
c_id = '".api_get_course_int_id()."' AND
session_id ='".$sessionId."'
WHERE
@ -251,10 +252,10 @@ function get_number_of_users()
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON
u.user_id = cu.user_id AND cu.c_id = '".api_get_course_int_id()."' AND
u.id = cu.user_id AND cu.c_id = '".api_get_course_int_id()."' AND
session_id ='".$sessionId."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id)
ON (url_rel_user.user_id = u.id)
WHERE
cu.user_id IS NULL AND
access_url_id= $url_access_id AND
@ -267,7 +268,7 @@ function get_number_of_users()
$sql = "SELECT COUNT(u.id)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id and c_id='".api_get_course_int_id()."'
ON u.id = cu.user_id and c_id='".api_get_course_int_id()."'
WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
if (api_is_multiple_url_enabled()) {
@ -278,9 +279,9 @@ function get_number_of_users()
$sql = "SELECT COUNT(u.id)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'
ON u.id = cu.user_id AND c_id='".api_get_course_int_id()."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id)
ON (url_rel_user.user_id = u.id)
WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
}
}
@ -292,7 +293,7 @@ function get_number_of_users()
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON
u.user_id = cu.user_id AND
u.id = cu.user_id AND
c_id='".api_get_course_int_id()."' AND
session_id ='".$sessionId."'
WHERE
@ -308,7 +309,7 @@ function get_number_of_users()
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON
u.user_id = cu.user_id AND
u.id = cu.user_id AND
c_id='".api_get_course_int_id()."' AND
session_id ='".$sessionId."'
INNER JOIN $tbl_url_rel_user as url_rel_user
@ -324,7 +325,7 @@ function get_number_of_users()
$sql = "SELECT COUNT(u.id)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'";
ON u.id = cu.user_id AND c_id='".api_get_course_int_id()."'";
// we change the SQL when we have a filter
if (isset($_GET['subscribe_user_filter_value']) &&
@ -334,7 +335,7 @@ function get_number_of_users()
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status <> ".DRH." AND
@ -352,8 +353,8 @@ function get_number_of_users()
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT COUNT(u.id)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'
LEFT JOIN $course_user_table cu
ON u.id = cu.user_id AND c_id='".api_get_course_int_id()."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.id)
WHERE cu.user_id IS NULL AND access_url_id= $url_access_id AND u.status <> ".DRH." ";
@ -435,9 +436,9 @@ function get_user_data($from, $number_of_items, $column, $direction)
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6";
u.id AS col6";
} else {
$select_fields = "u.user_id AS col0,
$select_fields = "u.id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
@ -445,7 +446,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
: "u.lastname AS col2,
u.firstname AS col3,")."
u.active AS col4,
u.user_id AS col5";
u.id AS col5";
}
if (isset($_REQUEST['type']) && COURSEMANAGER == $_REQUEST['type']) {
// adding a teacher through a session
@ -454,11 +455,11 @@ function get_user_data($from, $number_of_items, $column, $direction)
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON
u.user_id = cu.user_id AND
u.id = cu.user_id AND
c_id ='".$courseId."' AND
session_id ='".$sessionId."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id) ";
ON (url_rel_user.user_id = u.id) ";
// applying the filter of the additional user profile fields
if (isset($_GET['subscribe_user_filter_value']) &&
@ -468,7 +469,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status = 1 AND
@ -484,7 +485,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id = '".$courseId."'";
ON u.id = cu.user_id AND c_id = '".$courseId."'";
// applying the filter of the additional user profile fields
if (isset($_GET['subscribe_user_filter_value']) &&
!empty($_GET['subscribe_user_filter_value']) &&
@ -493,7 +494,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND u.status<>".DRH." AND
field_values.field_id = '".intval($field_identification[0])."' AND
@ -508,9 +509,9 @@ function get_user_data($from, $number_of_items, $column, $direction)
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id and c_id='".$courseId."'
ON u.id = cu.user_id and c_id='".$courseId."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id) ";
ON (url_rel_user.user_id = u.id) ";
// applying the filter of the additional user profile fields
if (isset($_GET['subscribe_user_filter_value']) &&
@ -520,7 +521,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status<>".DRH." AND
@ -539,12 +540,12 @@ function get_user_data($from, $number_of_items, $column, $direction)
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON
u.user_id = cu.user_id AND
u.id = cu.user_id AND
c_id = $courseId AND
session_id = $sessionId ";
if (api_is_multiple_url_enabled()) {
$sql .= " INNER JOIN $tbl_url_rel_user as url_rel_user ON (url_rel_user.user_id = u.user_id) ";
$sql .= " INNER JOIN $tbl_url_rel_user as url_rel_user ON (url_rel_user.user_id = u.id) ";
}
// applying the filter of the additional user profile fields
@ -554,7 +555,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status<>".DRH." AND
@ -575,7 +576,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON
u.user_id = cu.user_id AND
u.id = cu.user_id AND
c_id = $courseId ";
// applying the filter of the additional user profile fields
@ -583,7 +584,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status <> ".DRH." AND
@ -599,9 +600,9 @@ function get_user_data($from, $number_of_items, $column, $direction)
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id='".$courseId."'
ON u.id = cu.user_id AND c_id='".$courseId."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id) ";
ON (url_rel_user.user_id = u.id) ";
// applying the filter of the additional user profile fields
if (isset($_GET['subscribe_user_filter_value']) &&
@ -611,7 +612,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status<>".DRH." AND

Loading…
Cancel
Save