@@ 769-780 (lines=12) @@ | ||
766 | if ($skill_id) { |
|
767 | //Saving skill_rel_skill (parent_id, relation_type) |
|
768 | ||
769 | foreach ($params['parent_id'] as $parent_id) { |
|
770 | $relation_exists = $skill_rel_skill->relation_exists($skill_id, $parent_id); |
|
771 | if (!$relation_exists) { |
|
772 | $attributes = array( |
|
773 | 'skill_id' => $skill_id, |
|
774 | 'parent_id' => $parent_id, |
|
775 | 'relation_type' => (isset($params['relation_type'])?$params['relation_type']:0), |
|
776 | //'level' => $params['level'], |
|
777 | ); |
|
778 | $skill_rel_skill->save($attributes); |
|
779 | } |
|
780 | } |
|
781 | ||
782 | if (!empty($params['gradebook_id'])) { |
|
783 | foreach ($params['gradebook_id'] as $gradebook_id) { |
|
@@ 866-877 (lines=12) @@ | ||
863 | $params['parent_id'] = array($params['parent_id']); |
|
864 | } |
|
865 | ||
866 | foreach ($params['parent_id'] as $parent_id) { |
|
867 | $relation_exists = $skill_rel_skill->relation_exists($skill_id, $parent_id); |
|
868 | if (!$relation_exists) { |
|
869 | $attributes = array( |
|
870 | 'skill_id' => $skill_id, |
|
871 | 'parent_id' => $parent_id, |
|
872 | 'relation_type' => $params['relation_type'], |
|
873 | //'level' => $params['level'], |
|
874 | ); |
|
875 | $skill_rel_skill->update_by_skill($attributes); |
|
876 | } |
|
877 | } |
|
878 | ||
879 | $skill_rel_gradebook->update_gradebooks_by_skill($skill_id, $params['gradebook_id']); |
|
880 | return $skill_id; |