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

1.10.x
Julio Montoya 10 years ago
commit f54abdd624
  1. 2
      main/inc/ajax/model.ajax.php
  2. 4
      main/inc/lib/sessionmanager.lib.php
  3. 21
      main/newscorm/learnpath.class.php

@ -108,7 +108,7 @@ $search = isset($_REQUEST['_search']) ? $_REQUEST['_search'] : false;
$forceSearch = isset($_REQUEST['_force_search']) ? $_REQUEST['_force_search'] : false;
$extra_fields = array();
if ($search || $forceSearch) {
if (($search || $forceSearch) && ($search !== 'false')) {
$whereCondition = ' 1 = 1 ';
$whereConditionInForm = getWhereClause($searchField, $searchOperator, $searchString);

@ -6998,7 +6998,7 @@ class SessionManager
$learnPath = new learnpath($course['code'], $learnPathId, $userId);
$stars += $learnPath->getCalculateStars();
$stars += $learnPath->getCalculateStars($sessionId);
}
$totalStars += $stars;
@ -7069,7 +7069,7 @@ class SessionManager
$learnPath = new learnpath($course['code'], $learnPathId, $userId);
$score += $learnPath->getCalculateScore();
$score += $learnPath->getCalculateScore($sessionId);
}
$totalPoints += $score;

@ -10179,19 +10179,17 @@ EOD;
return true;
}
/**
* Calculate the count of stars for a user
* @param int $lpId The learn path ID
* @param int $userId The user ID
* @param int $courseId The course ID
* Calculate the count of stars for a user in this LP
* @param int $sessionId Optional. The session ID
* @return int The count of stars
*/
public function getCalculateStars()
public function getCalculateStars($sessionId = 0)
{
$stars = 0;
$progress = self::getProgress($this->lp_id, $this->user_id, $this->course_int_id, $this->lp_session_id);
$progress = self::getProgress($this->lp_id, $this->user_id, $this->course_int_id, $sessionId);
if ($progress > 50) {
$stars++;
@ -10211,7 +10209,7 @@ EOD;
$this->user_id,
$exerciseItem->ref,
$this->course_int_id,
$this->lp_session_id,
$sessionId,
$this->lp_id,
$exerciseItem->db_id
);
@ -10248,7 +10246,7 @@ EOD;
$this->user_id,
$finalEvaluationItem->ref,
$this->course_int_id,
$this->lp_session_id,
$sessionId,
$this->lp_id,
$finalEvaluationItem->db_id
);
@ -10310,9 +10308,10 @@ EOD;
/**
* Calculate the total points achieved for the current user in this learning path
* @param int $sessionId Optional. The session Id
* @return int
*/
public function getCalculateScore()
public function getCalculateScore($sessionId = 0)
{
// Calculate stars chapters evaluation
$exercisesItems = $this->getExercisesItems();
@ -10327,7 +10326,7 @@ EOD;
$this->user_id,
$exerciseItem->ref,
$this->course_int_id,
$this->lp_session_id,
$sessionId,
$this->lp_id,
$exerciseItem->db_id
);
@ -10347,7 +10346,7 @@ EOD;
$this->user_id,
$finalEvaluationItem->ref,
$this->course_int_id,
$this->lp_session_id,
$sessionId,
$this->lp_id,
$finalEvaluationItem->db_id
);

Loading…
Cancel
Save