本文整理汇总了PHP中Skill::edit方法的典型用法代码示例。如果您正苦于以下问题:PHP Skill::edit方法的具体用法?PHP Skill::edit怎么用?PHP Skill::edit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::edit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
*/
//require_once '../global.inc.php';
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
if (api_get_setting('skill.allow_skills_tool') != 'true') {
exit;
}
Container::$legacyTemplate = 'layout_one_col_no_content.html.twig';
api_block_anonymous_users();
$skill = new Skill();
$gradebook = new Gradebook();
$skill_gradebook = new SkillRelGradebook();
switch ($action) {
case 'add':
if (api_is_platform_admin() || api_is_drh()) {
if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
$skill_id = $skill->edit($_REQUEST);
} else {
$skill_id = $skill->add($_REQUEST);
}
}
echo $skill_id;
break;
case 'delete_skill':
if (api_is_platform_admin() || api_is_drh()) {
echo $skill->delete($_REQUEST['skill_id']);
}
break;
case 'find_skills':
$skills = $skill->find('all', array('where' => array('name LIKE %?% ' => $_REQUEST['tag'])));
$return_skills = array();
foreach ($skills as $skill) {
示例2: FormValidator
continue;
}
$skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
$gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$editForm = new FormValidator('skill_edit');
$editForm->addHeader(get_lang('SkillEdit'));
$editForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$editForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$editForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$editForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$editForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$editForm->addButtonSave(get_lang('Save'));
$editForm->addHidden('id', null);
$editForm->setDefaults($skillDefaultInfo);
if ($editForm->validate()) {
$updated = $objSkill->edit($editForm->getSubmitValues());
if ($updated) {
Session::write('message', Display::return_message(get_lang('TheSkillHasBeenUpdated'), 'success'));
} else {
Session::write('message', Display::return_message(get_lang('CannotUpdateSkill'), 'error'));
}
Header::location(api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
}
/* view */
$tpl = new Template(get_lang('SkillEdit'));
$tpl->assign('content', $editForm->returnForm());
$tpl->display_one_col_template();