Minor - format code

pull/3375/head
Julio Montoya 5 years ago
parent 8d695d4674
commit 532c50bcfa
  1. 8
      main/course_home/course_home.php
  2. 16
      main/course_info/delete_course.php
  3. 6
      main/coursecopy/recycle_course.php
  4. 2
      main/exercise/exercise_result.php
  5. 2
      main/inc/lib/document.lib.php
  6. 12
      main/inc/lib/events.lib.php
  7. 2
      main/inc/lib/formvalidator/Element/SelectAjax.php
  8. 4
      main/inc/lib/message.lib.php
  9. 13
      main/inc/lib/social.lib.php
  10. 4
      main/social/vcard_export.php

@ -171,13 +171,13 @@ $htmlHeadXtra[] = '<script type="text/javascript">
if (info.message == "is_active") { if (info.message == "is_active") {
message = "'.get_lang('ToolIsNowVisible', '').'"; message = "'.get_lang('ToolIsNowVisible', '').'";
$("#" + tool_id) $("#" + tool_id)
.attr("alt", "' . get_lang('Activate', '') . '") .attr("alt", "'.get_lang('Activate', '').'")
.attr("title", "' . get_lang('Activate', '') . '"); .attr("title", "'.get_lang('Activate', '').'");
} else { } else {
message = "'.get_lang('ToolIsNowHidden', '').'"; message = "'.get_lang('ToolIsNowHidden', '').'";
$("#" + tool_id) $("#" + tool_id)
.attr("alt", "' . get_lang('Deactivate', '') . '") .attr("alt", "'.get_lang('Deactivate', '').'")
.attr("title", "' . get_lang('Deactivate', '') . '"); .attr("title", "'.get_lang('Deactivate', '').'");
} }
$(".normal-message").hide(); $(".normal-message").hide();
$("#id_confirmation_message").html(message); $("#id_confirmation_message").html(message);

