Browse Source

Minor - format code.

Julio Montoya 10 years ago
parent
commit
7a8b001c77

+ 16 - 6
main/gradebook/lib/be/abstractlink.class.php

@@ -106,7 +106,10 @@ abstract class AbstractLink implements GradebookItem
         $this->user_id = $user_id;
     }
 
-    public function set_course_code ($course_code)
+    /**
+     * @param string $course_code
+     */
+    public function set_course_code($course_code)
     {
         $this->course_code = $course_code;
         $course_info = api_get_course_info($course_code);
@@ -263,8 +266,15 @@ abstract class AbstractLink implements GradebookItem
     public function add()
     {
         $this->add_linked_data();
-        if (isset($this->type) && isset($this->ref_id) && isset($this->user_id) && isset($this->course_code) && isset($this->category) && isset($this->weight) && isset($this->visible)) {
-            $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
+        if (isset($this->type) &&
+            isset($this->ref_id) &&
+            isset($this->user_id) &&
+            isset($this->course_code) &&
+            isset($this->category) &&
+            isset($this->weight) &&
+            isset($this->visible)
+        ) {
+            $tbl_grade_links = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
             $sql = "SELECT count(*) FROM ".$tbl_grade_links."
                     WHERE
                         ref_id=".$this->get_ref_id()." AND
@@ -275,7 +285,7 @@ abstract class AbstractLink implements GradebookItem
             $result = Database::query($sql);
             $row_testing = Database::fetch_array($result);
 
-            if ($row_testing[0]==0) {
+            if ($row_testing[0] == 0) {
                 $sql = 'INSERT INTO '.$tbl_grade_links.' (type, ref_id, user_id, course_code, category_id, weight, visible, created_at) VALUES ('
                     .intval($this->get_type())
                     .','.intval($this->get_ref_id())
@@ -501,14 +511,14 @@ abstract class AbstractLink implements GradebookItem
     {
     }
 
-    public function get_view_url ($stud_id)
+    public function get_view_url($stud_id)
     {
         return null;
     }
 
     /**
      * Locks a link
-     * @param int locked 1 or unlocked 0
+     * @param int $locked 1 or unlocked 0
      *
      * */
     public function lock($locked)

+ 3 - 0
main/gradebook/lib/be/category.class.php

@@ -58,6 +58,9 @@ class Category implements GradebookItem
         }
     }
 
+    /**
+     * @return string
+     */
     public function get_course_code()
     {
         return $this->course_code;

+ 25 - 7
main/gradebook/lib/fe/linkform.class.php

@@ -17,7 +17,7 @@ class LinkForm extends FormValidator
 {
 	const TYPE_CREATE = 1;
 	const TYPE_MOVE = 2;
-
+	/** @var Category */
 	private $category_object;
 	private $link_object;
 	private $extra;
@@ -30,15 +30,25 @@ class LinkForm extends FormValidator
 	 * @param method
 	 * @param action
 	 */
-	function LinkForm($form_type, $category_object,$link_object, $form_name, $method = 'post', $action = null, $extra = null)
-	{
+	public function LinkForm(
+		$form_type,
+		$category_object,
+		$link_object,
+		$form_name,
+		$method = 'post',
+		$action = null,
+		$extra = null
+	) {
 		parent :: __construct($form_name, $method, $action);
 
 		if (isset ($category_object)) {
 			$this->category_object = $category_object;
-		} if (isset ($link_object)) {
-			$this->link_object = $link_object;
+		} else {
+			if (isset($link_object)) {
+				$this->link_object = $link_object;
+			}
 		}
+
 		if (isset ($extra)) {
 			$this->extra = $extra;
 		}
@@ -47,7 +57,6 @@ class LinkForm extends FormValidator
 		} elseif ($form_type == self :: TYPE_MOVE) {
 			$this->build_move();
 		}
-		//$this->setDefaults();
 	}
 
 	protected function build_move()
@@ -68,10 +77,19 @@ class LinkForm extends FormValidator
 		$this->addElement('submit', null, get_lang('Ok'));
 	}
 
+	/**
+	 * Builds the form
+	 */
 	protected function build_create()
 	{
 		$this->addElement('header', get_lang('MakeLink'));
-		$select = $this->addElement('select', 'select_link', get_lang('ChooseLink'), null, array('onchange' => 'document.create_link.submit()'));
+		$select = $this->addElement(
+			'select',
+			'select_link',
+			get_lang('ChooseLink'),
+			null,
+			array('onchange' => 'document.create_link.submit()')
+		);
 
 		$linkTypes = LinkFactory::get_all_types();
 

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm.php

@@ -644,7 +644,7 @@ class HTML_QuickForm extends HTML_Common
      *
      * @param    mixed      $element        element object or type of element to add (text, textarea, file...)
      * @since    1.0
-     * @return   HTML_QuickForm_Element     a reference to newly added element
+     * @return   HTML_QuickForm_element     a reference to newly added element
      * @access   public
      * @throws   HTML_QuickForm_Error
      */