Minor - format code

pull/2487/head
jmontoyaa 8 years ago
parent 6eaf67450a
commit c76233eadd
  1. 7
      main/badge/assertion.php
  2. 1
      main/badge/class.php
  3. 2
      main/badge/criteria.php
  4. 5
      main/badge/issued.php
  5. 21
      main/badge/issued_all.php
  6. 19
      main/gradebook/lib/GradebookUtils.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;

@ -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);

@ -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 <angel.quiroz@beeznest.com>
* @package chamilo.badge
*/

@ -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")) {

@ -1,5 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\UserBundle\Entity\User;
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUserComment;
/**
* Show information about all issued badges with same skill by user
*
@ -58,8 +63,9 @@ $skillInfo = [
];
$allUserBadges = [];
/** @var SkillRelUser $skillIssue */
foreach ($userSkills as $index => $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'));

@ -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);

Loading…
Cancel
Save