浏览代码

Minor - format code

Julio Montoya 5 年之前
父节点
当前提交
3031de6c4a
共有 2 个文件被更改,包括 80 次插入81 次删除
  1. 78 79
      main/lp/learnpath.class.php
  2. 2 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Course.php

+ 78 - 79
main/lp/learnpath.class.php

@@ -3620,11 +3620,10 @@ class learnpath
 
     /**
      * @return string
-     *
      */
     public function getNameNoTags()
     {
-       return strip_tags($this->get_name());
+        return strip_tags($this->get_name());
     }
 
     /**
@@ -13862,6 +13861,83 @@ EOD;
         return Display::img($path);
     }
 
+    /**
+     * @param string $value
+     *
+     * @return string
+     */
+    public function cleanItemTitle($value)
+    {
+        $value = Security::remove_XSS(strip_tags($value));
+
+        return $value;
+    }
+
+    /**
+     * @param FormValidator $form
+     */
+    public function setItemTitle(FormValidator $form)
+    {
+        if (api_get_configuration_value('save_titles_as_html')) {
+            $form->addHtmlEditor(
+                'title',
+                get_lang('Title'),
+                true,
+                false,
+                ['ToolbarSet' => 'Minimal', 'Height' => '100']
+            );
+        } else {
+            $form->addText('title', get_lang('Title'), true, ['id' => 'idTitle', 'class' => 'learnpath_item_form']);
+            $form->applyFilter('title', 'html_filter');
+
+            $form->applyFilter('title', 'trim');
+            $form->applyFilter('title', 'html_filter');
+        }
+    }
+
+    /**
+     * @return array
+     */
+    public function getItemsForForm($addParentCondition = false)
+    {
+        $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
+        $course_id = api_get_course_int_id();
+
+        $sql = "SELECT * FROM $tbl_lp_item 
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
+
+        if ($addParentCondition) {
+            $sql .= ' AND parent_item_id = 0 ';
+        }
+        $sql .= ' ORDER BY display_order ASC';
+
+        $result = Database::query($sql);
+        $arrLP = [];
+        while ($row = Database::fetch_array($result)) {
+            $arrLP[] = [
+                'iid' => $row['iid'],
+                'id' => $row['iid'],
+                'item_type' => $row['item_type'],
+                'title' => $this->cleanItemTitle($row['title']),
+                'path' => $row['path'],
+                'description' => Security::remove_XSS($row['description']),
+                'parent_item_id' => $row['parent_item_id'],
+                'previous_item_id' => $row['previous_item_id'],
+                'next_item_id' => $row['next_item_id'],
+                'display_order' => $row['display_order'],
+                'max_score' => $row['max_score'],
+                'min_score' => $row['min_score'],
+                'mastery_score' => $row['mastery_score'],
+                'prerequisite' => $row['prerequisite'],
+                'max_time_allowed' => $row['max_time_allowed'],
+                'prerequisite_min_score' => $row['prerequisite_min_score'],
+                'prerequisite_max_score' => $row['prerequisite_max_score'],
+            ];
+        }
+
+        return $arrLP;
+    }
+
     /**
      * Get the depth level of LP item.
      *
@@ -13966,81 +14042,4 @@ EOD;
 
         return '';
     }
-
-    /**
-     * @param string $value
-     *
-     * @return string
-     */
-    public function cleanItemTitle($value)
-    {
-        $value = Security::remove_XSS(strip_tags($value));
-
-        return $value;
-    }
-
-    /**
-     * @param FormValidator $form
-     */
-    public function setItemTitle(FormValidator $form)
-    {
-        if (api_get_configuration_value('save_titles_as_html')) {
-            $form->addHtmlEditor(
-                'title',
-                get_lang('Title'),
-                true,
-                false,
-                ['ToolbarSet' => 'Minimal', 'Height' => '100']
-            );
-        } else {
-            $form->addText('title', get_lang('Title'), true, ['id' => 'idTitle', 'class' => 'learnpath_item_form']);
-            $form->applyFilter('title', 'html_filter');
-
-            $form->applyFilter('title', 'trim');
-            $form->applyFilter('title', 'html_filter');
-        }
-    }
-
-    /**
-     * @return array
-     */
-    public function getItemsForForm($addParentCondition = false)
-    {
-        $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
-        $course_id = api_get_course_int_id();
-
-        $sql = "SELECT * FROM $tbl_lp_item 
-                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
-
-        if ($addParentCondition) {
-            $sql .= ' AND parent_item_id = 0 ';
-        }
-        $sql .= ' ORDER BY display_order ASC';
-
-        $result = Database::query($sql);
-        $arrLP = [];
-        while ($row = Database::fetch_array($result)) {
-            $arrLP[] = [
-                'iid' => $row['iid'],
-                'id' => $row['iid'],
-                'item_type' => $row['item_type'],
-                'title' => $this->cleanItemTitle($row['title']),
-                'path' => $row['path'],
-                'description' => Security::remove_XSS($row['description']),
-                'parent_item_id' => $row['parent_item_id'],
-                'previous_item_id' => $row['previous_item_id'],
-                'next_item_id' => $row['next_item_id'],
-                'display_order' => $row['display_order'],
-                'max_score' => $row['max_score'],
-                'min_score' => $row['min_score'],
-                'mastery_score' => $row['mastery_score'],
-                'prerequisite' => $row['prerequisite'],
-                'max_time_allowed' => $row['max_time_allowed'],
-                'prerequisite_min_score' => $row['prerequisite_min_score'],
-                'prerequisite_max_score' => $row['prerequisite_max_score'],
-            ];
-        }
-
-        return $arrLP;
-    }
 }

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

@@ -71,8 +71,8 @@ class Course
      * Does this course has resources?
      *
      * @param int $type Check if this course has resources of the
-     *                           given type. If no type is given, check if course has resources of any
-     *                           type.
+     *                  given type. If no type is given, check if course has resources of any
+     *                  type.
      *
      * @return bool
      */