Pārlūkot izejas kodu

Minor - format code.

Julio Montoya 9 gadi atpakaļ
vecāks
revīzija
f8c9fc2b23

+ 4 - 12
main/course_description/course_description_controller.php

@@ -81,11 +81,7 @@ class CourseDescriptionController
                 $check = Security::check_token();
                 if ($check) {
                     $title = $_POST['title'];
-                    if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-                        $content = WCAG_Rendering::prepareXHTML();
-                    } else {
-                        $content = $_POST['contentDescription'];
-                    }
+                    $content = $_POST['contentDescription'];
                     $description_type = $_POST['description_type'];
                     $id = $_POST['id'];
                     $progress = isset($_POST['progress']) ? $_POST['progress'] : '';
@@ -140,7 +136,7 @@ class CourseDescriptionController
                 if (isset($_GET['id_session'])) {
                     $session_id = intval($_GET['id_session']);
                 }
-		$course_description_data = $course_description->get_data_by_id(
+		        $course_description_data = $course_description->get_data_by_id(
                     $id,
                     null,
                     $session_id
@@ -149,7 +145,7 @@ class CourseDescriptionController
                 $data['description_title'] = $course_description_data['description_title'];
                 $data['description_content'] = $course_description_data['description_content'];
                 $data['progress'] = $course_description_data['progress'];
-		$data['descriptions'] = $course_description->get_data_by_description_type(
+		        $data['descriptions'] = $course_description->get_data_by_description_type(
                     $description_type,
                     null,
                     $session_id
@@ -181,11 +177,7 @@ class CourseDescriptionController
                 $check = Security::check_token();
                 if ($check) {
                     $title = $_POST['title'];
-                    if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
-                        $content = WCAG_Rendering::prepareXHTML();
-                    } else {
-                        $content = $_POST['contentDescription'];
-                    }
+                    $content = $_POST['contentDescription'];
                     $description_type = $_POST['description_type'];
                     if ($description_type >= ADD_BLOCK) {
                         $course_description->set_description_type($description_type);

+ 23 - 50
main/inc/lib/course_description.lib.php

@@ -9,7 +9,8 @@
  */
 
 /**
- * Class CourseDescription Lanage course descriptions
+ * Class CourseDescription course descriptions
+ *
  * @package chamilo.course_description
  */
 class CourseDescription
@@ -34,7 +35,8 @@ class CourseDescription
      * Returns an array of objects of type CourseDescription corresponding to
      * a specific course, without session ids (session id = 0)
      *
-     * @param int Course id
+     * @param int $course_id
+     *
      * @return array Array of CourseDescriptions
      */
     public static function get_descriptions($course_id)
@@ -61,6 +63,7 @@ class CourseDescription
             $desc_tmp->set_progress($row['progress']);
             $results[] = $desc_tmp;
         }
+
         return $results;
     }
 
@@ -82,9 +85,8 @@ class CourseDescription
         $data = array();
         while ($description = Database::fetch_array($rs)) {
             $data['descriptions'][$description['id']] = Security::remove_XSS($description, STUDENT);
-            //reload titles to ensure we have the last version (after edition)
-            //$data['default_description_titles'][$description['id']] = Security::remove_XSS($description['title'], STUDENT);
         }
+
         return $data;
     }
 
@@ -122,6 +124,7 @@ class CourseDescription
             $data['description_content'] = $description['content'];
             $data['progress'] = $description['progress'];
         }
+
         return $data;
     }
 
@@ -129,6 +132,7 @@ class CourseDescription
      * @param int $id
      * @param string $course_code
      * @param int $session_id
+     *
      * @return array
      */
     public function get_data_by_id($id, $course_code = '', $session_id = null)
@@ -170,7 +174,8 @@ class CourseDescription
         $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
         $course_id = api_get_course_int_id();
 
-        $sql = "SELECT MAX(description_type) as MAX FROM $tbl_course_description
+        $sql = "SELECT MAX(description_type) as MAX
+                FROM $tbl_course_description
 		        WHERE c_id = $course_id AND session_id='" . $this->session_id . "'";
         $rs = Database::query($sql);
         $max = Database::fetch_array($rs);