@ -32,30 +32,30 @@ if (isset($_GET['delete']) && $_GET['delete'] === 'yes' && $_GET['course_code']
// DELETE CONFIRMATION MESSAGE // DELETE CONFIRMATION MESSAGE
Session::erase('_cid'); Session::erase('_cid');
Session::erase('_real_cid'); Session::erase('_real_cid');
$message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>'; $message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
$message .= get_lang('HasDel'); $message .= get_lang('HasDel');
$message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . '</a>'; $message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').'</a>';
} else { } else {
/* message if code course is incorrect */ /* message if code course is incorrect */
$message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>'; $message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
$message .= '<p>'.get_lang('CourseRegistrationCodeIncorrect').'</p>'; $message .= '<p>'.get_lang('CourseRegistrationCodeIncorrect').'</p>';
$message .= '<p><a class="btn btn-primary" href="' $message .= '<p><a class="btn btn-primary" href="'
.api_get_path(WEB_CODE_PATH) .api_get_path(WEB_CODE_PATH)
.'course_info/delete_course.php?' .'course_info/delete_course.php?'
.api_get_cidreq() .api_get_cidreq()
.'">'.get_lang('BackToPreviousPage').'</a>'; .'">'.get_lang('BackToPreviousPage').'</a>';
$message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . '</a>'; $message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').'</a>';
$type_info_message = 'error'; $type_info_message = 'error';
} }
} else { } else {
$message = '<h3>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h3>'; $message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>';
$message .= '<p>' . get_lang('ByDel') . '</p>'; $message .= '<p>'.get_lang('ByDel').'</p>';
$message .= '<p><span class="form_required">*</span>' $message .= '<p><span class="form_required">*</span>'
.get_lang('CourseCodeConfirmation') .get_lang('CourseCodeConfirmation')
.'&nbsp;<input type="text" name="course_code" id="course_code"></p>'; .'&nbsp;<input type="text" name="course_code" id="course_code"></p>';
$message .= '<p>'; $message .= '<p>';
$message .= '<button class="btn btn-danger delete-course">' . get_lang('ValidateChanges') . '</button>'; $message .= '<button class="btn btn-danger delete-course">'.get_lang('ValidateChanges').'</button>';
$message .= '&nbsp;'; $message .= '&nbsp;';
$message .= '<a class="btn btn-primary"href="' $message .= '<a class="btn btn-primary"href="'
.api_get_path(WEB_CODE_PATH) .api_get_path(WEB_CODE_PATH)
@ -69,7 +69,7 @@ if (isset($_GET['delete']) && $_GET['delete'] === 'yes' && $_GET['course_code']
'name' => get_lang('Maintenance'), 'name' => get_lang('Maintenance'),
]; ];
} }
$htmlHeadXtra[] ='<script> $htmlHeadXtra[] = '<script>
$(function(){ $(function(){
/* Asking by course code to confirm recycling*/ /* Asking by course code to confirm recycling*/
$(".delete-course").on("click",function(){ $(".delete-course").on("click",function(){

@ -16,7 +16,6 @@ require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE; $current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true); api_protect_course_script(true);
$_course = api_get_course_info(); $_course = api_get_course_info();
$current_course_code = $_course['official_code']; $current_course_code = $_course['official_code'];
@ -60,7 +59,7 @@ if (Security::check_token('post') && (
} }
$recycle_type = ''; $recycle_type = '';
$fullDelete = 0; $fullDelete = 0;
$courseCodeConfirmation =''; $courseCodeConfirmation = '';
if (isset($_POST['course_code_confirmation'])) { if (isset($_POST['course_code_confirmation'])) {
$courseCodeConfirmation = $_POST['course_code_confirmation']; $courseCodeConfirmation = $_POST['course_code_confirmation'];
} }
@ -78,13 +77,12 @@ if (Security::check_token('post') && (
$cr->recycle($recycle_type); $cr->recycle($recycle_type);
echo Display::return_message(get_lang('RecycleFinished'), 'confirm'); echo Display::return_message(get_lang('RecycleFinished'), 'confirm');
} else { } else {
$messageFailCourseCode = '<p>' . get_lang('CourseRegistrationCodeIncorrect') . '</p>'; $messageFailCourseCode = '<p>'.get_lang('CourseRegistrationCodeIncorrect').'</p>';
$messageFailCourseCode .= '<p><a class="btn btn-primary" href="'.api_get_self().'?'.api_get_cidreq().'">'. $messageFailCourseCode .= '<p><a class="btn btn-primary" href="'.api_get_self().'?'.api_get_cidreq().'">'.
get_lang('BackToPreviousPage'). get_lang('BackToPreviousPage').
'</a></p>'; '</a></p>';
echo Display::return_message($messageFailCourseCode, 'error', false); echo Display::return_message($messageFailCourseCode, 'error', false);
} }
} elseif ($recycle_type == 'select_items') { } elseif ($recycle_type == 'select_items') {
$cr->recycle($recycle_type); $cr->recycle($recycle_type);
echo Display::return_message(get_lang('RecycleFinished'), 'confirm'); echo Display::return_message(get_lang('RecycleFinished'), 'confirm');

@ -106,7 +106,7 @@ if (api_is_course_admin() && !in_array($origin, ['learnpath', 'embeddable'])) {
.Display::url( .Display::url(
Display::return_icon('edit.png', get_lang('ModifyExercise'), [], 32), Display::return_icon('edit.png', get_lang('ModifyExercise'), [], 32),
'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id
) ),
] ]
); );
} }

@ -591,7 +591,7 @@ class DocumentManager
} }
$where = ''; $where = '';
if ($search != true) { if ($search != true) {
$where .= "docs.path NOT LIKE '" . Database::escape_string($path . $addedSlash . '%/%') . "' AND"; $where .= "docs.path NOT LIKE '".Database::escape_string($path.$addedSlash.'%/%')."' AND";
} }
$sql = "SELECT $sql = "SELECT
docs.id, docs.id,

@ -1,7 +1,7 @@
<?php <?php
/* See license terms in /license.txt */ /* See license terms in /license.txt */
//use Chamilo\UserBundle\Entity\User;
use Chamilo\CoreBundle\Component\Utils\ChamiloApi; use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use ChamiloSession as Session; use ChamiloSession as Session;
@ -2237,11 +2237,11 @@ class Event
* updating the current one to be just the considered_working_time and * updating the current one to be just the considered_working_time and
* end at the same second as the user connected to the course. * end at the same second as the user connected to the course.
* *
* @param int $courseId The course in which to add the time * @param int $courseId The course in which to add the time
* @param int $userId The user for whom to add the time * @param int $userId The user for whom to add the time
* @param int $sessionId The session in which to add the time (if any) * @param int $sessionId The session in which to add the time (if any)
* @param string $virtualTime The amount of time to be added, * @param string $virtualTime The amount of time to be added,
* in a hh:mm:ss format. If int, we consider it is expressed in hours. * in a hh:mm:ss format. If int, we consider it is expressed in hours.
* @param int $resultWorkId Student publication id result * @param int $resultWorkId Student publication id result
* *
* @return true on successful insertion, false otherwise * @return true on successful insertion, false otherwise

