|
|
|
@ -14213,6 +14213,82 @@ EOD; |
|
|
|
return Database::fetch_assoc($result); |
|
|
|
return Database::fetch_assoc($result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns the list of users that are registered in the learningpaths at the time they are subscribed, taking into |
|
|
|
|
|
|
|
* account that the LearnpathSubscription element must be in the table item_property in lastedit_type. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param int $lpId |
|
|
|
|
|
|
|
* @param int $sessionId |
|
|
|
|
|
|
|
* @param null $extraWhere |
|
|
|
|
|
|
|
* @param false $withHRM |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static function getStudentsByLearnpathSubscription($lpId = 0, $sessionId = 0, $extraWhere = null, $withHRM = false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ($sessionId == 0) { |
|
|
|
|
|
|
|
$sessionId = (int) api_get_session_id(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$lpTable = Database::get_course_table(TABLE_LP_MAIN); |
|
|
|
|
|
|
|
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
|
|
|
$tblItempProperty = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$whereSession = " AND (z.session_id = 0 or z.session_id is null ) "; |
|
|
|
|
|
|
|
if ($sessionId != 0) { |
|
|
|
|
|
|
|
$whereSession = " AND z.session_id = $sessionId "; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$sql = " |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
z.session_id as session_id, |
|
|
|
|
|
|
|
z.to_user_id as user_id, |
|
|
|
|
|
|
|
z.insert_user_id as from_user_id, |
|
|
|
|
|
|
|
a.id AS l_id, |
|
|
|
|
|
|
|
a.c_id AS c_id, |
|
|
|
|
|
|
|
a.session_id AS session_id, |
|
|
|
|
|
|
|
a.`name` AS `name`, |
|
|
|
|
|
|
|
d.title AS course_name, |
|
|
|
|
|
|
|
d.`code` AS `code`, |
|
|
|
|
|
|
|
d.id AS course_id |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
$tblItempProperty as z |
|
|
|
|
|
|
|
INNER JOIN $lpTable as a ON a.iid = z.ref |
|
|
|
|
|
|
|
INNER JOIN $courseTable as d ON a.c_id = d.id |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
z.lastedit_type ='LearnpathSubscription' |
|
|
|
|
|
|
|
AND a.id = $lpId |
|
|
|
|
|
|
|
$extraWhere |
|
|
|
|
|
|
|
$whereSession |
|
|
|
|
|
|
|
"; |
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
|
|
|
$data = Database::store_result($result); |
|
|
|
|
|
|
|
Database::free_result($result); |
|
|
|
|
|
|
|
if ($withHRM == true) { |
|
|
|
|
|
|
|
$totalData = count($data); |
|
|
|
|
|
|
|
for ($i = 0; $i < $totalData; $i++) { |
|
|
|
|
|
|
|
$dataTemp = []; |
|
|
|
|
|
|
|
$userId = $data[$i]['user_id']; |
|
|
|
|
|
|
|
if ($userId != 0) { |
|
|
|
|
|
|
|
$relationStudenHRTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
|
|
|
|
|
|
$sql = "SELECT |
|
|
|
|
|
|
|
friend_user_id |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
$relationStudenHRTable |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
user_id = $userId |
|
|
|
|
|
|
|
AND relation_type = ".USER_RELATION_TYPE_RRHH; |
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
|
|
|
$dataHR = Database::store_result($result); |
|
|
|
|
|
|
|
Database::free_result($result); |
|
|
|
|
|
|
|
$totalHr = count($dataHR); |
|
|
|
|
|
|
|
for ($j = 0; $j < $totalHr; $j++) { |
|
|
|
|
|
|
|
$dataTemp[] = api_get_user_info($dataHR[$j]['friend_user_id']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$data[$i]['HRM'] = $dataTemp; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $data; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get the depth level of LP item. |
|
|
|
* Get the depth level of LP item. |
|
|
|
* |
|
|
|
* |
|
|
|
@ -14351,80 +14427,4 @@ EOD; |
|
|
|
$author->setOptions($options); |
|
|
|
$author->setOptions($options); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns the list of users that are registered in the learningpaths at the time they are subscribed, taking into |
|
|
|
|
|
|
|
* account that the LearnpathSubscription element must be in the table item_property in lastedit_type |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param int $lpId |
|
|
|
|
|
|
|
* @param int $sessionId |
|
|
|
|
|
|
|
* @param null $extraWhere |
|
|
|
|
|
|
|
* @param false $withHRM |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static function getStudentsByLearnpathSubscription($lpId = 0, $sessionId = 0, $extraWhere = null, $withHRM = false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ($sessionId == 0) { |
|
|
|
|
|
|
|
$sessionId = (int)api_get_session_id(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$lpTable = Database::get_course_table(TABLE_LP_MAIN); |
|
|
|
|
|
|
|
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
|
|
|
$tblItempProperty = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$whereSession = " AND (z.session_id = 0 or z.session_id is null ) "; |
|
|
|
|
|
|
|
if ($sessionId != 0) { |
|
|
|
|
|
|
|
$whereSession = " AND z.session_id = $sessionId "; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$sql = " |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
z.session_id as session_id, |
|
|
|
|
|
|
|
z.to_user_id as user_id, |
|
|
|
|
|
|
|
z.insert_user_id as from_user_id, |
|
|
|
|
|
|
|
a.id AS l_id, |
|
|
|
|
|
|
|
a.c_id AS c_id, |
|
|
|
|
|
|
|
a.session_id AS session_id, |
|
|
|
|
|
|
|
a.`name` AS `name`, |
|
|
|
|
|
|
|
d.title AS course_name, |
|
|
|
|
|
|
|
d.`code` AS `code`, |
|
|
|
|
|
|
|
d.id AS course_id |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
$tblItempProperty as z |
|
|
|
|
|
|
|
INNER JOIN $lpTable as a ON a.iid = z.ref |
|
|
|
|
|
|
|
INNER JOIN $courseTable as d ON a.c_id = d.id |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
z.lastedit_type ='LearnpathSubscription' |
|
|
|
|
|
|
|
AND a.id = $lpId |
|
|
|
|
|
|
|
$extraWhere |
|
|
|
|
|
|
|
$whereSession |
|
|
|
|
|
|
|
"; |
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
|
|
|
$data = Database::store_result($result); |
|
|
|
|
|
|
|
Database::free_result($result); |
|
|
|
|
|
|
|
if ($withHRM == true) { |
|
|
|
|
|
|
|
$totalData = count($data); |
|
|
|
|
|
|
|
for ($i = 0; $i < $totalData; $i++) { |
|
|
|
|
|
|
|
$dataTemp = []; |
|
|
|
|
|
|
|
$userId = $data[$i]['user_id']; |
|
|
|
|
|
|
|
if ($userId != 0) { |
|
|
|
|
|
|
|
$relationStudenHRTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
|
|
|
|
|
|
$sql = "SELECT |
|
|
|
|
|
|
|
friend_user_id |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
$relationStudenHRTable |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
user_id = $userId |
|
|
|
|
|
|
|
AND relation_type = ".USER_RELATION_TYPE_RRHH; |
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
|
|
|
$dataHR = Database::store_result($result); |
|
|
|
|
|
|
|
Database::free_result($result); |
|
|
|
|
|
|
|
$totalHr = count($dataHR); |
|
|
|
|
|
|
|
for($j=0;$j<$totalHr;$j++){ |
|
|
|
|
|
|
|
$dataTemp[] = api_get_user_info($dataHR[$j]['friend_user_id']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$data[$i]['HRM']=$dataTemp; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $data; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|