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

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 8 years ago
commit 0f30608b58
  1. 18
      main/gradebook/lib/be/surveylink.class.php
  2. 4
      main/inc/lib/access_url_edit_sessions_to_url_functions.lib.php
  3. 4
      main/inc/lib/export.lib.inc.php
  4. 4
      main/inc/lib/fileDisplay.lib.php
  5. 6
      main/inc/lib/image.lib.php
  6. 4
      main/inc/lib/social.lib.php
  7. 6
      plugin/pens/chamilo_pens.php

@ -9,6 +9,7 @@
class SurveyLink extends AbstractLink
{
private $survey_table = null;
private $survey_data = [];
/**
* Constructor
@ -73,7 +74,7 @@ class SurveyLink extends AbstractLink
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$sql = 'SELECT survey_id, title, code FROM '.$tbl_survey.'
WHERE c_id = '.$course_id.' AND session_id = '.intval($session_id).'';
WHERE c_id = '.$course_id.' AND session_id = '.intval($session_id);
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
$links[] = array(
@ -97,7 +98,7 @@ class SurveyLink extends AbstractLink
if (empty($this->course_code)) {
die('Error in get_not_created_links() : course code not set');
}
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT survey_id, title, code
FROM '.$this->get_survey_table().' AS srv
@ -124,8 +125,9 @@ class SurveyLink extends AbstractLink
/**
* Has anyone done this survey yet?
* Implementation of the AbstractLink class, mainly used dynamically in gradebook/lib/fe
*/
public function has_results($stud_id=null)
public function has_results()
{
$ref_id = intval($this->get_ref_id());
$session_id = api_get_session_id();
@ -148,7 +150,9 @@ class SurveyLink extends AbstractLink
}
/**
* Calculate score for a student (to show in the gradebook)
* @param int $stud_id
* @param string $type Type of result we want (best|average|ranking)
* @return array|null
*/
public function calc_score($stud_id = null, $type = null)
@ -192,13 +196,11 @@ class SurveyLink extends AbstractLink
$rescount = 0;
$sum = 0;
$bestResult = 0;
$weight = 0;
while ($data = Database::fetch_array($sql_result)) {
$sum += $data['answered'] ? $max_score : 0;
$rescount++;
if ($data['answered'] > $bestResult) {
$bestResult = $data['answered'];
$weight = $assignment['qualification'];
}
}
$sum = $sum / $max_score;
@ -229,7 +231,7 @@ class SurveyLink extends AbstractLink
*/
private function get_survey_table()
{
$this->survey_table = Database :: get_course_table(TABLE_SURVEY);
$this->survey_table = Database::get_course_table(TABLE_SURVEY);
return $this->survey_table;
}
@ -243,7 +245,7 @@ class SurveyLink extends AbstractLink
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id).'';
session_id = '.intval($session_id);
$result = Database::query($sql);
$number = Database::fetch_row($result);
return ($number[0] != 0);
@ -285,7 +287,7 @@ class SurveyLink extends AbstractLink
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id).'';
session_id='.intval($session_id);
$query = Database::query($sql);
$this->survey_data = Database::fetch_array($query);
}

@ -28,7 +28,7 @@ class Accessurleditsessionstourl
*/
function search_sessions($needle, $id)
{
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$xajax_response = new xajaxResponse();
$return = '';
@ -44,7 +44,7 @@ class Accessurleditsessionstourl
LIMIT 11';
$rs = Database::query($sql);
$i=0;
while ($session = Database :: fetch_array($rs)) {
while ($session = Database::fetch_array($rs)) {
$i++;
if ($i<=10) {
$return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />';

@ -149,7 +149,7 @@ class Export
fwrite($handle, '</'.$wrapper_tagname.'>'."\n");
}
fclose($handle);
DocumentManager :: file_send_for_download($file, true, $filename.'.xml');
DocumentManager::file_send_for_download($file, true, $filename.'.xml');
exit;
}
@ -181,7 +181,7 @@ class Export
fwrite($handle, '</'.$wrapper_tagname.'>'."\n");
}
fclose($handle);
DocumentManager :: file_send_for_download($file, true, $filename.'.xml');
DocumentManager::file_send_for_download($file, true, $filename.'.xml');
return false;
}

@ -187,11 +187,11 @@ function chooseFolderIcon($folderPath)
}
switch ($folderPath) {
case '/audio';
case '/audio':
return 'folder_audio.gif';
case '/flash':
return 'folder_flash.gif';
case '/images';
case '/images':
return 'folder_images.gif';
case '/video':
return 'folder_video.gif';

@ -409,7 +409,8 @@ class GDWrapper extends ImageWrapper
@imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
@imagegif($dest, $this->path);
break;
default: return 0;
default:
return 0;
}
@imagedestroy($dest);
@imagedestroy($src);
@ -444,7 +445,8 @@ class GDWrapper extends ImageWrapper
}
return imagegif($this->bg, $file, $compress);
break;
default: return 0;
default:
return 0;
}
// TODO: Occupied memory is not released, because the following fragment of code is actually dead.
@imagedestroy($this->bg);

@ -852,7 +852,7 @@ class SocialManager extends UserManager
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$number_of_new_messages_of_friend = self::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = $usergroup->get_groups_by_user(
api_get_user_id(),
GROUP_USER_PERMISSION_PENDING_INVITATION,
@ -1057,7 +1057,7 @@ class SocialManager extends UserManager
}
// Check if I already sent an invitation message
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(
$invitation_sent_list = self::get_list_invitation_sent_by_user_id(
api_get_user_id()
);

@ -156,7 +156,7 @@ class ChamiloPens extends Plugin
$clean_client = Database::escape_string($this->_client);
$clean_vendor_data = Database::escape_string($this->_vendor_data);
$created_at = api_get_utc_datetime();
$table = Database::get_main_table(ChamiloPens::TABLE_NAME);
$table = Database::get_main_table(self::TABLE_NAME);
$sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (" .
"'" . $this->_pens_version . "', " .
"'" . $this->_package_type . "', " .
@ -186,7 +186,7 @@ class ChamiloPens extends Plugin
*/
public static function findByPackageId($package_id)
{
$table = Database::get_main_table(ChamiloPens::TABLE_NAME);
$table = Database::get_main_table(self::TABLE_NAME);
$sql_query = "SELECT * FROM $table WHERE package_id = '" . $package_id . "';";
$results = Database::query($sql_query);
$number = Database::num_rows($results);
@ -205,7 +205,7 @@ class ChamiloPens extends Plugin
*/
public static function findAll()
{
$table = Database::get_main_table(ChamiloPens::TABLE_NAME);
$table = Database::get_main_table(self::TABLE_NAME);
$sql_query = "SELECT * FROM $table ORDER BY created_at;";
$results = Database::query($sql_query);
$return = array();

Loading…
Cancel
Save