Minor - format code, add int casting, remove comments from master

pull/2970/head
Julio Montoya 7 years ago
parent 839f2c0dc9
commit 1077e12426
  1. 2
      main/admin/dashboard_add_users_to_user.php
  2. 2
      main/admin/sub_language.php
  3. 31
      main/exercise/hotspot_answers.as.php
  4. 4
      main/gradebook/lib/GradebookUtils.php
  5. 2
      main/inc/lib/api.lib.php
  6. 6
      main/inc/lib/course_category.lib.php
  7. 13
      main/inc/lib/document.lib.php
  8. 2
      main/inc/lib/image.lib.php
  9. 4
      main/inc/lib/internationalization.lib.php

@ -441,7 +441,7 @@ $result = Database::query($sql);
<?php if ($add_type == 'multiple') {
?>
<p><?php echo get_lang('FirstLetterUser'); ?></p>
<select class="selectpicker form-control" name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')">
<select class="selectpicker show-tick form-control" name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')">
<option value="%">--</option>
<?php echo Display::get_alphabet_options($firstLetterUser); ?>
</select>

@ -12,7 +12,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function () {
$(".save").click(function() {
var button_name=$(this).attr("name");
var button_array=button_name.split("|");

@ -166,37 +166,8 @@ if (!$hideExpectedAnswer) {
/** @var CQuizAnswer $hotSpotAnswer */
foreach ($result as $hotSpotAnswer) {
$hotSpotAnswerId = $hotSpotAnswer->getIid();
// Show only correct hotspots
/*
if ($objExercise->selectResultsDisabled() == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
$TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// Check auto id
$sql = "SELECT hotspot_correct
FROM $TBL_TRACK_HOTSPOT
WHERE
hotspot_exe_id = $exeId AND
hotspot_question_id= $questionId AND
hotspot_answer_id = ".$hotSpotAnswerId."
ORDER BY hotspot_id ASC";
$result = Database::query($sql);
$studentChoice = false;
if (Database::num_rows($result)) {
$studentChoice = Database::result(
$result,
0,
'hotspot_correct'
);
}
if (!$studentChoice) {
continue;
}
}*/
$hotSpot = [];
$hotSpot['id'] = $hotSpotAnswerId;
$hotSpot['id'] = $hotSpotAnswer->getIid();
$hotSpot['answer'] = $hotSpotAnswer->getAnswer();
switch ($hotSpotAnswer->getHotspotType()) {

@ -1154,6 +1154,8 @@ class GradebookUtils
*
* @param string $courseCode
*
* @deprecated use CourseManager
*
* @return array
*/
public static function get_users_in_course($courseCode)
@ -1183,7 +1185,7 @@ class GradebookUtils
$sql = 'SELECT user.user_id, user.username, lastname, firstname, official_code
FROM '.$tbl_course_user.' as course_rel_user
INNER JOIN '.$tbl_user.' as user
ON (course_rel_user.user_id=user.user_id)
ON (course_rel_user.user_id = user.id)
WHERE
course_rel_user.status = '.STUDENT.' AND
course_rel_user.c_id = "'.$courseId.'" '.

@ -1058,8 +1058,6 @@ function api_is_facebook_auth_activated()
function api_add_trailing_slash($path)
{
return substr($path, -1) == '/' ? $path : $path.'/';
// This code is about 20% faster than the preg_replace equivalent
//return preg_replace('/([^\/])$/', '$1/', $path);
}
/**

@ -33,11 +33,11 @@ class CourseCategory
*
* @return array
*/
public static function getCategory($category)
public static function getCategory($categoryCode)
{
$table = Database::get_main_table(TABLE_MAIN_CATEGORY);
$category = Database::escape_string($category);
$sql = "SELECT * FROM $table WHERE code ='$category'";
$categoryCode = Database::escape_string($categoryCode);
$sql = "SELECT * FROM $table WHERE code ='$categoryCode'";
$result = Database::query($sql);
if (Database::num_rows($result)) {
$category = Database::fetch_array($result, 'ASSOC');

@ -1691,11 +1691,10 @@ class DocumentManager
}
}
$doc_id = intval($doc_id);
$session_id = intval($session_id);
//2. Course and Session visibility are handle in local.inc.php/global.inc.php
//3. Checking if user exist in course/session
$doc_id = (int) $doc_id;
$session_id = (int) $session_id;
// 2. Course and Session visibility are handle in local.inc.php/global.inc.php
// 3. Checking if user exist in course/session
if ($session_id == 0) {
if (is_null($userIsSubscribed)) {
$userIsSubscribed = CourseManager::is_user_subscribed_in_course(
@ -4731,7 +4730,7 @@ class DocumentManager
return false;
}
$sessionId = intval($sessionId);
$sessionId = (int) $sessionId;
$folderWithSuffix = self::fixDocumentName(
$folder,
'folder',
@ -4783,7 +4782,7 @@ class DocumentManager
return false;
}
$sessionId = intval($sessionId);
$sessionId = (int) $sessionId;
$fileNameEscape = Database::escape_string($fileName);
$fileNameWithSuffix = self::fixDocumentName(

@ -66,7 +66,7 @@ class Image
}
/**
* @param $cropParameters
* @param string $cropParameters
*
* @return bool
*/

@ -16,10 +16,6 @@ use Patchwork\Utf8;
* @package chamilo.library
*/
/**
* Constants.
*/
// Special tags for marking untranslated variables.
define('SPECIAL_OPENING_TAG', '[=');
define('SPECIAL_CLOSING_TAG', '=]');

Loading…
Cancel
Save