@@ -178,6 +183,7 @@ class CourseDescription
         if ($description_type < ADD_BLOCK) {
             $description_type = ADD_BLOCK;
         }
+
         return $description_type;
     }
 
@@ -194,8 +200,8 @@ class CourseDescription
         } else {
             $course_id = $this->course_id;
         }
-        $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
-        $sql = "INSERT IGNORE INTO $tbl_course_description SET
+        $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
+        $sql = "INSERT IGNORE INTO $table SET
 				c_id 				=  $course_id,
 				description_type	= '" . intval($this->description_type) . "',
 				title 				= '" . Database::escape_string($this->title) . "',
@@ -205,11 +211,12 @@ class CourseDescription
         $result = Database::query($sql);
         $last_id = Database::insert_id();
         $affected_rows = Database::affected_rows($result);
+
         if ($last_id > 0) {
-            $sql = "UPDATE $tbl_course_description SET id = iid WHERE iid = $last_id";
+            $sql = "UPDATE $table SET id = iid WHERE iid = $last_id";
             Database::query($sql);
 
-            //insert into item_property
+            // insert into item_property
             api_item_property_update(
                 api_get_course_info(),
                 TOOL_COURSE_DESCRIPTION,
@@ -235,8 +242,11 @@ class CourseDescription
         $description_id = $this->get_id_by_description_type($description_type);
         $course_id = api_get_real_course_id();
         $course_code = api_get_course_id();
-        $item_property_id = api_get_item_property_id($course_code,
-            TOOL_COURSE_DESCRIPTION, $description_id);
+        $item_property_id = api_get_item_property_id(
+            $course_code,
+            TOOL_COURSE_DESCRIPTION,
+            $description_id
+        );
         $sql = "INSERT IGNORE INTO $tbl_stats_item_property SET
 				c_id				= " . api_get_course_int_id() . ",
 				course_id 			= '$course_id',
@@ -244,7 +254,7 @@ class CourseDescription
 			 	title 				= '" . Database::escape_string($this->title) . "',
 			 	content 			= '" . Database::escape_string($this->content) . "',
 			 	progress 			= '" . intval($this->progress) . "',
-			 	lastedit_date 		= '" . date('Y-m-d H:i:s') . "',
+			 	lastedit_date 		= '" . api_get_utc_datetime(). "',
 			 	lastedit_user_id 	= '" . api_get_user_id() . "',
 			 	session_id			= '" . intval($this->session_id) . "'";
         $result = Database::query($sql);
@@ -282,6 +292,7 @@ class CourseDescription
                 api_get_user_id()
             );
         }
+
         return $affected_rows;
     }
 
@@ -333,44 +344,6 @@ class CourseDescription
         return $description_id;
     }
 
-    /**
-     * get thematic progress in porcent for a course,
-     * first you must set session_id property with the object CourseDescription
-     * @param bool        true for showing a icon about the progress, false otherwise (optional)
-     * @param int        Description type (optional)
-     * @return string   img html
-     */
-    public function get_progress_porcent(
-        $with_icon = false,
-        $description_type = THEMATIC_ADVANCE
-    ) {
-        $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
-        $session_id = api_get_session_id();
-        $course_id = api_get_course_int_id();
-
-        $sql = "SELECT progress FROM $tbl_course_description
-		        WHERE
-		            c_id = $course_id AND
-		            description_type = '" . intval($description_type) . "' AND
-		            session_id = '" . intval($this->session_id) . "' ";
-        $rs = Database::query($sql);
-        $progress = '';
-        $img = '';
-        $title = '0%';
-        $image = 'level_0.png';
-        if (Database::num_rows($rs) > 0) {
-            $row = Database::fetch_array($rs);
-            $progress = $row['progress'] . '%';
-            $image = 'level_' . $row['progress'] . '.png';
-        }
-        if ($with_icon) {
-            $img = Display::return_icon($image, get_lang('ThematicAdvance'),
-                array('style' => 'vertical-align:middle'));
-        }
-        $progress = $img . $progress;
-        return $progress;
-    }
-
     /**
      * Get description titles by default
      * @return array