Browse Source

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

jmontoyaa 8 years ago
parent
commit
5d9c7c7408

+ 2 - 2
main/admin/skill_create.php

@@ -92,7 +92,7 @@ $jquery_ready_content = $returnParams['jquery_ready_content'];
 if (!empty($jquery_ready_content)) {
     $htmlHeadXtra[] = '<script>
     $(document).ready(function(){
-        ' . $jquery_ready_content . '
+        ' . $jquery_ready_content.'
     });
     </script>';
 }
@@ -122,7 +122,7 @@ if ($createForm->validate()) {
         );
     }
 
-    header('Location: '.api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
+    header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_list.php');
     exit;
 }
 

+ 6 - 6
main/course_progress/thematic_advance.php

@@ -22,7 +22,7 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
     $form = new FormValidator(
         'thematic_advance',
         'POST',
-        api_get_self() . '?' . api_get_cidreq()
+        api_get_self().'?'.api_get_cidreq()
     );
     $form->addElement('header', $header_form);
     //$form->addElement('hidden', 'thematic_advance_token',$token);
@@ -191,7 +191,7 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
 
         $thematic = new Thematic();
         $thematic->set_thematic_advance_attributes(
-            isset($values['thematic_advance_id']) ? $values['thematic_advance_id']: null,
+            isset($values['thematic_advance_id']) ? $values['thematic_advance_id'] : null,
             $values['thematic_id'],
             $values['start_date_type'] == 1 && isset($values['attendance_select']) ? $values['attendance_select'] : 0,
             $values['content'],
@@ -210,13 +210,13 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
             }
         }
 
-        $redirectUrlParams = 'course_progress/index.php?' .  api_get_cidreq() . '&' .
+        $redirectUrlParams = 'course_progress/index.php?'.api_get_cidreq().'&'.
             http_build_query([
                 'action' => 'thematic_advance_list',
                 'thematic_id' => $values['thematic_id']
             ]);
 
-        header('Location: ' . api_get_path(WEB_CODE_PATH) . $redirectUrlParams);
+        header('Location: '.api_get_path(WEB_CODE_PATH).$redirectUrlParams);
         exit;
     }
 
@@ -226,10 +226,10 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
     // thematic advance list
     echo '<div class="actions">';
     echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_details">'.
