|
@@ 601-631 (lines=31) @@
|
| 598 |
|
$id = $category->getId(); |
| 599 |
|
$this->set_id($id); |
| 600 |
|
|
| 601 |
|
if (!empty($id)) { |
| 602 |
|
$parent_id = $this->get_parent_id(); |
| 603 |
|
$grade_model_id = $this->get_grade_model_id(); |
| 604 |
|
if ($parent_id == 0) { |
| 605 |
|
//do something |
| 606 |
|
if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { |
| 607 |
|
$obj = new GradeModel(); |
| 608 |
|
$components = $obj->get_components($grade_model_id); |
| 609 |
|
$default_weight_setting = api_get_setting('gradebook_default_weight'); |
| 610 |
|
$default_weight = 100; |
| 611 |
|
if (isset($default_weight_setting)) { |
| 612 |
|
$default_weight = $default_weight_setting; |
| 613 |
|
} |
| 614 |
|
foreach ($components as $component) { |
| 615 |
|
$gradebook = new Gradebook(); |
| 616 |
|
$params = array(); |
| 617 |
|
|
| 618 |
|
$params['name'] = $component['acronym']; |
| 619 |
|
$params['description'] = $component['title']; |
| 620 |
|
$params['user_id'] = api_get_user_id(); |
| 621 |
|
$params['parent_id'] = $id; |
| 622 |
|
$params['weight'] = $component['percentage'] / 100 * $default_weight; |
| 623 |
|
$params['session_id'] = api_get_session_id(); |
| 624 |
|
$params['course_code'] = $this->get_course_code(); |
| 625 |
|
|
| 626 |
|
$gradebook->save($params); |
| 627 |
|
} |
| 628 |
|
} |
| 629 |
|
} |
| 630 |
|
} |
| 631 |
|
|
| 632 |
|
$gradebook = new Gradebook(); |
| 633 |
|
$gradebook->update_skills_to_gradebook( |
| 634 |
|
$this->id, |
|
@@ 682-711 (lines=30) @@
|
| 679 |
|
if (!empty($this->id)) { |
| 680 |
|
$parent_id = $this->get_parent_id(); |
| 681 |
|
$grade_model_id = $this->get_grade_model_id(); |
| 682 |
|
if ($parent_id == 0) { |
| 683 |
|
if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { |
| 684 |
|
$obj = new GradeModel(); |
| 685 |
|
$components = $obj->get_components($grade_model_id); |
| 686 |
|
$default_weight_setting = api_get_setting('gradebook_default_weight'); |
| 687 |
|
$default_weight = 100; |
| 688 |
|
if (isset($default_weight_setting)) { |
| 689 |
|
$default_weight = $default_weight_setting; |
| 690 |
|
} |
| 691 |
|
$final_weight = $this->get_weight(); |
| 692 |
|
if (!empty($final_weight)) { |
| 693 |
|
$default_weight = $this->get_weight(); |
| 694 |
|
} |
| 695 |
|
foreach ($components as $component) { |
| 696 |
|
$gradebook = new Gradebook(); |
| 697 |
|
$params = array(); |
| 698 |
|
$params['name'] = $component['acronym']; |
| 699 |
|
$params['description'] = $component['title']; |
| 700 |
|
$params['user_id'] = api_get_user_id(); |
| 701 |
|
$params['parent_id'] = $this->id; |
| 702 |
|
$params['weight'] = $component['percentage'] / 100 * $default_weight; |
| 703 |
|
$params['session_id'] = api_get_session_id(); |
| 704 |
|
$params['course_code'] = $this->get_course_code(); |
| 705 |
|
$gradebook->save($params); |
| 706 |
|
} |
| 707 |
|
} |
| 708 |
|
} |
| 709 |
|
} |
| 710 |
|
|
| 711 |
|
$gradebook = new Gradebook(); |
| 712 |
|
$gradebook->update_skills_to_gradebook( |
| 713 |
|
$this->id, |
| 714 |
|
$this->get_skills(false), |