Пример #1
0
                            skillbars_add_new_course_skill($courseid, $skillname);
                        }
                    }
                }
            } elseif ($token == 'skillname') {
                $skillid = strtok('_');
                if (!empty($value)) {
                    skillbars_update_skill_names(array($skillid => $value));
                }
            } elseif ($token == 'subskills') {
                if (!empty($value)) {
                    while (list($subskillid, $desc) = each($value)) {
                        if (!empty($desc)) {
                            skillbars_update_subskill_names(array($subskillid => $desc));
                        } else {
                            skillbars_delete_subskill($subskillid);
                        }
                    }
                }
            }
        }
        redirect($courseurl);
    } else {
        // form didn't validate or this is the first display
        $skills_editform->set_data($toform);
        //TODO: Use own renderer here
        echo $OUTPUT->header();
        $skills_editform->display();
        echo $OUTPUT->footer();
    }
}
Пример #2
0
function skillbars_delete_skill_subskills($courseid, $skillid)
{
    global $DB;
    $subskills = array_keys($DB->get_records('subskill', array('skillid' => $skillid, 'courseid' => $courseid)));
    foreach ($subskills as $subskillid) {
        skillbars_delete_subskill($subskillid);
    }
    return true;
}