Ejemplo n.º 1
0
 /**
  * Get HTML code block for user skills
  * @param int $userId The user ID
  * @return string
  */
 public static function getSkillBlock($userId)
 {
     if (api_get_setting('skill.allow_skills_tool') !== 'true') {
         return null;
     }
     $skill = new Skill();
     $ranking = $skill->get_user_skill_ranking($userId);
     $skills = $skill->get_user_skills($userId, true);
     return Container::getTemplating()->render('@template_style/social/skills_block.html.twig', ['ranking' => $ranking, 'skills' => $skills, 'user_id' => $userId, 'show_skills_report_link' => api_is_student() || api_is_student_boss() || api_is_drh()]);
 }
Ejemplo n.º 2
0
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_SOCIAL;
if (api_get_setting('allow_skills_tool') != 'true') {
    api_not_allowed();
}
api_block_anonymous_users();
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('d3/d3.v3.5.4.min.js');
$htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');
$htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
$tpl = new Template(null, false, false);
$userId = api_get_user_id();
$userInfo = api_get_user_info();
$skill = new Skill();
$ranking = $skill->get_user_skill_ranking($userId);
$skills = $skill->get_user_skills($userId, true);
$dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
$dialogForm->addLabel(get_lang('Name'), Display::tag('p', null, ['id' => 'name', 'class' => 'form-control-static']));
$dialogForm->addLabel(get_lang('ShortCode'), Display::tag('p', null, ['id' => 'short_code', 'class' => 'form-control-static']));
$dialogForm->addLabel(get_lang('Parent'), Display::tag('p', null, ['id' => 'parent', 'class' => 'form-control-static']));
$dialogForm->addLabel([get_lang('Gradebook'), get_lang('WithCertificate')], Display::tag('ul', null, ['id' => 'gradebook', 'class' => 'form-control-static list-unstyled']));
$dialogForm->addLabel(get_lang('Description'), Display::tag('p', null, ['id' => 'description', 'class' => 'form-control-static']));
$tpl->assign('dialogForm', $dialogForm->returnForm());
$url = api_get_path(WEB_AJAX_PATH) . "skill.ajax.php?a=get_skills_tree_json&load_user={$userId}";
$tpl->assign('wheel_url', $url);
$url = api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?1=1';
$tpl->assign('url', $url);
$tpl->assign('user_info', $userInfo);
$tpl->assign('ranking', $ranking);
$tpl->assign('skills', $skills);
Ejemplo n.º 3
0
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('d3/d3.v2.min.js');
$htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');
$htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');

$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link  href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';


$tpl = new Template(null, false, false);

$load_user = api_get_user_id();
$userInfo = api_get_user_info();

$skill = new Skill();
$ranking = $skill->get_user_skill_ranking($load_user);
$countSkill = count($skill->get_all());

$skill_condition = '';
if (isset($_GET['skill_id'])) {
    $skill_condition = '&skill_id='.intval($_GET['skill_id']);
    $tpl->assign('skill_id_to_load', $_GET['skill_id']);
}

$url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$load_user";
$tpl->assign('wheel_url', $url);


$url  = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$tpl->assign('url', $url);
Ejemplo n.º 4
0
$social_right_content .= '<div class="well_border">';
$social_right_content .= '<h3>' . get_lang('ContactInformation') . '</h3>';
$list = array(array('title' => get_lang('Name'), 'content' => api_get_person_name($user_info['firstname'], $user_info['lastname'])), array('title' => get_lang('Email'), 'content' => $user_info['email']));
// Current user information
$social_right_content .= '<div>' . Display::description($list) . '</div>';
$social_right_content .= '
        <div class="form-actions">
            <a class="btn" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">
                ' . get_lang('EditProfile') . '
            </a>
        </div>
    </div>';
if (api_get_setting('allow_skills_tool') == 'true') {
    $social_right_content .= '<div class="well_border">';
    $skill = new Skill();
    $ranking = $skill->get_user_skill_ranking(api_get_user_id());
    $url = api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php';
    $ranking_url = Display::url(sprintf(get_lang('YourSkillRankingX'), $ranking), $url, array('class' => 'btn'));
    $skills = $skill->get_user_skills(api_get_user_id(), true);
    $social_right_content .= '<h3>' . get_lang('Skills') . '</h3>';
    $lis = '';
    if (!empty($skills)) {
        foreach ($skills as $skill) {
            $lis .= Display::tag('li', Display::span($skill['name'], array('class' => 'label_tag skill')));
        }
        $social_right_content .= Display::tag('ul', $lis);
    }
    $url = api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php';
    $skill_wheel_url = Display::url(get_lang('ViewSkillsWheel'), $url, array('class' => 'btn'));
    $social_right_content .= '<div class="btn-group">' . $skill_wheel_url . $ranking_url . '</div>';
    $social_right_content .= '</div>';
Ejemplo n.º 5
0
 /**
  * Get HTML code block for user skills
  * @param int $userId The user ID
  * @return string
  */
 public static function getSkillBlock($userId)
 {
     if (api_get_setting('allow_skills_tool') !== 'true') {
         return null;
     }
     $skill = new Skill();
     $ranking = $skill->get_user_skill_ranking($userId);
     $skills = $skill->get_user_skills($userId, true);
     $template = new Template(null, false, false, false, false, false);
     $template->assign('ranking', $ranking);
     $template->assign('skills', $skills);
     $template->assign('show_skills_report_link', api_is_student() || api_is_student_boss() || api_is_drh());
     $skillBlock = $template->get_template('social/skills_block.tpl');
     return $template->fetch($skillBlock);
 }