diff --git a/main/badge/assertion.php b/main/badge/assertion.php index c2f132564c..3d80826dc1 100644 --- a/main/badge/assertion.php +++ b/main/badge/assertion.php @@ -26,7 +26,12 @@ if (!$objSkill->user_has_skill($userId, $skillId, $courseId, $sessionId)) { } $objSkillRelUser = new SkillRelUser(); -$userSkill = $objSkillRelUser->getByUserAndSkill($userId, $skillId, $courseId, $sessionId); +$userSkill = $objSkillRelUser->getByUserAndSkill( + $userId, + $skillId, + $courseId, + $sessionId +); if ($userSkill == false) { exit; diff --git a/main/badge/class.php b/main/badge/class.php index 7547ef7ebe..6087fe7ac2 100644 --- a/main/badge/class.php +++ b/main/badge/class.php @@ -11,7 +11,6 @@ header('Content-Type: application/json'); require_once __DIR__.'/../inc/global.inc.php'; $skillId = isset($_GET['id']) ? intval($_GET['id']) : 0; - $objSkill = new Skill(); $skill = $objSkill->get($skillId); diff --git a/main/badge/criteria.php b/main/badge/criteria.php index 280def9789..4ffb62b823 100644 --- a/main/badge/criteria.php +++ b/main/badge/criteria.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** - * Show information about OpenBadge citeria + * Show information about OpenBadge criteria * @author Angel Fernando Quiroz Campos * @package chamilo.badge */ diff --git a/main/badge/issued.php b/main/badge/issued.php index d11373eaa3..ff896399ab 100644 --- a/main/badge/issued.php +++ b/main/badge/issued.php @@ -107,6 +107,7 @@ $skillIssueComments = $skillIssue->getComments(true); $userId = $skillIssueInfo['user_id']; $skillId = $skillIssueInfo['skill_id']; +/** @var SkillRelUserComment $comment */ foreach ($skillIssueComments as $comment) { $commentDate = api_get_local_time($comment->getFeedbackDateTime()); @@ -228,14 +229,14 @@ if ($allowDownloadExport) { $objSkill = new Skill(); $assertionUrl = $skillIssueInfo['badge_assertion']; $skills = $objSkill->get($skillId); - $unbakedBadge = api_get_path(SYS_UPLOAD_PATH)."badges/".$skills['icon']; + $unbakedBadge = api_get_path(SYS_UPLOAD_PATH).'badges/'.$skills['icon']; if (!is_file($unbakedBadge)) { $unbakedBadge = api_get_path(WEB_CODE_PATH).'img/icons/128/badges-default.png'; } $unbakedBadge = file_get_contents($unbakedBadge); $badgeInfoError = false; - $personalBadge = ""; + $personalBadge = ''; $png = new PNGImageBaker($unbakedBadge); if ($png->checkChunks("tEXt", "openbadges")) { diff --git a/main/badge/issued_all.php b/main/badge/issued_all.php index 9ba5a5c0b3..ab7af35004 100644 --- a/main/badge/issued_all.php +++ b/main/badge/issued_all.php @@ -1,5 +1,10 @@ $skillIssue) { + /** @var User $currentUser */ $currentUser = $em->find('ChamiloUserBundle:User', $currentUserId); $allowDownloadExport = $currentUser ? $currentUser->getId() === $user->getId() : false; $allowComment = $currentUser ? Skill::userCanAddFeedbackToUser($currentUser, $user) : false; @@ -98,7 +104,6 @@ foreach ($userSkills as $index => $skillIssue) { foreach ($skillIssueComments as $comment) { $commentDate = api_get_local_time($comment->getFeedbackDateTime()); - $skillIssueInfo['comments'][] = [ 'text' => $comment->getFeedbackText(), 'value' => $comment->getFeedbackValue(), @@ -108,11 +113,9 @@ foreach ($userSkills as $index => $skillIssue) { } $acquiredLevel = []; - $profile = $skillRepo->find($skillId)->getProfile(); if (!$profile) { - $skillRelSkill = new SkillRelSkill(); $parents = $skillRelSkill->get_skill_parents($skillId); @@ -174,7 +177,11 @@ foreach ($userSkills as $index => $skillIssue) { exit; } - $form = new FormValidator('comment'.$skillIssue->getId(), 'post', $skillIssue->getIssueUrlAll()); + $form = new FormValidator( + 'comment'.$skillIssue->getId(), + 'post', + $skillIssue->getIssueUrlAll() + ); $form->addTextarea('comment', get_lang('NewComment'), ['rows' => 4]); $form->applyFilter('comment', 'trim'); $form->addRule('comment', get_lang('ThisFieldIsRequired'), 'required'); @@ -190,7 +197,7 @@ foreach ($userSkills as $index => $skillIssue) { if ($form->validate() && $allowComment) { $values = $form->exportValues(); - $skillUserComment = new Chamilo\CoreBundle\Entity\SkillRelUserComment(); + $skillUserComment = new SkillRelUserComment(); $skillUserComment ->setFeedbackDateTime(new DateTime) ->setFeedbackGiver($currentUser) @@ -210,7 +217,6 @@ foreach ($userSkills as $index => $skillIssue) { if ($allowDownloadExport) { $backpack = 'https://backpack.openbadges.org/'; - $configBackpack = api_get_setting('openbadges_backpack'); if (strcmp($backpack, $configBackpack) !== 0) { @@ -264,7 +270,6 @@ foreach ($userSkills as $index => $skillIssue) { $allUserBadges[$index]['acquired_level_form'] = $formAcquiredLevel->returnForm(); $allUserBadges[$index]['badge_error'] = $badgeInfoError; $allUserBadges[$index]['personal_badge'] = $personalBadge; - } $template = new Template(get_lang('IssuedBadgeInformation')); diff --git a/main/gradebook/lib/GradebookUtils.php b/main/gradebook/lib/GradebookUtils.php index ce39a14ec2..b1d9f6e4c9 100644 --- a/main/gradebook/lib/GradebookUtils.php +++ b/main/gradebook/lib/GradebookUtils.php @@ -848,8 +848,20 @@ class GradebookUtils self::create_default_course_gradebook(); // Cat list - $all_categories = Category::load(null, null, $course_code, null, null, $session_id, false); - $select_gradebook = $form->addElement('select', 'category_id', get_lang('SelectGradebook')); + $all_categories = Category::load( + null, + null, + $course_code, + null, + null, + $session_id, + false + ); + $select_gradebook = $form->addElement( + 'select', + 'category_id', + get_lang('SelectGradebook') + ); if (!empty($all_categories)) { foreach ($all_categories as $my_cat) { @@ -1216,7 +1228,8 @@ class GradebookUtils $tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE); - $sql = 'UPDATE '.$table_link.' SET weight = '."'".Database::escape_string($weight)."'".' + $sql = 'UPDATE '.$table_link.' + SET weight = '."'".Database::escape_string($weight)."'".' WHERE id = '.$linkId; Database::query($sql);