chamilo /
chamilo-lms
| 1 | <?php |
||
| 2 | /* For licensing terms, see /license.txt */ |
||
| 3 | |||
| 4 | use Symfony\Component\HttpFoundation\Request as HttpRequest; |
||
|
0 ignored issues
–
show
|
|||
| 5 | |||
| 6 | $cidReset = true; |
||
| 7 | |||
| 8 | require_once __DIR__.'/../inc/global.inc.php'; |
||
| 9 | |||
| 10 | $this_section = SECTION_PLATFORM_ADMIN; |
||
| 11 | |||
| 12 | api_protect_admin_script(false, true); |
||
| 13 | Skill::isAllowed(); |
||
| 14 | |||
| 15 | $httpRequest = HttpRequest::createFromGlobals(); |
||
| 16 | |||
| 17 | //Adds the JS needed to use the jqgrid |
||
| 18 | $htmlHeadXtra[] = api_get_js('d3/d3.v3.5.4.min.js'); |
||
| 19 | $htmlHeadXtra[] = api_get_js('d3/colorbrewer.js'); |
||
| 20 | $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js'); |
||
| 21 | |||
| 22 | $tpl = new Template(null, false, false); |
||
| 23 | |||
| 24 | $load_user = 0; |
||
| 25 | if (isset($_GET['load_user'])) { |
||
| 26 | $load_user = 1; |
||
| 27 | } |
||
| 28 | |||
| 29 | $skill_condition = ''; |
||
| 30 | if (isset($_GET['skill_id'])) { |
||
| 31 | $skillId = $httpRequest->query->getInt('skill_id'); |
||
| 32 | $skill_condition = "&skill_id=$skillId"; |
||
| 33 | $tpl->assign('skill_id_to_load', $skillId); |
||
| 34 | } |
||
| 35 | |||
| 36 | $url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$load_user"; |
||
| 37 | $tpl->assign('wheel_url', $url); |
||
| 38 | |||
| 39 | $url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1'; |
||
| 40 | $tpl->assign('url', $url); |
||
| 41 | $tpl->assign('isAdministration', true); |
||
| 42 | |||
| 43 | $dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']); |
||
| 44 | $dialogForm->addLabel( |
||
| 45 | get_lang('Name'), |
||
| 46 | Display::tag('p', null, ['id' => 'name', 'class' => 'form-control-static']) |
||
| 47 | ); |
||
| 48 | $dialogForm->addLabel( |
||
| 49 | get_lang('ShortCode'), |
||
| 50 | Display::tag('p', null, ['id' => 'short_code', 'class' => 'form-control-static']) |
||
| 51 | ); |
||
| 52 | $dialogForm->addLabel( |
||
| 53 | get_lang('Parent'), |
||
| 54 | Display::tag('p', null, ['id' => 'parent', 'class' => 'form-control-static']) |
||
| 55 | ); |
||
| 56 | $dialogForm->addLabel( |
||
| 57 | [get_lang('Gradebook'), get_lang('WithCertificate')], |
||
| 58 | Display::tag('ul', null, ['id' => 'gradebook', 'class' => 'form-control-static list-unstyled']) |
||
| 59 | ); |
||
| 60 | $dialogForm->addLabel( |
||
| 61 | get_lang('Description'), |
||
| 62 | Display::tag( |
||
| 63 | 'p', |
||
| 64 | null, |
||
| 65 | ['id' => 'description', 'class' => 'form-control-static'] |
||
| 66 | ) |
||
| 67 | ); |
||
| 68 | |||
| 69 | $tpl->assign('dialogForm', $dialogForm->returnForm()); |
||
| 70 | |||
| 71 | $saveProfileForm = new FormValidator( |
||
| 72 | 'form', |
||
| 73 | 'post', |
||
| 74 | null, |
||
| 75 | null, |
||
| 76 | ['id' => 'dialog-form-profile'] |
||
| 77 | ); |
||
| 78 | $saveProfileForm->addHidden('profile_id', null); |
||
| 79 | $saveProfileForm->addText( |
||
| 80 | 'name', |
||
| 81 | get_lang('Name'), |
||
| 82 | true, |
||
| 83 | ['id' => 'name_profile'] |
||
| 84 | ); |
||
| 85 | $saveProfileForm->addTextarea( |
||
| 86 | 'description', |
||
| 87 | get_lang('Description'), |
||
| 88 | ['id' => 'description_profile', 'rows' => 6] |
||
| 89 | ); |
||
| 90 | $tpl->assign('save_profile_form', $saveProfileForm->returnForm()); |
||
| 91 | $templateName = $tpl->get_template('skill/skill_wheel.tpl'); |
||
| 92 | $content = $tpl->fetch($templateName); |
||
| 93 | |||
| 94 | $tpl->assign('content', $content); |
||
| 95 | $tpl->display_no_layout_template(); |
||
| 96 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: