|
@@ 593-623 (lines=31) @@
|
| 590 |
|
$id = $category->getId(); |
| 591 |
|
$this->set_id($id); |
| 592 |
|
|
| 593 |
|
if (!empty($id)) { |
| 594 |
|
|
| 595 |
|
$parent_id = $this->get_parent_id(); |
| 596 |
|
$grade_model_id = $this->get_grade_model_id(); |
| 597 |
|
if ($parent_id == 0) { |
| 598 |
|
//do something |
| 599 |
|
if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { |
| 600 |
|
$obj = new GradeModel(); |
| 601 |
|
$components = $obj->get_components($grade_model_id); |
| 602 |
|
$default_weight_setting = api_get_setting('gradebook_default_weight'); |
| 603 |
|
$default_weight = 100; |
| 604 |
|
if (isset($default_weight_setting)) { |
| 605 |
|
$default_weight = $default_weight_setting; |
| 606 |
|
} |
| 607 |
|
foreach ($components as $component) { |
| 608 |
|
$gradebook = new Gradebook(); |
| 609 |
|
$params = array(); |
| 610 |
|
|
| 611 |
|
$params['name'] = $component['acronym']; |
| 612 |
|
$params['description'] = $component['title']; |
| 613 |
|
$params['user_id'] = api_get_user_id(); |
| 614 |
|
$params['parent_id'] = $id; |
| 615 |
|
$params['weight'] = $component['percentage'] / 100 * $default_weight; |
| 616 |
|
$params['session_id'] = api_get_session_id(); |
| 617 |
|
$params['course_code'] = $this->get_course_code(); |
| 618 |
|
|
| 619 |
|
$gradebook->save($params); |
| 620 |
|
} |
| 621 |
|
} |
| 622 |
|
} |
| 623 |
|
} |
| 624 |
|
|
| 625 |
|
$gradebook= new Gradebook(); |
| 626 |
|
$gradebook->update_skills_to_gradebook($this->id, $this->get_skills(false)); |
|
@@ 668-697 (lines=30) @@
|
| 665 |
|
if (!empty($this->id)) { |
| 666 |
|
$parent_id = $this->get_parent_id(); |
| 667 |
|
$grade_model_id = $this->get_grade_model_id(); |
| 668 |
|
if ($parent_id == 0) { |
| 669 |
|
|
| 670 |
|
if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { |
| 671 |
|
$obj = new GradeModel(); |
| 672 |
|
$components = $obj->get_components($grade_model_id); |
| 673 |
|
$default_weight_setting = api_get_setting('gradebook_default_weight'); |
| 674 |
|
$default_weight = 100; |
| 675 |
|
if (isset($default_weight_setting)) { |
| 676 |
|
$default_weight = $default_weight_setting; |
| 677 |
|
} |
| 678 |
|
$final_weight = $this->get_weight(); |
| 679 |
|
if (!empty($final_weight)) { |
| 680 |
|
$default_weight = $this->get_weight(); |
| 681 |
|
} |
| 682 |
|
foreach ($components as $component) { |
| 683 |
|
$gradebook = new Gradebook(); |
| 684 |
|
$params = array(); |
| 685 |
|
|
| 686 |
|
$params['name'] = $component['acronym']; |
| 687 |
|
$params['description'] = $component['title']; |
| 688 |
|
$params['user_id'] = api_get_user_id(); |
| 689 |
|
$params['parent_id'] = $this->id; |
| 690 |
|
$params['weight'] = $component['percentage']/100*$default_weight; |
| 691 |
|
$params['session_id'] = api_get_session_id(); |
| 692 |
|
$params['course_code'] = $this->get_course_code(); |
| 693 |
|
|
| 694 |
|
$gradebook->save($params); |
| 695 |
|
} |
| 696 |
|
} |
| 697 |
|
} |
| 698 |
|
} |
| 699 |
|
|
| 700 |
|
$gradebook= new Gradebook(); |