Browse Source

Minor - format code

jmontoyaa 7 years ago
parent
commit
e00b9728c5

+ 3 - 2
main/admin/settings.lib.php

@@ -1448,9 +1448,10 @@ function generateSettingsForm($settings, $settings_by_access_list)
                         ['maxlength' => '5', 'aria-label' => get_lang($row['title'])]
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
-                    $default_values[$row['variable']] = $row['selected_value'];
 
-                    // For platform character set selection: Conversion of the textfield to a select box with valid values.
+                    // For platform character set selection:
+                    // Conversion of the textfield to a select box with valid values.
+                    $default_values[$row['variable']] = $row['selected_value'];
                 } elseif ($row['variable'] == 'platform_charset') {
                     continue;
                 } else {

+ 1 - 2
main/course_home/vertical_activity.php

@@ -100,12 +100,11 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
     }
 
     $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
-
+    //	TOOLS AUTHORING
     $blocks[] = [
         'class' => 'Authoringview',
         'content' => CourseHome::show_tools_category($my_list)
     ];
-    //	TOOLS AUTHORING
 } else {
     $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
     if (count($my_list) > 0) {

+ 0 - 1
main/exercise/exercise.class.php

@@ -5588,7 +5588,6 @@ class Exercise
             } elseif (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION, READING_COMPREHENSION])) {
                 $answer = $choice;
                 Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
-                //            } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
             } elseif ($answerType == HOT_SPOT || $answerType == ANNOTATION) {
                 $answer = [];
                 if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) {

+ 1 - 1
main/exercise/exercise_admin.php

@@ -189,8 +189,8 @@ if ($form->validate()) {
     } else {
         if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
             if (!empty($_POST['lp_id'])) {
-                $lp_id = intval($_POST['lp_id']);
                 //TODO:this remains to be implemented after press the first post
+                $lp_id = intval($_POST['lp_id']);
             } else {
                 $lp_id = intval($_GET['lp_id']);
             }

+ 2 - 8
main/exercise/hotpotatoes_exercise_report.php

@@ -99,17 +99,11 @@ $nameTools = get_lang('Results');
 
 if ($is_allowedToEdit || $is_tutor) {
     $nameTools = get_lang('StudentScore');
-    $interbreadcrumb[] = ["url" => "exercise.php", "name" => get_lang('Exercises')];
+    $interbreadcrumb[] = ["url" => "exercise.php".api_get_cidreq(), "name" => get_lang('Exercises')];
     $objExerciseTmp = new Exercise();
-    /*if ($objExerciseTmp->read($exercise_id)) {
-        $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exercise_id, "name" => $objExerciseTmp->name);
-    }*/
 } else {
-    $interbreadcrumb[] = ["url" => "exercise.php", "name" => get_lang('Exercises')];
+    $interbreadcrumb[] = ["url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')];
     $objExerciseTmp = new Exercise();
-    /*if ($objExerciseTmp->read($exercise_id)) {
-        $nameTools = get_lang('Results').': '.$objExerciseTmp->name;
-    }*/
 }
 
 Display :: display_header($nameTools);

+ 0 - 5
main/forum/viewforumcategory.php

@@ -273,20 +273,15 @@ if ($action != 'add') {
                         $show_forum = true;
                     } else {
                         // it is a group forum
-                        //echo '-groepsforum';
                         // it is a group forum but it is public => show
                         if ($forum['forum_group_public_private'] == 'public') {
                             $show_forum = true;
-                            //echo '-publiek';
                         } else {
                             // it is a group forum and it is private
-                            //echo '-prive';
                             // it is a group forum and it is private but the user is member of the group
                             if (in_array($forum['forum_of_group'], $groups_of_user)) {
-                                //echo '-is lid';
                                 $show_forum = true;
                             } else {
-                                //echo '-is GEEN lid';
                                 $show_forum = false;
                             }
                         }

+ 1 - 1
main/gradebook/lib/be/category.class.php

@@ -1844,13 +1844,13 @@ class Category implements GradebookItem
             if (api_is_allowed_to_edit() && !api_is_platform_admin()) {
                 // root
                 if ($this->id == 0) {
+                    // inside a course
                     return $this->get_root_categories_for_teacher(
                         api_get_user_id(),
                         $course_code,
                         $session_id,
                         false
                     );
-                    // inside a course
                 } elseif (!empty($this->course_code)) {
                     return self::load(
                         null,

+ 0 - 4
main/inc/ajax/model.ajax.php

@@ -2084,13 +2084,9 @@ switch ($action) {
                 if ($obj->usergroup_was_added_in_course($group['id'], $course_id)) {
                     $url  = 'class.php?action=remove_class_from_course&id='.$group['id'].'&'.api_get_cidreq();
                     $icon = Display::return_icon('delete.png', get_lang('Remove'));
-                    //$class = 'btn btn-danger';
-                    //$text = get_lang('Remove');
                 } else {
                     $url = 'class.php?action=add_class_to_course&id='.$group['id'].'&'.api_get_cidreq().'&type=not_registered';
-                    //$class = 'btn btn-primary';
                     $icon = Display::return_icon('add.png', get_lang('Add'));
-                    //$text = get_lang('Add');
                 }
 
                 switch ($group['group_type']) {

+ 1 - 1
main/inc/global.inc.php

@@ -580,8 +580,8 @@ if (!isset($_SESSION['login_as']) && isset($_user)) {
 
         if ($res_logout_date < time() - $lifeTime) {
             // it isn't, we should create a fresh entry
-            Event::eventLogin($_user['user_id']);
             // now that it's created, we can get its ID and carry on
+            Event::eventLogin($_user['user_id']);
         } else {
             $sql = "UPDATE $tbl_track_login SET logout_date = '$now'
                     WHERE login_id = '$i_id_last_connection'";

+ 0 - 3
main/inc/lib/AnnouncementManager.php

@@ -1537,7 +1537,6 @@ class AnnouncementManager
                             $extraGroupCondition
                         $groupBy
                         ORDER BY display_order DESC";
-                //GROUP BY ip.ref
             } else {
                 // A.3 you are a course admin without any group or user filter
                 // A.3.a you are a course admin without user or group filter but WITH studentview
@@ -1556,8 +1555,6 @@ class AnnouncementManager
                                 $searchCondition
                             $groupBy
                             ORDER BY display_order DESC";
-
-                    //GROUP BY ip.ref
                 } else {
                     // A.3.a you are a course admin without user or group filter and WTIHOUT studentview (= the normal course admin view)
                     // => see all the messages of all the users and groups with editing possibilities

+ 0 - 1
main/inc/lib/agenda.lib.php

@@ -3907,7 +3907,6 @@ class Agenda
                                 );
                                 $result .= '</div>';
                                 $html .= $result;
-                                //echo Display::div($content, array('id'=>'main_'.$value['calendar_type'].'_'.$value['id'], 'class' => 'dialog'));
                             } else {
                                 $html .= $result .= $icon.'</div>';
                             }

+ 2 - 2
main/inc/lib/course_home.lib.php

@@ -168,11 +168,11 @@ class CourseHome
                 if (strpos($tool['name'], 'visio_') !== false) {
                     $cell_content .= '<a  href="javascript: void(0);" onclick="javascript: window.open(\''.$tool['link'].$link_annex.'\',\'window_visio'.api_get_course_id().'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$tool['target'].'"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
                 } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
-                    $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\''.$tool['link'].$link_annex.'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$tool['target'].'"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
                     // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
+                    $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\''.$tool['link'].$link_annex.'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$tool['target'].'"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
                 } else {
-                    $cell_content .= '<a href="'.$tool['link'].$link_annex.'" target="'.$tool['target'].'"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
                     // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
+                    $cell_content .= '<a href="'.$tool['link'].$link_annex.'" target="'.$tool['target'].'"><img src="'.$tool['img'].'" title="'.$tool_name.'" alt="'.$tool_name.'" align="absmiddle" border="0">'.$tool_name.'</a>';
                 }
             } else {
                 // INVISIBLE

+ 0 - 6
main/inc/lib/events.lib.php

@@ -2030,17 +2030,11 @@ class Event
             if (Database::num_rows($result) > 0) {
                 $row = Database::fetch_array($result, 'ASSOC');
                 $courseAccessId = $row['course_access_id'];
-                /*$logout = $row['logout_course_date'];
-                $now = time();
-                $logout = api_strtotime($logout, 'UTC');
-                */
-                //if ($now - $logout < $sessionLifetime) {
                 $sql = "UPDATE $tableCourseAccess SET 
                                 logout_course_date = '$currentDate', 
                                 counter = counter + 1
                             WHERE course_access_id = $courseAccessId";
                 Database::query($sql);
-                //}
             } else {
                 $insert = true;
             }

+ 1 - 1
main/inc/lib/myspace.lib.php

@@ -2321,11 +2321,11 @@ class MySpace
                 } else {
                     $is_session_avail = self::user_available_in_session($user['UserName'], $course_list, $id_session);
                     if ($is_session_avail == 0) {
+                        // This should be the ID because the user exists.
                         $user_name = $user['UserName'];
                         $sql_select = "SELECT user_id FROM $table_user WHERE username ='$user_name' ";
                         $rs = Database::query($sql_select);
                         $user['create'] = Database::result($rs, 0, 0);
-                        // This should be the ID because the user exists.
                     } else {
                         $user['create'] = $is_session_avail;
                     }

+ 0 - 1
main/inc/local.inc.php

@@ -538,7 +538,6 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
                 /* >>>>>>>> External authentication modules <<<<<<<<< */
                 // see configuration.php to define these
                 include_once($extAuthSource[$key]['login']);
-                /* >>>>>>>> External authentication modules <<<<<<<<< */
             } else { // no standard Chamilo login - try external authentification
                 //huh... nothing to do... we shouldn't get here
                 error_log(

+ 1 - 1
main/lp/lp_final_item.php

@@ -108,6 +108,7 @@ if ($accessGranted == false) {
     );
     // If not gradebook has been defined
     if (empty($catLoad)) {
+        // TODO: Missing validation of learning path completion
         $finalItemTemplate = generateLPFinalItemTemplate(
             $id,
             $courseCode,
@@ -115,7 +116,6 @@ if ($accessGranted == false) {
             $downloadCertificateLink,
             $badgeLink
         );
-        // TODO: Missing validation of learning path completion
     } else {
         // A gradebook was found, proceed...
         /** @var Category $category */

+ 1 - 1
main/lp/scorm.class.php

@@ -217,8 +217,8 @@ class scorm extends learnpath
                     }
                 }
             }
-            unset($doc);
             // End parsing using PHP5 DOMXML methods.
+            unset($doc);
         } else {
             if ($this->debug > 1) {
                 error_log('New LP - Could not open/read file '.$file);

+ 1 - 1
main/webservices/http-auth.php

@@ -40,8 +40,8 @@ function getDigest()
 {
     // mod_php
     if (isset($_SERVER['PHP_AUTH_DIGEST'])) {
-        $digest = $_SERVER['PHP_AUTH_DIGEST'];
         // most other servers
+        $digest = $_SERVER['PHP_AUTH_DIGEST'];
     } elseif (isset($_SERVER['HTTP_AUTHENTICATION'])) {
         if (strpos(
                 strtolower($_SERVER['HTTP_AUTHENTICATION']),

+ 1 - 3
main/webservices/registration.soap.php

@@ -329,12 +329,10 @@ function WSCreateUsers($params)
                 $userManager->updateUser($user, true);
                 $results[] = $user_id;
                 continue;
-                //return $r_check_user[0];
             } else {
+                // user id already exits.
                 $results[] = 0;
                 continue;
-                //return 0;
-                // user id already exits.
             }
         }
 

+ 0 - 14
main/webservices/webservice_user.php

@@ -318,15 +318,6 @@ class WSUser extends WS
         );
         if (!$result) {
             return new WSError(104, 'There was an error creating the user');
-
-            /*$failure = $api_failureList[0];
-            if($failure == 'login-pass already taken') {
-                return new WSError(102, 'This username is already taken');
-            } else if($failure == 'encrypt_method invalid') {
-                return new WSError(103, 'The encryption of the password is invalid');
-            } else {
-                return new WSError(104, 'There was an error creating the user');
-            }*/
         } else {
             return $result;
         }
@@ -520,11 +511,6 @@ class WSUser extends WS
                 $encrypt_method
             );
             if (!$result) {
-                /*if($failure == 'encrypt_method invalid') {
-                    return new WSError(103, 'The encryption of the password is invalid');
-                } else {
-                    return new WSError(105, 'There was an error updating the user');
-                }*/
                 return new WSError(105, 'There was an error updating the user');
             } else {
                 return $result;

+ 1 - 1
main/work/work.lib.php

@@ -2031,8 +2031,8 @@ function get_work_user_list(
 
     if (!empty($work_data)) {
         if (!empty($group_id)) {
-            $extra_conditions = " work.post_group_id = '".intval($groupIid)."' ";
             // set to select only messages posted by the user's group
+            $extra_conditions = " work.post_group_id = '".intval($groupIid)."' ";
         } else {
             $extra_conditions = " (work.post_group_id = '0' OR work.post_group_id is NULL) ";
         }

+ 0 - 2
src/CoreBundle/Controller/Admin/AdminController.php

@@ -109,8 +109,6 @@ class AdminController extends BaseController
                 'url' => $adminUrl.'extra_fields.php?type=user',
                 'label' => get_lang('ManageUserFields'),
             ];
-            /*$items[] = array('url'=> api_get_path(WEB_PUBLIC_PATH)
-                .'admin/administrator/roles', 'label' => get_lang('Roles'));*/
         } else {
             $items = [
                 [

+ 2 - 2
src/CourseBundle/Component/CourseCopy/CourseBuilder.php

@@ -583,13 +583,13 @@ class CourseBuilder
                     true
                 );
             }
+            //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
             $sql = "SELECT * FROM $table_qui
                     WHERE c_id = $courseId AND active >=0 $session_condition";
-            //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
         } else {
+            //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
             $sql = "SELECT * FROM $table_qui
                     WHERE c_id = $courseId AND active >=0 AND (session_id = 0 OR session_id IS NULL)";
-            //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
         }
 
         $sql .= 'ORDER BY title';