Minor - format code

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 1451a902b8
commit 3d5e047978
  1. 6
      main/admin/user_edit.php
  2. 11
      main/admin/user_export.php
  3. 21
      main/exercise/export/qti2/qti2_classes.php
  4. 2
      main/inc/lib/dashboard.lib.php
  5. 14
      main/inc/lib/fileUpload.lib.php
  6. 38
      main/inc/lib/usergroup.lib.php
  7. 19
      main/lp/aicc.class.php
  8. 9
      main/tracking/course_session_report.php

@ -2,8 +2,9 @@
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -12,11 +13,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
$user_id = isset($_GET['user_id']) ? intval($_GET['user_id']) : intval($_POST['user_id']);
api_protect_super_admin($user_id, null, true);
$is_platform_admin = api_is_platform_admin() ? 1 : 0;
$userInfo = api_get_user_info($user_id);
$htmlHeadXtra[] = '

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
@ -18,15 +19,12 @@ $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tool_name = get_lang('ExportUserListXMLCSV');
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
set_time_limit(0);
$coursesSessions = [];
$coursesSessions[''] = '--';
$allCoursesFromSessions = SessionManager::getAllCoursesFromAllSessions();
$coursesSessions = array_merge($coursesSessions, $allCoursesFromSessions);
$courses = array();
@ -56,7 +54,6 @@ $form->addElement('header', $tool_name);
$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'XML', 'xml');
$form->addElement('radio', 'file_type', null, 'CSV', 'csv');
$form->addElement('radio', 'file_type', null, 'XLS', 'xls');
$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'), '1');
$form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
$form->addElement('select', 'course_session', get_lang('OnlyUsersFromCourseSession'), $coursesSessions);
@ -144,7 +141,7 @@ if ($form->validate()) {
'Status',
'OfficialCode',
'PhoneNumber',
'RegistrationDate'
'RegistrationDate',
);
} else {
$data[] = array(
@ -158,7 +155,7 @@ if ($form->validate()) {
'Status',
'OfficialCode',
'PhoneNumber',
'RegistrationDate'
'RegistrationDate',
);
}
@ -175,7 +172,7 @@ if ($form->validate()) {
true,
false
);
foreach ($student_data as $key=>$value) {
foreach ($student_data as $key => $value) {
$key = substr($key, 6);
if (is_array($value)) {
$user[$key] = $value['extra_'.$key];

@ -63,6 +63,7 @@ class Ims2Question extends Question
return true;
}
}
/**
* Class
* @package chamilo.exercise
@ -104,12 +105,15 @@ class ImsAnswerMultipleChoice extends Answer
{
$this->answerList = $this->getAnswersList(true);
$type = $this->getQuestionType();
if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single';
if ($type == MCMA) {
$cardinality = 'multiple';
} else {
$cardinality = 'single';
}
$out = ' <responseDeclaration identifier="'.$questionIdent.'" cardinality="'.$cardinality.'" baseType="identifier">'."\n";
// Match the correct answers.
$out .= ' <correctResponse>'."\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $current_answer) {
@ -120,8 +124,7 @@ class ImsAnswerMultipleChoice extends Answer
}
$out .= ' </correctResponse>'."\n";
//Add the grading
// Add the grading
$out .= ' <mapping>'."\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $current_answer) {
@ -257,7 +260,7 @@ class ImsAnswerMatching extends Answer
if (isset($this->leftList) && is_array($this->leftList)) {
foreach ($this->leftList as $leftKey => $leftElement) {
$i = 0;
foreach ($this->rightList as $rightKey=>$rightElement) {
foreach ($this->rightList as $rightKey => $rightElement) {
if (($leftElement['match'] == $rightElement['code'])) {
$out .= ' <value>left_'.$leftKey.' right_'.$i.'</value>'."\n";
$gradeArray['left_'.$leftKey.' right_'.$i] = $leftElement['grade'];
@ -269,7 +272,7 @@ class ImsAnswerMatching extends Answer
$out .= ' </correctResponse>'."\n";
$out .= ' <mapping>'."\n";
if (is_array($gradeArray)) {
foreach ($gradeArray as $gradeKey=>$grade) {
foreach ($gradeArray as $gradeKey => $grade) {
$out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>'."\n";
}
}
@ -304,7 +307,7 @@ class ImsAnswerHotspot extends Answer
$text .= ' <prompt>'.$questionDesc.'</prompt>'."\n";
$text .= ' <object type="'.$mimetype.'" width="250" height="230" data="'.$questionMedia.'">-</object>'."\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $key=>$answer) {
foreach ($this->answerList as $key => $answer) {
$key = $answer['id'];
$answerTxt = $answer['answer'];
$len = api_strlen($answerTxt);
@ -328,7 +331,7 @@ class ImsAnswerHotspot extends Answer
$type = 'poly';
$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
break;
case 'delineation' :
case 'delineation':
$type = 'delineation';
$coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
break;
@ -354,7 +357,7 @@ class ImsAnswerHotspot extends Answer
$out .= ' <correctResponse>'."\n";
if (is_array($this->answerList)) {
foreach ($this->answerList as $answerKey=>$answer) {
foreach ($this->answerList as $answerKey => $answer) {
$answerKey = $answer['id'];
$answer = $answer['answer'];
$out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>';

@ -147,7 +147,6 @@ class DashboardManager
$possibleplugins = self::getPossibleDashboardPluginsPath();
if (count($possibleplugins) > 0) {
$selected_plugins = array_intersect(array_keys($plugin_paths), $possibleplugins);
$not_selected_plugins = array_diff($possibleplugins, array_keys($plugin_paths));
@ -315,7 +314,6 @@ class DashboardManager
/**
* get data about enabled dashboard block (stored insise block table)
* @param string $path plugin path
*
* @return array data
*/
public static function get_enabled_dashboard_blocks($path = '')

@ -826,9 +826,7 @@ function add_ext_on_mime($file_name, $file_type)
// Check whether the file has an extension AND whether the browser has sent a MIME Type
if (!preg_match('/^.*\.[a-zA-Z_0-9]+$/', $file_name) && $file_type) {
// Build a "MIME-types / extensions" connection table
static $mime_type = array();
$mime_type[] = 'application/msword'; $extension[] = '.doc';
@ -891,9 +889,7 @@ function add_ext_on_mime($file_name, $file_type)
// Test on PC (files with no extension get application/octet-stream)
//$mime_type[] = 'application/octet-stream'; $extension[] = '.ext';
// Check whether the MIME type sent by the browser is within the table
foreach ($mime_type as $key => & $type) {
if ($type == $file_type) {
$file_name .= $extension[$key];
@ -1065,7 +1061,6 @@ function unzip_uploaded_document(
// Check the zip content (real size and file extension)
$zip_content_array = (array) $zip->listContent();
$realSize = 0;
foreach ($zip_content_array as & $this_content) {
$realSize += $this_content['size'];
@ -1375,7 +1370,8 @@ function item_property_update_on_folder($_course, $path, $user_id)
* @param path+filename eg: /main/document/document.php
* @return The directory depth
*/
function get_levels($filename) {
function get_levels($filename)
{
$levels = explode('/', $filename);
if (empty($levels[count($levels) - 1])) {
unset($levels[count($levels) - 1]);
@ -1440,8 +1436,8 @@ function set_default_settings($upload_path, $filename, $filetype = 'file')
* @param string $html_file
* @return array - images path list
*/
function search_img_from_html($html_file) {
function search_img_from_html($html_file)
{
$img_path_list = array();
if (!$fp = fopen($html_file, 'r')) {
@ -1726,13 +1722,11 @@ function move_uploaded_file_collection_into_directory(
function replace_img_path_in_html_file($original_img_path, $new_img_path, $html_file)
{
// Open the file
$fp = fopen($html_file, 'r');
$buffer = fread($fp, filesize($html_file));
$new_html_content = '';
// Fix the image tags
for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) {
$replace_what = $original_img_path[$i];
// We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif

@ -160,7 +160,12 @@ class UserGroup extends Model
*/
public function get_id_by_name($name)
{
$row = Database::select('id', $this->table, array('where' => array('name = ?' => $name)), 'first');
$row = Database::select(
'id',
$this->table,
array('where' => array('name = ?' => $name)),
'first'
);
return $row['id'];
}
@ -745,8 +750,12 @@ class UserGroup extends Model
* @param bool $delete_users_not_present_in_list
* @param array $relationType
*/
public function subscribe_users_to_usergroup($usergroup_id, $list, $delete_users_not_present_in_list = true, $relationType = '')
{
public function subscribe_users_to_usergroup(
$usergroup_id,
$list,
$delete_users_not_present_in_list = true,
$relationType = ''
) {
$current_list = self::get_users_by_usergroup($usergroup_id);
$course_list = self::get_courses_by_usergroup($usergroup_id);
$session_list = self::get_sessions_by_usergroup($usergroup_id);
@ -1233,7 +1242,7 @@ class UserGroup extends Model
WHERE usergroup_id = $id";
Database::query($sql);*/
$result = parent::delete($id);
parent::delete($id);
}
/**
@ -1401,8 +1410,13 @@ class UserGroup extends Model
* @param string style css
* @return array with the file and the style of an image i.e $array['file'] $array['style']
*/
public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM, $style = '')
{
public function get_picture_group(
$id,
$picture_file,
$height,
$size_picture = GROUP_IMAGE_SIZE_MEDIUM,
$style = ''
) {
$picture = array();
//$picture['style'] = $style;
if ($picture_file === 'unknown.jpg') {
@ -1665,7 +1679,8 @@ class UserGroup extends Model
* @param array $user_list
* @param array $group_list
* @param int $relation_type
* */
* @return array
**/
public function add_users_to_groups($user_list, $group_list, $relation_type = GROUP_USER_PERMISSION_READER)
{
$table_url_rel_group = $this->usergroup_rel_user_table;
@ -1723,7 +1738,7 @@ class UserGroup extends Model
* @param int $relation_type
*
* @return boolean true if success
* */
**/
public function add_user_to_group($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
{
$table_url_rel_group = $this->usergroup_rel_user_table;
@ -1752,7 +1767,6 @@ class UserGroup extends Model
* @param int $user_id
* @param int $group_id
* @param int $relation_type
*
**/
public function update_user_role($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
{
@ -2011,7 +2025,7 @@ class UserGroup extends Model
* Shows the left column of the group page
* @param int group id
* @param int user id
*
* @return string
*/
public function show_group_column_information($group_id, $user_id, $show = '')
{
@ -2095,6 +2109,10 @@ class UserGroup extends Model
return $html;
}
/**
* @param int $group_id
* @param int $topic_id
*/
public function delete_topic($group_id, $topic_id)
{
$table_message = Database::get_main_table(TABLE_MESSAGE);

@ -330,7 +330,7 @@ class aicc extends learnpath
* @param string Current path (optional)
* @return string Absolute path to the AICC description files or empty string on error
*/
function import_local_package($file_path, $current_dir = '')
public function import_local_package($file_path, $current_dir = '')
{
// TODO: Prepare info as given by the $_FILES[''] vector.
$file_info = array();
@ -345,7 +345,7 @@ class aicc extends learnpath
* @param string Zip file info as given by $_FILES['userFile']
* @return string Absolute path to the AICC config files directory or empty string on error
*/
function import_package($zip_file_info, $current_dir = '')
public function import_package($zip_file_info, $current_dir = '')
{
if ($this->debug > 0) { error_log('In aicc::import_package('.print_r($zip_file_info, true).',"'.$current_dir.'") method', 0); }
//ini_set('error_log', 'E_ALL');
@ -854,7 +854,8 @@ class aicc extends learnpath
* Static function to parse AICC ini strings.
* Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
* @param string INI File string
* @param array List of names of sections that should be considered as containing only hard string data (no variables), provided in lower case
* @param array List of names of sections that should be considered
* as containing only hard string data (no variables), provided in lower case
* @return array Structured array
*/
function parse_ini_string_quotes_safe($s, $pure_strings = array())
@ -936,15 +937,17 @@ class aicc extends learnpath
if ($enclosed && $data{$i + 1} == $enclosure) {
$fldval .= $chr;
++$i; // Skip the next character.
} else
} else {
$enclosed = !$enclosed;
}
break;
case $delim:
if (!$enclosed) {
$ret_array[$linecount][$fldcount++] = $fldval;
$fldval = '';
} else
} else {
$fldval .= $chr;
}
break;
case "\r":
if (!$enclosed && $data{$i + 1} == "\n") {
@ -956,8 +959,9 @@ class aicc extends learnpath
$ret_array[$linecount++][$fldcount] = $fldval;
$fldcount = 0;
$fldval = '';
} else
} else {
$fldval .= $chr;
}
break;
case "\\r":
if (!$enclosed && $data{$i + 1} == "\\n") {
@ -969,8 +973,9 @@ class aicc extends learnpath
$ret_array[$linecount++][$fldcount] = $fldval;
$fldcount = 0;
$fldval = '';
} else
} else {
$fldval .= $chr;
}
break;
default:
$fldval .= $chr;

@ -103,7 +103,7 @@ foreach ($course_list as $current_course) {
$lp_list = $list->get_flat_list();
// Looping LPs
foreach ($lp_list as $lp_id =>$lp) {
foreach ($lp_list as $lp_id => $lp) {
$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
// Looping Chamilo Exercises in LP
foreach ($exercise_list as $exercise) {
@ -126,7 +126,6 @@ $total_average_score = 0;
$total_average_score_count = 0;
$html_result = '';
if (!empty($users) && is_array($users)) {
$html_result .= '<table class="data_table">';
$html_result .= '<tr><th>'.get_lang('User').'</th>';
foreach ($course_list as $item) {
@ -154,8 +153,6 @@ if (!empty($users) && is_array($users)) {
foreach ($course_list as $current_course) {
$total_course = 0;
$html_result .= "<td>";
$result = '-';
if (isset($main_result[$current_course['code']][$user['user_id']])) {
$user_info_stat = $main_result[$current_course['code']][$user['user_id']];
@ -168,9 +165,7 @@ if (!empty($users) && is_array($users)) {
$total_result_by_user += $result;
$course_average[$current_course['code']] += $total_course;
$course_average_counter[$current_course['code']]++;
$result = $result.' ('.$user_info_stat['attempts'].' '.get_lang(
'Attempts'
).')';
$result = $result.' ('.$user_info_stat['attempts'].' '.get_lang('Attempts').')';
$counter++;
}
}

Loading…
Cancel
Save