diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index dbbb81ae01..84e7ec4676 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -330,8 +330,8 @@ class Category implements GradebookItem return $cats; } - $courseCode = api_get_course_info_by_id(api_get_course_int_id()); - $courseCode = $courseCode['code']; + $courseInfo = api_get_course_info_by_id(api_get_course_int_id()); + $courseCode = $courseInfo['code']; $session_id = intval($session_id); if (!empty($session_id)) { @@ -357,13 +357,13 @@ class Category implements GradebookItem /** * Retrieve categories and return them as an array of Category objects - * @param int $id category id - * @param int $user_id (category owner) - * @param string $course_code - * @param int $parent_id parent category - * @param bool $visible - * @param int $session_id (in case we are in a session) - * @param bool $order_by Whether to show all "session" + * @param int $id category id + * @param int $user_id (category owner) + * @param string $course_code + * @param int $parent_id parent category + * @param bool $visible + * @param int $session_id (in case we are in a session) + * @param bool $order_by Whether to show all "session" * categories (true) or hide them (false) in case there is no session id */ public static function load( @@ -582,7 +582,6 @@ class Category implements GradebookItem $this->set_id($id); if (!empty($id)) { - $parent_id = $this->get_parent_id(); $grade_model_id = $this->get_grade_model_id(); if ($parent_id == 0) { @@ -614,7 +613,10 @@ class Category implements GradebookItem } $gradebook= new Gradebook(); - $gradebook->update_skills_to_gradebook($this->id, $this->get_skills(false)); + $gradebook->update_skills_to_gradebook( + $this->id, + $this->get_skills(false) + ); return $id; } @@ -657,7 +659,6 @@ class Category implements GradebookItem $parent_id = $this->get_parent_id(); $grade_model_id = $this->get_grade_model_id(); if ($parent_id == 0) { - if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { $obj = new GradeModel(); $components = $obj->get_components($grade_model_id); @@ -673,15 +674,13 @@ class Category implements GradebookItem foreach ($components as $component) { $gradebook = new Gradebook(); $params = array(); - - $params['name'] = $component['acronym']; - $params['description'] = $component['title']; - $params['user_id'] = api_get_user_id(); - $params['parent_id'] = $this->id; - $params['weight'] = $component['percentage']/100*$default_weight; - $params['session_id'] = api_get_session_id(); - $params['course_code'] = $this->get_course_code(); - + $params['name'] = $component['acronym']; + $params['description'] = $component['title']; + $params['user_id'] = api_get_user_id(); + $params['parent_id'] = $this->id; + $params['weight'] = $component['percentage'] / 100 * $default_weight; + $params['session_id'] = api_get_session_id(); + $params['course_code'] = $this->get_course_code(); $gradebook->save($params); } } @@ -732,7 +731,8 @@ class Category implements GradebookItem public function update_category_delete($course_id) { $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); - $sql = 'UPDATE '.$tbl_grade_categories.' SET visible=3 + $sql = 'UPDATE '.$tbl_grade_categories.' SET + visible = 3 WHERE course_code ="'.Database::escape_string($course_id).'"'; Database::query($sql); } @@ -743,13 +743,14 @@ class Category implements GradebookItem public function show_message_resource_delete($course_id) { $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); - $sql = 'SELECT count(*) AS num from '.$tbl_grade_categories.' + $sql = 'SELECT count(*) AS num + FROM '.$tbl_grade_categories.' WHERE course_code = "'.Database::escape_string($course_id).'" AND - visible=3'; + visible = 3'; $res = Database::query($sql); $option = Database::fetch_array($res, 'ASSOC'); - if ($option['num']>=1) { + if ($option['num'] >= 1) { return '  ( '.get_lang('ResourceDeleted').' )'; } else { return false; @@ -782,7 +783,7 @@ class Category implements GradebookItem */ public function does_name_exist($name, $parent) { - if (!isset ($name)) { + if (!isset($name)) { $name = $this->name; $parent = $this->parent; } @@ -805,11 +806,11 @@ class Category implements GradebookItem } else { $sql .= ' AND user_id = '.api_get_user_id(); } - } else { $sql .= ' AND user_id = '.api_get_user_id(); } - if (!isset ($parent)) { + + if (!isset($parent)) { $sql.= ' AND parent_id is null'; } else { $sql.= ' AND parent_id = '.intval($parent); @@ -1183,7 +1184,7 @@ class Category implements GradebookItem cu.status = '.COURSEMANAGER.' )'; } - }elseif (api_is_platform_admin()) { + } elseif (api_is_platform_admin()) { if (isset($session_id) && $session_id!=0) { $sql.=' AND session_id='.intval($session_id); } else { @@ -1195,7 +1196,11 @@ class Category implements GradebookItem // course independent categories if (empty($course_code)) { - $cats = Category::get_independent_categories_with_result_for_student (0, $stud_id, $cats); + $cats = Category::get_independent_categories_with_result_for_student( + 0, + $stud_id, + $cats + ); } return $cats; @@ -1241,7 +1246,14 @@ class Category implements GradebookItem $cats = Category::create_category_objects_from_sql_result($result); // course independent categories if (isset($course_code)) { - $indcats = Category::load(null,$user_id,$course_code,0,null,$session_id); + $indcats = Category::load( + null, + $user_id, + $course_code, + 0, + null, + $session_id + ); $cats = array_merge($cats, $indcats); } diff --git a/main/gradebook/lib/be/studentpublicationlink.class.php b/main/gradebook/lib/be/studentpublicationlink.class.php index efe06da6b5..8ea4e0e6d2 100755 --- a/main/gradebook/lib/be/studentpublicationlink.class.php +++ b/main/gradebook/lib/be/studentpublicationlink.class.php @@ -433,10 +433,12 @@ class StudentPublicationLink extends AbstractLink } } + /** + * @return string + */ public function delete_linked_data() { $data = $this->get_exercise_data(); - if (empty($data)) { return ''; } @@ -444,7 +446,7 @@ class StudentPublicationLink extends AbstractLink if (!empty($id)) { //Cleans works $sql = 'UPDATE '.$this->get_studpub_table().' - SET weight=0 + SET weight = 0 WHERE c_id = '.$this->course_id.' AND id ='.$id; Database::query($sql); } diff --git a/main/inc/lib/pear/HTML/QuickForm/Rule/Regex.php b/main/inc/lib/pear/HTML/QuickForm/Rule/Regex.php index 233ff36b7b..7b70070ecf 100755 --- a/main/inc/lib/pear/HTML/QuickForm/Rule/Regex.php +++ b/main/inc/lib/pear/HTML/QuickForm/Rule/Regex.php @@ -84,7 +84,6 @@ class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule $this->_data[$name] = $pattern; } // end func addData - function getValidationScript($options = null) { $regex = isset($this->_data[$this->name]) ? $this->_data[$this->name] : $options; @@ -96,6 +95,5 @@ class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule } return array(" var regex = " . $regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})"); - } // end func getValidationScript - -} \ No newline at end of file + } +} diff --git a/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php b/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php index 9432d9c425..c35c9d58da 100755 --- a/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php +++ b/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php @@ -43,7 +43,6 @@ class HTML_QuickForm_RuleRegistry */ var $_rules = array(); - /** * Returns a singleton of HTML_QuickForm_RuleRegistry * @@ -84,7 +83,7 @@ class HTML_QuickForm_RuleRegistry * @access public * @return void */ - function registerRule($ruleName, $type, $data1, $data2 = null) + public function registerRule($ruleName, $type, $data1, $data2 = null) { $type = strtolower($type); if ($type == 'regex') { @@ -109,7 +108,7 @@ class HTML_QuickForm_RuleRegistry * @access public * @return HTML_QuickForm_Rule */ - function getRule($ruleName) + public function getRule($ruleName) { if (empty($ruleName)) { return false; @@ -383,5 +382,4 @@ class HTML_QuickForm_RuleRegistry } return array($value, $tmp_reset); } -} // end class HTML_QuickForm_RuleRegistry -?> +} diff --git a/main/inc/lib/pear/HTML/QuickForm/input.php b/main/inc/lib/pear/HTML/QuickForm/input.php index ad989c69df..7e82536189 100755 --- a/main/inc/lib/pear/HTML/QuickForm/input.php +++ b/main/inc/lib/pear/HTML/QuickForm/input.php @@ -111,7 +111,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element * @access public * @return void */ - function setValue($value) + public function setValue($value) { $this->updateAttributes(array('value'=>$value)); } // end func setValue @@ -126,7 +126,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element * @access public * @return string */ - function getValue() + public function getValue() { return $this->getAttribute('value'); } // end func getValue diff --git a/main/inc/lib/pear/HTML/QuickForm/text.php b/main/inc/lib/pear/HTML/QuickForm/text.php index 76003a716b..6875646549 100755 --- a/main/inc/lib/pear/HTML/QuickForm/text.php +++ b/main/inc/lib/pear/HTML/QuickForm/text.php @@ -72,7 +72,6 @@ class HTML_QuickForm_text extends HTML_QuickForm_input parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; - $this->setType('text'); } @@ -124,7 +123,6 @@ class HTML_QuickForm_text extends HTML_QuickForm_input } } - switch ($layout) { case FormValidator::LAYOUT_INLINE: return '