You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.0 KiB
71 lines
2.0 KiB
10 years ago
|
<?php
|
||
|
/* For licensing terms, see /license.txt */
|
||
|
/**
|
||
|
* Show information about Mozilla OpenBadges
|
||
|
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
|
||
|
* @package chamilo.admin.openbadges
|
||
|
*/
|
||
|
$cidReset = true;
|
||
|
|
||
10 years ago
|
require_once '../inc/global.inc.php';
|
||
|
require_once '../inc/lib/fileUpload.lib.php';
|
||
10 years ago
|
|
||
|
$this_section = SECTION_PLATFORM_ADMIN;
|
||
|
|
||
|
$skillId = intval($_GET['id']);
|
||
|
|
||
|
$objSkill = new Skill();
|
||
|
$skill = $objSkill->get($skillId);
|
||
|
|
||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||
|
if ($_FILES['image']['error'] == 0) {
|
||
|
$dirPermissions = api_get_permissions_for_new_directories();
|
||
|
$sysCodePath = api_get_path(SYS_CODE_PATH);
|
||
|
|
||
|
$fileDir = "upload/data/badges/";
|
||
|
$fileName = sha1($_POST['name']) . ".png";
|
||
|
|
||
|
if (!file_exists($sysCodePath . $fileDir)) {
|
||
|
mkdir($sysCodePath . $fileDir, $dirPermissions, true);
|
||
|
}
|
||
|
|
||
|
if ($_FILES['image']['error'] == 0) {
|
||
10 years ago
|
unlink($sysCodePath . $skill['icon']);
|
||
10 years ago
|
|
||
|
$imageExtraField = new Image($_FILES['image']['tmp_name']);
|
||
|
$imageExtraField->send_image($sysCodePath . $fileDir . $fileName, -1, 'png');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$params = array(
|
||
|
'name' => $_POST['name'],
|
||
|
'description' => $_POST['description'],
|
||
|
'icon' => $fileDir . $fileName,
|
||
|
'criteria' => $_POST['criteria'],
|
||
|
'id' => $skillId
|
||
|
);
|
||
|
|
||
10 years ago
|
if ($objSkill->update($params)) {
|
||
10 years ago
|
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/skill_badge_list.php');
|
||
10 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
$interbreadcrumb = array(
|
||
|
array(
|
||
|
'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php',
|
||
|
'name' => get_lang('Administration')
|
||
|
),
|
||
|
array(
|
||
10 years ago
|
'url' => api_get_path(WEB_CODE_PATH) . 'admin/skill_badge.php',
|
||
|
'name' => get_lang('Badges')
|
||
10 years ago
|
)
|
||
|
);
|
||
|
|
||
10 years ago
|
$tpl = new Template(get_lang('CreateBadge'));
|
||
10 years ago
|
$tpl->assign('platformAdminEmail', get_setting('emailAdministrator'));
|
||
|
$tpl->assign('skill', $skill);
|
||
|
|
||
10 years ago
|
$contentTemplate = $tpl->get_template('skill/badge_create.tpl');
|
||
10 years ago
|
|
||
|
$tpl->display($contentTemplate);
|