From df4d2326385a5732baae630abadef8f7369e1ac5 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 14 Aug 2017 10:44:12 +0200 Subject: [PATCH] Minor - format code, use camelCase functions --- main/gradebook/lib/be/abstractlink.class.php | 6 ++--- main/gradebook/lib/be/category.class.php | 27 +++++++++++--------- main/gradebook/lib/be/evaluation.class.php | 8 +++--- main/gradebook/lib/fe/catform.class.php | 3 ++- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/main/gradebook/lib/be/abstractlink.class.php b/main/gradebook/lib/be/abstractlink.class.php index e77291723e..4706eac75f 100755 --- a/main/gradebook/lib/be/abstractlink.class.php +++ b/main/gradebook/lib/be/abstractlink.class.php @@ -512,7 +512,7 @@ abstract class AbstractLink implements GradebookItem $crscats = Category::load(null, null, $this->get_course_code(), 0); foreach ($crscats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() @@ -527,12 +527,12 @@ abstract class AbstractLink implements GradebookItem * @param integer $level * @return array */ - private function add_target_subcategories($targets, $level, $catid) + private function addTargetSubcategories($targets, $level, $catid) { $subcats = Category::load(null, null, null, $catid); foreach ($subcats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index fe31bb619b..7e8f4206a4 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -330,7 +330,7 @@ class Category implements GradebookItem /** * @return array */ - public function get_skills_for_select() + public function getSkillsForSelect() { $skills = $this->get_skills(); $skill_select = array(); @@ -638,7 +638,10 @@ class Category implements GradebookItem $grade_model_id = $this->get_grade_model_id(); if ($parent_id == 0) { //do something - if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { + if (isset($grade_model_id) && + !empty($grade_model_id) && + $grade_model_id != '-1' + ) { $obj = new GradeModel(); $components = $obj->get_components($grade_model_id); $default_weight_setting = api_get_setting('gradebook_default_weight'); @@ -754,7 +757,7 @@ class Category implements GradebookItem * Update link weights see #5168 * @param type $new_weight */ - public function update_children_weight($new_weight) + public function updateChildrenWeight($new_weight) { $links = $this->get_links(); $old_weight = $this->get_weight(); @@ -1399,7 +1402,7 @@ class Category implements GradebookItem $cat->get_name(), $level + 1 ); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() @@ -1412,7 +1415,7 @@ class Category implements GradebookItem foreach ($indcats as $cat) { if ($this->can_be_moved_to_cat($cat)) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() @@ -1432,7 +1435,7 @@ class Category implements GradebookItem * * @return array */ - private function add_target_subcategories($targets, $level, $catid) + private function addTargetSubcategories($targets, $level, $catid) { $subcats = self::load(null, null, null, $catid); foreach ($subcats as $cat) { @@ -1442,7 +1445,7 @@ class Category implements GradebookItem $cat->get_name(), $level + 1 ); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() @@ -1454,7 +1457,7 @@ class Category implements GradebookItem } /** - * Internal function used by get_target_categories() and add_target_subcategories() + * Internal function used by get_target_categories() and addTargetSubcategories() * Can this category be moved to the given category ? * Impossible when origin and target are the same... children won't be processed * either. (a category can't be moved to one of its own children) @@ -1476,7 +1479,7 @@ class Category implements GradebookItem $this->set_parent_id($cat->get_id()); if ($this->get_course_code() != $cat->get_course_code()) { $this->set_course_code($cat->get_course_code()); - $this->apply_course_code_to_children(); + $this->applyCourseCodeToChildren(); } $this->save(); } @@ -1484,7 +1487,7 @@ class Category implements GradebookItem /** * Internal function used by move_to_cat() */ - private function apply_course_code_to_children() + private function applyCourseCodeToChildren() { $cats = self::load(null, null, null, $this->id, null); $evals = Evaluation::load(null, null, null, $this->id, null); @@ -1497,11 +1500,11 @@ class Category implements GradebookItem $this->id, null ); - + /** @var Category $cat */ foreach ($cats as $cat) { $cat->set_course_code($this->get_course_code()); $cat->save(); - $cat->apply_course_code_to_children(); + $cat->applyCourseCodeToChildren(); } foreach ($evals as $eval) { diff --git a/main/gradebook/lib/be/evaluation.class.php b/main/gradebook/lib/be/evaluation.class.php index 078bb1c1fd..b535a33ce6 100755 --- a/main/gradebook/lib/be/evaluation.class.php +++ b/main/gradebook/lib/be/evaluation.class.php @@ -661,7 +661,7 @@ class Evaluation implements GradebookItem $crscats = Category::load(null, null, $this->course_code, 0); foreach ($crscats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() @@ -672,7 +672,7 @@ class Evaluation implements GradebookItem $indcats = Category::load(null, $user, 0, 0); foreach ($indcats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() @@ -688,12 +688,12 @@ class Evaluation implements GradebookItem * * @return array */ - private function add_target_subcategories($targets, $level, $catid) + private function addTargetSubcategories($targets, $level, $catid) { $subcats = Category::load(null, null, null, $catid); foreach ($subcats as $cat) { $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); - $targets = $this->add_target_subcategories( + $targets = $this->addTargetSubcategories( $targets, $level + 1, $cat->get_id() diff --git a/main/gradebook/lib/fe/catform.class.php b/main/gradebook/lib/fe/catform.class.php index ee435783e0..d219251bf0 100755 --- a/main/gradebook/lib/fe/catform.class.php +++ b/main/gradebook/lib/fe/catform.class.php @@ -13,6 +13,7 @@ class CatForm extends FormValidator const TYPE_EDIT = 2; const TYPE_MOVE = 3; const TYPE_SELECT_COURSE = 4; + /** @var Category */ private $category_object; /** @@ -133,7 +134,7 @@ class CatForm extends FormValidator */ protected function build_editing_form() { - $skills = $this->category_object->get_skills_for_select(); + $skills = $this->category_object->getSkillsForSelect(); $course_code = api_get_course_id(); $session_id = api_get_session_id();