当前位置: 首页>>代码示例>>PHP>>正文


PHP Skill::add方法代码示例

本文整理汇总了PHP中Skill::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Skill::add方法的具体用法?PHP Skill::add怎么用?PHP Skill::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skill的用法示例。


在下文中一共展示了Skill::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_data

/**
 * Save the imported data
 * @param   array   List of users
 * @return  void
 * @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in
 */
function save_data($skills)
{
    if (is_array($skills)) {
        $parents = array();
        foreach ($skills as $index => $skill) {
            if (isset($parents[$skill['parent_id']])) {
                $skill['parent_id'] = $parents[$skill['parent_id']];
            } else {
                $skill['parent_id'] = 1;
            }
            $skill['a'] = 'add';
            $saved_id = $skill['id'];
            $skill['id'] = null;
            $oskill = new Skill();
            $skill_id = $oskill->add($skill);
            $parents[$saved_id] = $skill_id;
        }
    }
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:25,代码来源:skills_import.php

示例2: FormValidator

$skillList = [0 => get_lang('None')];
$gradebookList = [];
foreach ($allSkills as $skill) {
    $skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
    $gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$createForm = new FormValidator('skill_create');
$createForm->addHeader(get_lang('CreateSkill'));
$createForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$createForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$createForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$createForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$createForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$createForm->addButtonSave(get_lang('Save'));
$createForm->addHidden('id', null);
$createForm->setDefaults($formDefaultValues);
if ($createForm->validate()) {
    $created = $objSkill->add($createForm->getSubmitValues());
    if ($created) {
        Display::return_message(get_lang('TheSkillHasBeenCreated'), 'success');
    } else {
        Display::return_message(get_lang('CannotCreateSkill'), 'error');
    }
    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
    exit;
}
//$tpl = new Template(get_lang('CreateSkill'));
echo $createForm->returnForm();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:skill_create.php

示例3: isset

$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) {
            $skill['caption'] = $skill['name'];
            $skill['value'] = $skill['id'];
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:skill.ajax.php


注:本文中的Skill::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。