-            Display::return_icon('back.png', get_lang("BackTo"),'',ICON_SIZE_MEDIUM).'</a>';
+            Display::return_icon('back.png', get_lang("BackTo"), '', ICON_SIZE_MEDIUM).'</a>';
     if (api_is_allowed_to_edit(false, true)) {
         echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_advance_add&amp;thematic_id='.$thematic_id.'"> '.
-            Display::return_icon('add.png', get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'</a>';
+            Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).'</a>';
     }
     echo '</div>';
     $table = new SortableTable(

+ 4 - 4
main/coursecopy/copy_course_session.php

@@ -85,7 +85,7 @@ function make_select_session_list($name, $sessions, $attr = array())
 
 function display_form()
 {
-    $html  = '';
+    $html = '';
     $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
 
     // Link back to the documents overview
@@ -109,7 +109,7 @@ function display_form()
 
     //destination
     $html .= '<div class="form-group">';
-    $html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>';
+    $html .= '<label class="col-sm-2 control-label">'.get_lang('DestinationCoursesFromSession').': </label>';
     $html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">';
     $html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
     $html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div>';
@@ -131,7 +131,7 @@ function display_form()
     $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;"><em class="fa fa-files-o"></em> '.get_lang('CopyCourse').'</button>';
 
     // Add Security token
-    $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">';
+    $html .= '<input type="hidden" value="'.Security::get_token().'" name="sec_token">';
     $html .= '</div></div>';
     $html .= '</form>';
 
@@ -227,7 +227,7 @@ $xajax->processRequests();
 
 /* HTML head extra */
 
-$htmlHeadXtra[] = $xajax->getJavascript( api_get_path(WEB_LIBRARY_PATH).'xajax/');
+$htmlHeadXtra[] = $xajax->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax/');
 $htmlHeadXtra[] = '<script>
 function checkSelected(id_select,id_radio,id_title,id_destination) {
    var num=0;

+ 5 - 5
main/document/downloadfolder.inc.php

@@ -52,7 +52,7 @@ if (empty($path)) {
 
 // A student should not be able to download a root shared directory
 if (($path == '/shared_folder' ||
-    $path == '/shared_folder_session_' . api_get_session_id()) &&
+    $path == '/shared_folder_session_'.api_get_session_id()) &&
     (!api_is_allowed_to_edit() || !api_is_platform_admin())
 ) {
     api_not_allowed(true);
@@ -150,7 +150,7 @@ if (api_is_allowed_to_edit()) {
                 (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND
                 docs.c_id = ".$courseId." ";
 
-    $sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
+    $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
 
     $result = Database::query($sql);
 
@@ -215,7 +215,7 @@ if (api_is_allowed_to_edit()) {
                 $groupCondition
             ";
 
-    $sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
+    $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
     $result = Database::query($sql);
 
     $files = array();
@@ -296,9 +296,9 @@ if (api_is_allowed_to_edit()) {
     // Add all files in our final array to the zipfile
     for ($i = 0; $i < count($files_for_zipfile); $i++) {
         $zip->add(
-            $sysCoursePath . $courseInfo['path'] . '/document' . $files_for_zipfile[$i],
+            $sysCoursePath.$courseInfo['path'].'/document'.$files_for_zipfile[$i],
             PCLZIP_OPT_REMOVE_PATH,
-            $sysCoursePath . $courseInfo['path'] . '/document' . $remove_dir,
+            $sysCoursePath.$courseInfo['path'].'/document'.$remove_dir,
             PCLZIP_CB_PRE_ADD,
             'fixDocumentNameCallback'
         );

+ 54 - 54
main/exercise/question.class.php

@@ -22,7 +22,7 @@ abstract class Question
     public $type;
     public $level;
     public $picture;
-    public $exerciseList;  // array with the list of exercises which this question is in
+    public $exerciseList; // array with the list of exercises which this question is in
     public $category_list;
     public $parent_id;
     public $category;
@@ -47,8 +47,8 @@ abstract class Question
             'multiple_answer_combination_true_false.class.php',
             'MultipleAnswerCombinationTrueFalse'
         ),
-        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'),
-        CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'),
+        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'),
+        CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'),
         UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
         DRAGGABLE => ['Draggable.php', 'Draggable'],
         MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'],
@@ -108,7 +108,7 @@ abstract class Question
         $id = intval($id);
 
         if (!empty($course_id)) {
-            $course_info =  api_get_course_info_by_id($course_id);
+            $course_info = api_get_course_info_by_id($course_id);
         } else {
             $course_info = api_get_course_info();
         }
@@ -360,7 +360,7 @@ abstract class Question
      */
     public function updateTitle($title)
     {
-        $this->question=$title;
+        $this->question = $title;
     }
 
     /**
@@ -459,7 +459,7 @@ abstract class Question
                     // DO nothing
                 } else {
                     $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id)
-                            VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)";
+                            VALUES (".api_get_course_int_id().", $question_id, $category_id)";
                     Database::query($sql);
                 }
             }
@@ -485,7 +485,7 @@ abstract class Question
             $sql = "SELECT count(*) AS nb FROM $table
                     WHERE
                         question_id = $question_id AND
-                        c_id=" . api_get_course_int_id();
+                        c_id=".api_get_course_int_id();
             $res = Database::query($sql);
             $row = Database::fetch_array($res);
             if ($row['nb'] > 0) {
@@ -493,11 +493,11 @@ abstract class Question
                         SET category_id = $category_id
                         WHERE
                             question_id = $question_id AND
-                            c_id = " . api_get_course_int_id();
+                            c_id = ".api_get_course_int_id();
                 Database::query($sql);
             } else {
                 $sql = "INSERT INTO $table (c_id, question_id, category_id)
-                        VALUES (" . api_get_course_int_id().", $question_id, $category_id)";
+                        VALUES (".api_get_course_int_id().", $question_id, $category_id)";
                 Database::query($sql);
             }
         }
@@ -515,7 +515,7 @@ abstract class Question
         $sql = "DELETE FROM $table
                 WHERE
                     question_id = $question_id AND
-                    c_id = " . api_get_course_int_id();
+                    c_id = ".api_get_course_int_id();
         Database::query($sql);
     }
 
@@ -568,11 +568,11 @@ abstract class Question
             ) {
                 // removes old answers
                 $sql = "DELETE FROM $TBL_REPONSES
-                        WHERE c_id = $course_id AND question_id = " . intval($this->id);
+                        WHERE c_id = $course_id AND question_id = ".intval($this->id);
                 Database::query($sql);
             }
 
-            $this->type=$type;
+            $this->type = $type;
         }
     }
 
@@ -687,7 +687,7 @@ abstract class Question
         // if the question has an ID
         if ($this->id) {
             // Get dimensions from current image.
-            $my_image = new Image($picturePath . '/' . $this->picture);
+            $my_image = new Image($picturePath.'/'.$this->picture);
 
             $current_image_size = $my_image->get_image_size();
             $current_width = $current_image_size['width'];
@@ -728,7 +728,7 @@ abstract class Question
             }
 
             $my_image->resize($new_width, $new_height);
-            $result = $my_image->send_image($picturePath . '/' . $this->picture);
+            $result = $my_image->send_image($picturePath.'/'.$this->picture);
 
             if ($result) {
                 return true;
@@ -753,7 +753,7 @@ abstract class Question
             $picture = $this->picture;
             $this->picture = '';
 
-            return @unlink($picturePath . '/' . $picture) ? true : false;
+            return @unlink($picturePath.'/'.$picture) ? true : false;
         }
 
         return false;
@@ -770,27 +770,27 @@ abstract class Question
     {
         $course_id = $course_info['real_id'];
         $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
-        $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images';
-        $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images';
+        $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images';
+        $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images';
 
         // if the question has got an ID and if the picture exists
         if ($this->id && !empty($this->picture)) {
             $picture = explode('.', $this->picture);
             $extension = $picture[sizeof($picture) - 1];
-            $picture = 'quiz-' . $questionId . '.' . $extension;
-            $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false;
+            $picture = 'quiz-'.$questionId.'.'.$extension;
+            $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false;
             // If copy was correct then add to the database
             if ($result) {
                 $sql = "UPDATE $TBL_QUESTIONS SET
-                        picture = '" . Database::escape_string($picture) . "'
-                        WHERE c_id = $course_id AND id='" . intval($questionId) . "'";
+                        picture = '".Database::escape_string($picture)."'
+                        WHERE c_id = $course_id AND id='".intval($questionId)."'";
                 Database::query($sql);
 
                 $document_id = add_document(
                     $course_info,
-                    '/images/' . $picture,
+                    '/images/'.$picture,
                     'file',
-                    filesize($destination_path . '/' . $picture),
+                    filesize($destination_path.'/'.$picture),
                     $picture
                 );
                 if ($document_id) {
@@ -825,7 +825,7 @@ abstract class Question
         $Extension = $pictureName[sizeof($pictureName) - 1];
 
         // saves the picture into a temporary file
-        @move_uploaded_file($picture, $picturePath . '/tmp.' . $Extension);
+        @move_uploaded_file($picture, $picturePath.'/tmp.'.$Extension);
     }
 
     /**
@@ -916,12 +916,12 @@ abstract class Question
                     $TBL_EXERCISE_QUESTION as test_question
                     WHERE
                         question.id = test_question.question_id AND
-                        test_question.exercice_id = " . intval($exerciseId) . " AND
+                        test_question.exercice_id = ".intval($exerciseId)." AND
                         question.c_id = $c_id AND
                         test_question.c_id = $c_id ";
             $result = Database::query($sql);
             $current_position = Database::result($result, 0, 0);
-            $this->updatePosition($current_position+1);
+            $this->updatePosition($current_position + 1);
             $position = $this->position;
 
             $params = [
@@ -1029,7 +1029,7 @@ abstract class Question
         $rmQs = false
     ) {
         // update search engine and its values table if enabled
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
             $course_id = api_get_course_id();
             // get search_did
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@@ -1047,8 +1047,8 @@ abstract class Question
             $res = Database::query($sql);
 
             if (Database::num_rows($res) > 0 || $addQs) {
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
 
                 $di = new ChamiloIndexer();
                 if ($addQs) {
@@ -1061,7 +1061,7 @@ abstract class Question
 
                 // retrieve others exercise ids
                 $se_ref = Database::fetch_array($res);
-                $se_doc = $di->get_document((int)$se_ref['search_did']);
+                $se_doc = $di->get_document((int) $se_ref['search_did']);
                 if ($se_doc !== false) {
                     if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) {
                         $se_doc_data = unserialize($se_doc_data);
@@ -1099,16 +1099,16 @@ abstract class Question
                     SE_DATA => array(
                         'type' => SE_DOCTYPE_EXERCISE_QUESTION,
                         'exercise_ids' => $question_exercises,
-                        'question_id' => (int)$this->id
+                        'question_id' => (int) $this->id
                     ),
-                    SE_USER => (int)api_get_user_id(),
+                    SE_USER => (int) api_get_user_id(),
                 );
                 $ic_slide->xapian_data = serialize($xapian_data);
                 $ic_slide->addValue("content", $this->description);
 
                 //TODO: index answers, see also form validation on question_admin.inc.php
 
-                $di->remove_document((int)$se_ref['search_did']);
+                $di->remove_document((int) $se_ref['search_did']);
                 $di->addChunk($ic_slide);
 
                 //index and return search engine document id
@@ -1187,7 +1187,7 @@ abstract class Question
             $count = $new_exercise->selectNbrQuestions();
             $count++;
             $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order)
-                    VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')";
+                    VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')";
             Database::query($sql);
 
             // we do not want to reindex if we had just saved adnd indexed the question
@@ -1224,17 +1224,17 @@ abstract class Question
                     FROM $TBL_EXERCISE_QUESTION
                     WHERE
                         c_id = $course_id
-                        AND question_id = " . intval($id) . "
+                        AND question_id = ".intval($id)."
                         AND exercice_id = " . intval($exerciseId);
             $res = Database::query($sql);
-            if (Database::num_rows($res)>0) {
+            if (Database::num_rows($res) > 0) {
                 $row = Database::fetch_array($res);
                 if (!empty($row['question_order'])) {
                     $sql = "UPDATE $TBL_EXERCISE_QUESTION
                         SET question_order = question_order-1
                         WHERE
                             c_id = $course_id
-                            AND exercice_id = " . intval($exerciseId) . "
+                            AND exercice_id = ".intval($exerciseId)."
                             AND question_order > " . $row['question_order'];
                     Database::query($sql);
                 }
@@ -1243,7 +1243,7 @@ abstract class Question
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
                     WHERE
                         c_id = $course_id
-                        AND question_id = " . intval($id) . "
+                        AND question_id = ".intval($id)."
                         AND exercice_id = " . intval($exerciseId);
             Database::query($sql);
 
@@ -1284,7 +1284,7 @@ abstract class Question
                                 SET question_order = question_order-1
                                 WHERE
                                     c_id= $course_id
-                                    AND exercice_id = " . intval($row['exercice_id']) . "
+                                    AND exercice_id = ".intval($row['exercice_id'])."
                                     AND question_order > " . $row['question_order'];
                         Database::query($sql);
                     }
@@ -1292,22 +1292,22 @@ abstract class Question
             }
 
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
-                    WHERE c_id = $course_id AND question_id = " . $id;
+                    WHERE c_id = $course_id AND question_id = ".$id;
             Database::query($sql);
 
             $sql = "DELETE FROM $TBL_QUESTIONS
-                    WHERE c_id = $course_id AND id = " . $id;
+                    WHERE c_id = $course_id AND id = ".$id;
             Database::query($sql);
 
             $sql = "DELETE FROM $TBL_REPONSES
-                    WHERE c_id = $course_id AND question_id = " . $id;
+                    WHERE c_id = $course_id AND question_id = ".$id;
             Database::query($sql);
 
             // remove the category of this question in the question_rel_category table
             $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY
                     WHERE 
                         c_id = $course_id AND 
-                        question_id = " . $id;
+                        question_id = ".$id;
             Database::query($sql);
 
             api_item_property_update(
@@ -1476,7 +1476,7 @@ abstract class Question
                 if (class_exists($class_name)) {
                     return new $class_name();
                 } else {
-                    echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type;
+                    echo 'Can\'t instanciate class '.$class_name.' of type '.$type;
                 }
             }
         }
@@ -1660,7 +1660,7 @@ abstract class Question
 
         if ($feedback_type == 1) {
             //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
-            $question_type_custom_list = array (
+            $question_type_custom_list = array(
                 UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER],
                 HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION]
             );
@@ -1676,14 +1676,14 @@ abstract class Question
             require_once $a_type[0];
             // get the picture of the type and the langvar which describes it
             $img = $explanation = '';
-            eval('$img = ' . $a_type[1] . '::$typePicture;');
-            eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);');
+            eval('$img = '.$a_type[1].'::$typePicture;');
+            eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
             echo '<li>';
             echo '<div class="icon-image">';
 
 
-            $icon = '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' .
-                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>';
+            $icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.
+                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
 
             if ($objExercise->force_edit_exercise_in_lp === false) {
                 if ($objExercise->exercise_was_added_in_lp == true) {
@@ -1704,9 +1704,9 @@ abstract class Question
             echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
         } else {
             if ($feedback_type == 1) {
-                echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">";
+                echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">";
             } else {
-                echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">';
+                echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">';
             }
             echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
         }
@@ -1839,7 +1839,7 @@ abstract class Question
             $header .= $this->show_media_content();
         }
 
-        $header .= Display::page_subheader2($counter_label . ". " . $question_title);
+        $header .= Display::page_subheader2($counter_label.". ".$question_title);
         $header .= Display::div(
             "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>",
             array('class' => 'ribbon')
@@ -1930,8 +1930,8 @@ abstract class Question
         require_once $tabQuestionList[$type][0];
 
         $img = $explanation = null;
-        eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
-        eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
+        eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;');
+        eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);');
         return array($img, $explanation);
     }
 

+ 18 - 18
main/inc/lib/glossary.lib.php

@@ -47,9 +47,9 @@ class GlossaryManager
      *
      * @return string The glossary description
      */
-    public static function get_glossary_term_by_glossary_id ($glossary_id)
+    public static function get_glossary_term_by_glossary_id($glossary_id)
     {
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
         $course_id = api_get_course_int_id();
         $sql = "SELECT description FROM $glossary_table
                 WHERE c_id = $course_id  AND glossary_id =".intval($glossary_id);
@@ -72,7 +72,7 @@ class GlossaryManager
      */
     public static function get_glossary_term_by_glossary_name($glossary_name)
     {
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
         $session_id = api_get_session_id();
         $course_id = api_get_course_int_id();
         $sql_filter = api_get_session_condition($session_id);
@@ -223,7 +223,7 @@ class GlossaryManager
         $get_max = "SELECT MAX(display_order) FROM $t_glossary
                     WHERE c_id = $course_id ";
         $res_max = Database::query($get_max);
-        if (Database::num_rows($res_max)==0) {
+        if (Database::num_rows($res_max) == 0) {
             return 0;
         }
         $row = Database::fetch_array($res_max);
@@ -252,7 +252,7 @@ class GlossaryManager
                 WHERE
                     c_id = $course_id AND
                     name = '".Database::escape_string($term)."'";
-        if ($not_id<>'') {
+        if ($not_id <> '') {
             $sql .= " AND glossary_id <> '".intval($not_id)."'";
         }
         $result = Database::query($sql);
@@ -375,25 +375,25 @@ class GlossaryManager
         $actionsLeft = '';
         if (api_is_allowed_to_edit(null, true)) {
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'.
-                Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
+                Display::return_icon('new_glossary_term.png', get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
         }
 
         $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export">'.
-            Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
+            Display::return_icon('export_csv.png', get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
         if (api_is_allowed_to_edit(null, true)) {
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=import">'.
-                Display::return_icon('import_csv.png',get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
+                Display::return_icon('import_csv.png', get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
         }
 
         $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'.
-            Display::return_icon('pdf.png',get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
+            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
 
         if (($view == 'table') || (!isset($view))) {
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
-                Display::return_icon('view_detailed.png',get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
+                Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
         } else {
             $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
-                Display::return_icon('view_text.png',get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
+                Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
         }
 
         /* BUILD SEARCH FORM */
@@ -430,7 +430,7 @@ class GlossaryManager
             $table->set_header(1, get_lang('TermDefinition'), true);
             if (api_is_allowed_to_edit(null, true)) {
                 $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions'));
-                $table->set_column_filter(2, array('GlossaryManager','actions_filter'));
+                $table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
             }
             $content .= $table->return_table();
         }
@@ -452,8 +452,8 @@ class GlossaryManager
         $content = '';
         foreach ($glossary_data as $key => $glossary_item) {
             $actions = '';
-            if (api_is_allowed_to_edit(null,true)) {
-                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '',$glossary_item).'</div>';
+            if (api_is_allowed_to_edit(null, true)) {
+                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
             }
             $content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions);
         }
@@ -466,7 +466,7 @@ class GlossaryManager
      * @return integer Count of glossary terms
      *
      */
-    public static function get_number_glossary_terms($session_id=0)
+    public static function get_number_glossary_terms($session_id = 0)
     {
         // Database table definition
         $t_glossary = Database::get_course_table(TABLE_GLOSSARY);
@@ -560,7 +560,7 @@ class GlossaryManager
         while ($data = Database::fetch_array($res)) {
             // Validation when belongs to a session
             $session_img = api_get_session_image($data['session_id'], $_user['status']);
-            $array[0] = $data[0] . $session_img;
+            $array[0] = $data[0].$session_img;
 
             if (!$view || $view === 'table') {
                 $array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
@@ -590,13 +590,13 @@ class GlossaryManager
     {
         $glossary_id = $row[2];
         $return = '<a href="'.api_get_self().'?action=edit_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.
-            Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
+            Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
         $glossary_data = self::get_glossary_information($glossary_id);
         $glossary_term = $glossary_data['name'];
         if (api_is_allowed_to_edit(null, true)) {
             if ($glossary_data['session_id'] == api_get_session_id()) {
                 $return .= '<a href="'.api_get_self().'?action=delete_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.
-                    Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
+                    Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a>';
             } else {
                 $return = get_lang('EditionNotAvailableFromSession');
             }

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

@@ -25,6 +25,7 @@ class Model
 
     /**
      * Useful finder - experimental akelos like only use in notification.lib.php send function
+     * @param string $type
      */
     public function find($type, $options = null)
     {

+ 13 - 13
main/inc/lib/skill.visualizer.lib.php

@@ -27,7 +27,7 @@ class SkillVisualizer
     {
         $this->skills   = $skills;
         $this->type     = $type;
-        $this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2);
+        $this->center_x = intval($offset_x + $this->canvas_x / 2 - $this->block_size / 2);
     }
 
     function prepare_skill_box($skill, $position, $class)
@@ -39,9 +39,9 @@ class SkillVisualizer
             $extra_class = 'second_window';
         }
 
-        $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.'  '.$class.'" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">';
+        $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.'  '.$class.'" style = "top:'.$position['y'].'px; left:'.$position['x'].'px;">';
 
-        $content =  $skill['name'];
+        $content = $skill['name'];
         $content .= '<div class="btn-group">';
         $content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
         $content .= Display::url('+', '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
@@ -87,9 +87,9 @@ class SkillVisualizer
         }
         //default_arrow_color
 
-        $this->js .= 'var e'.$block_id.' = prepare("block_' . $block_id.'",  '.$end_point.');'."\n";
-        $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_' . $skill['parent_id'].'",  '.$end_point.');'."\n";
-        $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n";;
+        $this->js .= 'var e'.$block_id.' = prepare("block_'.$block_id.'",  '.$end_point.');'."\n";
+        $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_'.$skill['parent_id'].'",  '.$end_point.');'."\n";
+        $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n"; ;
     }
 
     /**
@@ -125,10 +125,10 @@ class SkillVisualizer
         $brothers = array();
 
         foreach ($this->skills as &$skill) {
-            if (!in_array($skill['parent_id'], array(0,1))) {
+            if (!in_array($skill['parent_id'], array(0, 1))) {
                 continue;
             }
-            $childs = isset($skill['children']) ? count($skill['children']) : 0 ;
+            $childs = isset($skill['children']) ? count($skill['children']) : 0;
 
             //$x = round($this->offsetX * sin(deg2rad($corner * $count)));
             //$y = round($this->offsetY * cos(deg2rad($corner * $count)));
@@ -144,10 +144,10 @@ class SkillVisualizer
             if ($skill['parent_id'] == 0) {
                 //$x = 130*$childs/2;
                 //$x = $this->space_between_blocks_x*$childs/2;
-                $x = $this->canvas_x/2  - $this->block_size/2;
+                $x = $this->canvas_x / 2 - $this->block_size / 2;
             } else {
                 $max = isset($this->skills[$skill['parent_id']]['children']) ? count($this->skills[$skill['parent_id']]['children']) : 0;
-                foreach($this->skills[$skill['parent_id']]['children'] as  $id => $sk) {
+                foreach ($this->skills[$skill['parent_id']]['children'] as  $id => $sk) {
                     if ($skill['id'] == $sk['id']) {
                         break;
                     }
@@ -155,17 +155,17 @@ class SkillVisualizer
                 }
                 $parent_x = isset($this->skills[$skill['parent_id']]['x']) ? $this->skills[$skill['parent_id']]['x'] : 0;
                 //$x = $my_count*$this->space_between_blocks_x + $parent_x  + $this->block_size - ($this->space_between_blocks_x*$max/2) ;
-                $x = $my_count*$this->space_between_blocks_x + $parent_x  + $this->block_size - ($this->canvas_x/2 ) ;
+                $x = $my_count * $this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x / 2);
             }
 
-            $y = $skill['level']*$this->space_between_blocks_y;
+            $y = $skill['level'] * $this->space_between_blocks_y;
 
             $skill['x'] = $x;
             $skill['y'] = $y;
 
             //$skill['description']  = "{$brothers[$skill['parent_id']]} $x - $y";
             //$skill['name']  =  $skill['name']."  |  $x = $my_count * 150  +  $parent_x - (150* $max/2) - 10*$childs ";
-            $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y +$y));
+            $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y + $y));
         }
         return $this->get_html();
     }

+ 14 - 14
main/session/add_courses_to_session.php

@@ -23,7 +23,7 @@ $xajax->registerFunction(array('search_courses', 'AddCourseToSession', 'search_c
 $this_section = SECTION_PLATFORM_ADMIN;
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
 $interbreadcrumb[] = array(
     'url' => "resume_session.php?id_session=".$sessionId,
     'name' => get_lang('SessionOverview')
@@ -37,7 +37,7 @@ $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
 // setting the name of the tool
-$tool_name= get_lang('SubscribeCoursesToSession');
+$tool_name = get_lang('SubscribeCoursesToSession');
 
 $add_type = 'multiple';
 if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
@@ -130,7 +130,7 @@ if ($ajax_search) {
             ON
                 course.id = session_rel_course.c_id AND
                 session_rel_course.session_id = ".$sessionId."
-			ORDER BY ".(sizeof($courses)?"(code IN(".implode(',', $courses).")) DESC,":"")." title";
+			ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
 
     if (api_is_multiple_url_enabled()) {
         $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -144,7 +144,7 @@ if ($ajax_search) {
                         INNER JOIN $tbl_course_rel_access_url url_course
                         ON (url_course.c_id = course.id)
                     WHERE access_url_id = $access_url_id
-                    ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
+                    ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
         }
     }
 
@@ -160,7 +160,7 @@ if ($ajax_search) {
             ON
                 course.id = session_rel_course.c_id AND
                 session_rel_course.session_id = ".$sessionId."
-			ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
+			ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
 
     if (api_is_multiple_url_enabled()) {
         $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -175,16 +175,16 @@ if ($ajax_search) {
                     INNER JOIN $tbl_course_rel_access_url url_course
                     ON (url_course.c_id = course.id)
                     WHERE access_url_id = $access_url_id
-                    ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
+                    ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
         }
     }
     $result = Database::query($sql);
     $Courses = Database::store_result($result);
     foreach ($Courses as $course) {
         if ($course['session_id'] == $sessionId) {
-            $sessionCourses[$course['id']] = $course ;
+            $sessionCourses[$course['id']] = $course;
         } else {
-            $nosessionCourses[$course['id']] = $course ;
+            $nosessionCourses[$course['id']] = $course;
         }
     }
 }
@@ -206,7 +206,7 @@ if (!api_is_platform_admin() && api_is_teacher()) {
 
 unset($Courses);
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
     <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend>
     <input type="hidden" name="formSent" value="1" />
 
@@ -229,7 +229,7 @@ unset($Courses);
                 <div id="ajax_list_courses_multiple">
                     <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
                         <?php foreach ($nosessionCourses as $enreg) { ?>
-                            <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>>
+                            <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES).'"'; if (in_array($enreg['code'], $CourseList)) echo 'selected="selected"'; ?>>
                                 <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
                             </option>
                         <?php } ?>
@@ -241,7 +241,7 @@ unset($Courses);
             ?>
         </div>
         <div class="col-md-4">
-            <?php if($add_type == 'multiple') { ?>
+            <?php if ($add_type == 'multiple') { ?>
                 <div class="code-course">
                     <?php echo get_lang('FirstLetterCourse'); ?> :
 
@@ -249,7 +249,7 @@ unset($Courses);
                         <option value="%">--</option>
                         <?php
                         echo Display :: get_alphabet_options();
-                        echo Display :: get_numeric_options(0,9,'');
+                        echo Display :: get_numeric_options(0, 9, '');
                         ?>
                     </select>
                 </div>
@@ -299,9 +299,9 @@ unset($Courses);
             <select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" class="form-control">
 
                 <?php
-                foreach($sessionCourses as $enreg) {
+                foreach ($sessionCourses as $enreg) {
                     ?>
-                    <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>">
+                    <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES); ?>">
                         <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
                     </option>
                 <?php

+ 1 - 1
src/Chamilo/CourseBundle/Component/CourseCopy/Course.php

@@ -67,7 +67,7 @@ class Course
      * @param int $resource_type Check if this course has resources of the
      * given type. If no type is given, check if course has resources of any
      * type.
-     * @return int
+     * @return boolean
      */
     public function has_resources($resource_type = null)
     {

+ 1 - 1
src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php

@@ -549,7 +549,7 @@ class CourseRecycler
                     if (trim($learnpath->path) != '') {
                         // when $learnpath->path value is incorrect for some reason.
                         // The directory trat contains files of the SCORM package is to be deleted.
-                        $scorm_package_dir = realpath($this->course->path . 'scorm/' . $learnpath->path);
+                        $scorm_package_dir = realpath($this->course->path.'scorm/'.$learnpath->path);
                         rmdirr($scorm_package_dir);
                     }
                 }

+ 1 - 1
src/Chamilo/CourseBundle/Entity/CToolIntro.php

@@ -94,7 +94,7 @@ class CToolIntro
     /**
      * Get id
      *
-     * @return string
+     * @return integer
      */
     public function getId()
     {