本文整理匯總了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();