Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/3683/head
Yannick Warnier 5 years ago
commit 7c9f598b70
  1. 30
      main/inc/lib/myspace.lib.php

@ -1522,7 +1522,7 @@ class MySpace
$table .= "<td>$title</td>"; $table .= "<td>$title</td>";
} }
$table .= "<td>$price</td>"; $table .= "<td>$price</td>";
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id']); $registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id'], true);
$studenRegister = count($registeredUsers); $studenRegister = count($registeredUsers);
$table .= "<td>$studenRegister</td>"; $table .= "<td>$studenRegister</td>";
$facturar = ($studenRegister * $price); $facturar = ($studenRegister * $price);
@ -1537,8 +1537,8 @@ class MySpace
"</a>". "</a>".
"<div id='$hiddenField' class='hidden'>"; "<div id='$hiddenField' class='hidden'>";
for ($i = 0; $i < $studenRegister; $i++) { for ($i = 0; $i < $studenRegister; $i++) {
$tempStudent = api_get_user_info($registeredUsers[$i]); $tempStudent = api_get_user_info($registeredUsers[$i]['id']);
$table .= $tempStudent['complete_name']."<br>"; $table .= $tempStudent['complete_name']." (".$registeredUsers[$i]['company'].")<br>";
} }
$index++; $index++;
$table .= "</div>". $table .= "</div>".
@ -1632,7 +1632,7 @@ class MySpace
$csv_row[] = $autor['complete_name']; $csv_row[] = $autor['complete_name'];
$csv_row[] = $title; $csv_row[] = $title;
$csv_row[] = $price; $csv_row[] = $price;
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id']); $registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id'], true);
$studenRegister = count($registeredUsers); $studenRegister = count($registeredUsers);
$csv_row[] = $studenRegister; $csv_row[] = $studenRegister;
$facturar = ($studenRegister * $price); $facturar = ($studenRegister * $price);
@ -1641,8 +1641,8 @@ class MySpace
if ($studenRegister != 0) { if ($studenRegister != 0) {
$studentsName = ''; $studentsName = '';
for ($i = 0; $i < $studenRegister; $i++) { for ($i = 0; $i < $studenRegister; $i++) {
$tempStudent = api_get_user_info($registeredUsers[$i]); $tempStudent = api_get_user_info($registeredUsers[$i]['id']);
$studentsName .= $tempStudent['complete_name']." / "; $studentsName .= $tempStudent['complete_name']." (".$registeredUsers[$i]['company'].") / ";
$totalStudent++; $totalStudent++;
} }
@ -3986,11 +3986,16 @@ class MySpace
* @param string|null $startDate * @param string|null $startDate
* @param string|null $endDate * @param string|null $endDate
* @param int $lpId * @param int $lpId
* @param bool $whitCompany
* *
* @return array * @return array
*/ */
protected static function getCompanyLearnpathSubscription($startDate = null, $endDate = null, $lpId = 0) protected static function getCompanyLearnpathSubscription(
{ $startDate = null,
$endDate = null,
$lpId = 0,
$whitCompany = false
) {
$tblItemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY); $tblItemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tblLp = Database::get_course_table(TABLE_LP_MAIN); $tblLp = Database::get_course_table(TABLE_LP_MAIN);
$tblExtraField = Database::get_main_table(TABLE_EXTRA_FIELD); $tblExtraField = Database::get_main_table(TABLE_EXTRA_FIELD);
@ -4091,7 +4096,14 @@ class MySpace
} }
// $lpId = $row['ref']; // $lpId = $row['ref'];
if ($lpId != 0 && $studentId != 0) { if ($lpId != 0 && $studentId != 0) {
$companys[] = $studentId; if ($whitCompany == true) {
$companys[] = [
'id' => $studentId,
'company' => $company,
];
} else {
$companys[] = $studentId;
}
} else { } else {
$companys[$company][] = $studentId; $companys[$company][] = $studentId;
$companys[$company] = array_unique($companys[$company]); $companys[$company] = array_unique($companys[$company]);

Loading…
Cancel
Save