diff --git a/main/badge/issued_all.php b/main/badge/issued_all.php
index 2e40c0ecac..d6289ad02d 100644
--- a/main/badge/issued_all.php
+++ b/main/badge/issued_all.php
@@ -36,8 +36,8 @@ if (!$user || !$skill) {
}
$userSkills = $skillUserRepo->findBy([
- 'userId' => $user->getId(),
- 'skillId' => $skill->getId()
+ 'user' => $user,
+ 'skill' => $skill
]);
$userInfo = [
diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php
index 50824ca857..c7a15ffa0a 100755
--- a/main/inc/lib/tracking.lib.php
+++ b/main/inc/lib/tracking.lib.php
@@ -5849,14 +5849,14 @@ class Tracking
return '';
}
- $filter = ['userId' => $userId];
+ $filter = ['user' => $userId];
if (!empty($courseId)) {
- $filter['courseId'] = $courseId;
+ $filter['course'] = $courseId;
}
if (!empty($sessionId)) {
- $filter['sessionId'] = $sessionId;
+ $filter['session'] = $sessionId;
}
$em = Database::getManager();
@@ -5883,7 +5883,7 @@ class Tracking
';
foreach ($skillsRelUser as $userSkill) {
- $skill = $em->find('ChamiloCoreBundle:Skill', $userSkill->getSkillId());
+ $skill = $em->find('ChamiloCoreBundle:Skill', $userSkill->getSkill()->getId());
$html .= '
diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php
index d172f0ec74..cefb09c811 100755
--- a/main/mySpace/myStudents.php
+++ b/main/mySpace/myStudents.php
@@ -653,14 +653,14 @@ if (!empty($student_id)) {
);
$attendance = new Attendance();
- foreach ($courses_in_session as $sessionId => $courses) {
+ foreach ($courses_in_session as $sId => $courses) {
$session_name = '';
$access_start_date = '';
$access_end_date = '';
$date_session = '';
$title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
- $session_info = api_get_session_info($sessionId);
+ $session_info = api_get_session_info($sId);
if ($session_info) {
$session_name = $session_info['name'];
if (!empty($session_info['access_start_date']) && $session_info['access_start_date'] != '0000-00-00') {
@@ -702,15 +702,15 @@ if (!empty($student_id)) {
if (CourseManager :: is_user_subscribed_in_course($student_id, $courseCodeItem, true)) {
$time_spent_on_course = api_time_to_hms(
- Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sessionId)
+ Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sId)
);
// get average of faults in attendances by student
- $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $courseCodeItem, $sessionId);
+ $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $courseCodeItem, $sId);
if (!empty($results_faults_avg['total'])) {
if (api_is_drh()) {
$attendances_faults_avg =
- ''.
+ ''.
$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
} else {
$attendances_faults_avg =
@@ -724,12 +724,12 @@ if (!empty($student_id)) {
}
// Get evaluations by student
- $cats = Category::load(null, null, $courseCodeItem, null, null, $sessionId);
+ $cats = Category::load(null, null, $courseCodeItem, null, null, $sId);
$scoretotal = array();
if (isset($cats) && isset($cats[0])) {
- if (!empty($sessionId)) {
- $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem, $sessionId);
+ if (!empty($sId)) {
+ $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem, $sId);
} else {
$scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem);
}
@@ -743,8 +743,8 @@ if (!empty($student_id)) {
' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
}
- $progress = Tracking::get_avg_student_progress($user_info['user_id'], $courseCodeItem, null, $sessionId);
- $score = Tracking :: get_avg_student_score($user_info['user_id'], $courseCodeItem, null, $sessionId);
+ $progress = Tracking::get_avg_student_progress($user_info['user_id'], $courseCodeItem, null, $sId);
+ $score = Tracking :: get_avg_student_score($user_info['user_id'], $courseCodeItem, null, $sId);
$progress = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
@@ -759,7 +759,7 @@ if (!empty($student_id)) {
);
echo '
- '.
+ | '.
$courseInfoItem['title'].' |
'.$time_spent_on_course .' |
'.$progress.' |
@@ -768,10 +768,10 @@ if (!empty($student_id)) {
'.$scoretotal_display.' | ';
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
- echo '
+ echo ' |
'.Display::return_icon('2rightarrow.png', get_lang('Details')).' | ';
} else {
- echo '
+ echo ' |
'.Display::return_icon('2rightarrow.png', get_lang('Details')).' | ';
}
echo '
';
diff --git a/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php
index 79ad27031a..73375ee95c 100644
--- a/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php
+++ b/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php
@@ -33,21 +33,21 @@ class SkillRepository extends EntityRepository
'ChamiloCoreBundle:SkillRelUser',
'su',
Join::WITH,
- 's.id = su.skillId'
+ 's.id = su.skill'
)
->where(
- $qb->expr()->eq('su.userId', $user->getId())
+ $qb->expr()->eq('su.user', $user)
);
if ($course) {
$qb->andWhere(
- $qb->expr()->eq('su.courseId', $course->getId())
+ $qb->expr()->eq('su.course', $course)
);
}
if ($session) {
$qb->andWhere(
- $qb->expr()->eq('su.sessionId', $session->getId())
+ $qb->expr()->eq('su.session', $session)
);
}
diff --git a/src/Chamilo/CoreBundle/Entity/SkillRelUser.php b/src/Chamilo/CoreBundle/Entity/SkillRelUser.php
index 52751c3200..a82a58a448 100644
--- a/src/Chamilo/CoreBundle/Entity/SkillRelUser.php
+++ b/src/Chamilo/CoreBundle/Entity/SkillRelUser.php
@@ -4,12 +4,10 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\SkillBundle\Entity\Level;
+use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use Chamilo\UserBundle\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
-use Chamilo\CoreBundle\Entity\Skill;
-use Chamilo\CoreBundle\Entity\Course;
-use Chamilo\CoreBundle\Entity\Session;
/**
* SkillRelUser
@@ -35,20 +33,6 @@ class SkillRelUser
*/
private $id;
- /**
- * @var integer
- *
- * @ORM\Column(name="user_id", type="integer", nullable=false)
- */
- private $userId;
-
- /**
- * @var integer
- *
- * @ORM\Column(name="skill_id", type="integer", nullable=false)
- */
- private $skillId;
-
/**
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="achievedSkills", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
@@ -74,23 +58,9 @@ class SkillRelUser
*/
private $assignedBy;
- /**
- * @var integer
- *
- * @ORM\Column(name="course_id", type="integer", nullable=false)
- */
- private $courseId;
-
- /**
- * @var integer
- *
- * @ORM\Column(name="session_id", type="integer", nullable=false)
- */
- private $sessionId;
-
/**
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="issuedSkills", cascade={"persist"})
- * @ORM\JoinColumn(name="course_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="course_id", referencedColumnName="id", nullable=true)
*/
private $course;
@@ -98,7 +68,7 @@ class SkillRelUser
* @var Session
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="issuedSkills", cascade={"persist"})
- * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true)
*/
private $session;
@@ -137,52 +107,6 @@ class SkillRelUser
$this->comments = new ArrayCollection();
}
- /**
- * Set userId
- *
- * @param integer $userId
- * @return SkillRelUser
- */
- public function setUserId($userId)
- {
- $this->userId = $userId;
-
- return $this;
- }
-
- /**
- * Get userId
- *
- * @return integer
- */
- public function getUserId()
- {
- return $this->userId;
- }
-
- /**
- * Set skillId
- *
- * @param integer $skillId
- * @return SkillRelUser
- */
- public function setSkillId($skillId)
- {
- $this->skillId = $skillId;
-
- return $this;
- }
-
- /**
- * Get skillId
- *
- * @return integer
- */
- public function getSkillId()
- {
- return $this->skillId;
- }
-
/**
* Set user
* @param User $user
@@ -314,52 +238,6 @@ class SkillRelUser
return $this->assignedBy;
}
- /**
- * Set courseId
- *
- * @param integer $courseId
- * @return SkillRelUser
- */
- public function setCourseId($courseId)
- {
- $this->courseId = $courseId;
-
- return $this;
- }
-
- /**
- * Get courseId
- *
- * @return integer
- */
- public function getCourseId()
- {
- return $this->courseId;
- }
-
- /**
- * Set sessionId
- *
- * @param integer $sessionId
- * @return SkillRelUser
- */
- public function setSessionId($sessionId)
- {
- $this->sessionId = $sessionId;
-
- return $this;
- }
-
- /**
- * Get sessionId
- *
- * @return integer
- */
- public function getSessionId()
- {
- return $this->sessionId;
- }
-
/**
* Get id
*
@@ -499,9 +377,9 @@ class SkillRelUser
public function getComments($sortDescByDateTime = false)
{
if ($sortDescByDateTime) {
- $criteria = \Doctrine\Common\Collections\Criteria::create();
+ $criteria = Criteria::create();
$criteria->orderBy([
- 'feedbackDateTime' => \Doctrine\Common\Collections\Criteria::DESC
+ 'feedbackDateTime' => Criteria::DESC
]);
return $this->comments->matching($criteria);
@@ -517,7 +395,6 @@ class SkillRelUser
public function getAverage()
{
$sum = 0;
- $average = 0;
$countValues = 0;
foreach ($this->comments as $comment) {