@ -76,7 +76,7 @@ class SelectAjax extends HTML_QuickForm_select
$max = !empty($max) ? "maximumSelectionLength: $max, " : ''; $max = !empty($max) ? "maximumSelectionLength: $max, " : '';
// wait XX milliseconds before triggering the request // wait XX milliseconds before triggering the request
$delay = (int)$this->getAttribute('delay'); $delay = (int) $this->getAttribute('delay');
$delay = (0 !== $delay) ? "delay: $delay, " : ''; $delay = (0 !== $delay) ? "delay: $delay, " : '';
$html = <<<JS $html = <<<JS

@ -1537,10 +1537,10 @@ class MessageManager
$message_content .= '<a href="inbox.php?action=deleteone&id='.$messageId.'&'.$social_link.'" >'. $message_content .= '<a href="inbox.php?action=deleteone&id='.$messageId.'&'.$social_link.'" >'.
Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp;'; Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp;';
if ($idPrevMessage != 0) { if ($idPrevMessage != 0) {
$message_content .= '<a title="' . get_lang('PrevMessage') . '" href="view_message.php?type=' . $type . '&id=' . $idPrevMessage . '" ">' . Display::return_icon('icons/22/back.png', get_lang('ScormPrevious')) . '</a> &nbsp'; $message_content .= '<a title="'.get_lang('PrevMessage').'" href="view_message.php?type='.$type.'&id='.$idPrevMessage.'" ">'.Display::return_icon('icons/22/back.png', get_lang('ScormPrevious')).'</a> &nbsp';
} }
if ($idNextMessage != 0) { if ($idNextMessage != 0) {
$message_content .= '<a title="' . get_lang('NextMessage') . '" href="view_message.php?type=' . $type . '&id=' . $idNextMessage . '">' . Display::return_icon('icons/22/move.png', get_lang('ScormNext')) . '</a> &nbsp'; $message_content .= '<a title="'.get_lang('NextMessage').'" href="view_message.php?type='.$type.'&id='.$idNextMessage.'">'.Display::return_icon('icons/22/move.png', get_lang('ScormNext')).'</a> &nbsp';
} }
break; break;
} }

@ -54,9 +54,9 @@ class SocialManager extends UserManager
/** /**
* Get the kind of relation between contacts. * Get the kind of relation between contacts.
* *
* @param int $user_id user id * @param int $user_id user id
* @param int $user_friend user friend id * @param int $user_friend user friend id
* @param boolean $includeRH include the RH relationship * @param bool $includeRH include the RH relationship
* *
* @return int * @return int
* *
@ -112,15 +112,14 @@ class SocialManager extends UserManager
foreach ($targetUserCoursesList as $course) { foreach ($targetUserCoursesList as $course) {
$teachersList = CourseManager::get_teacher_list_from_course_code($course['code']); $teachersList = CourseManager::get_teacher_list_from_course_code($course['code']);
foreach ($teachersList as $teacher) { foreach ($teachersList as $teacher) {
if ($currentUserId == $teacher['user_id']) { if ($currentUserId == $teacher['user_id']) {
return USER_RELATION_TYPE_GOODFRIEND; return USER_RELATION_TYPE_GOODFRIEND;
} }
} }
} }
} else { } else {
return USER_UNKNOWN; return USER_UNKNOWN;
} }
} }
} }

@ -25,7 +25,7 @@ $userInfo = api_get_user_info($userId, true, false, true);
/* Get the relationship between current user and vCard user */ /* Get the relationship between current user and vCard user */
$currentUserId = api_get_user_id(); $currentUserId = api_get_user_id();
$hasRelation = SocialManager::get_relation_between_contacts( $hasRelation = SocialManager::get_relation_between_contacts(
$currentUserId, $currentUserId,
$userId, $userId,
true true
@ -38,7 +38,7 @@ if ($hasRelation == 0) {
if (empty($userInfo)) { if (empty($userInfo)) {
api_not_allowed(true); api_not_allowed(true);
} }
if (api_get_user_id() != $userId && !SocialManager::get_relation_between_contacts(api_get_user_id(),$userId)) { if (api_get_user_id() != $userId && !SocialManager::get_relation_between_contacts(api_get_user_id(), $userId)) {
api_not_allowed(true); api_not_allowed(true);
} }
// Pre-Loaded User Info // Pre-Loaded User Info

Loading…
Cancel
Save