Actualización
This commit is contained in:
219
main/course_info/about.php
Normal file
219
main/course_info/about.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
use Chamilo\CoreBundle\Entity\CourseRelUser;
|
||||
use Chamilo\CoreBundle\Entity\ExtraField;
|
||||
use Chamilo\CoreBundle\Entity\Repository\SequenceResourceRepository;
|
||||
use Chamilo\CoreBundle\Entity\SequenceResource;
|
||||
use Chamilo\CourseBundle\Entity\CCourseDescription;
|
||||
|
||||
/**
|
||||
* Course about page
|
||||
* Show information about a course.
|
||||
*
|
||||
* @author Alex Aragon Calixto <alex.aragon@beeznest.com>
|
||||
*/
|
||||
$cidReset = true;
|
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
if ((api_get_setting('course_catalog_published') != 'true' && api_is_anonymous()) || api_get_configuration_value('course_about_block_all_access') == 'true') {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
|
||||
|
||||
if (empty($courseId)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$token = Security::get_existing_token();
|
||||
$em = Database::getManager();
|
||||
|
||||
$userId = api_get_user_id();
|
||||
$course = api_get_course_entity($courseId);
|
||||
|
||||
if (!$course) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$userRepo = UserManager::getRepository();
|
||||
$fieldsRepo = $em->getRepository('ChamiloCoreBundle:ExtraField');
|
||||
$fieldTagsRepo = $em->getRepository('ChamiloCoreBundle:ExtraFieldRelTag');
|
||||
|
||||
/** @var CCourseDescription $courseDescription */
|
||||
$courseDescriptionTools = $em->getRepository('ChamiloCourseBundle:CCourseDescription')
|
||||
->findBy(
|
||||
[
|
||||
'cId' => $course->getId(),
|
||||
'sessionId' => 0,
|
||||
],
|
||||
[
|
||||
'id' => 'DESC',
|
||||
'descriptionType' => 'ASC',
|
||||
]
|
||||
);
|
||||
|
||||
$courseValues = new ExtraFieldValue('course');
|
||||
$userValues = new ExtraFieldValue('user');
|
||||
|
||||
$urlCourse = api_get_path(WEB_PATH)."course/$courseId/about";
|
||||
$courseTeachers = $course->getTeachers();
|
||||
$teachersData = [];
|
||||
|
||||
/** @var CourseRelUser $teacherSubscription */
|
||||
foreach ($courseTeachers as $teacherSubscription) {
|
||||
$teacher = $teacherSubscription->getUser();
|
||||
$userData = [
|
||||
'complete_name' => UserManager::formatUserFullName($teacher),
|
||||
'image' => UserManager::getUserPicture(
|
||||
$teacher->getId(),
|
||||
USER_IMAGE_SIZE_ORIGINAL
|
||||
),
|
||||
'diploma' => $teacher->getDiplomas(),
|
||||
'openarea' => $teacher->getOpenarea(),
|
||||
];
|
||||
|
||||
$teachersData[] = $userData;
|
||||
}
|
||||
|
||||
$tagField = $fieldsRepo->findOneBy([
|
||||
'extraFieldType' => ExtraField::COURSE_FIELD_TYPE,
|
||||
'variable' => 'tags',
|
||||
]);
|
||||
|
||||
$courseTags = [];
|
||||
|
||||
if (!is_null($tagField)) {
|
||||
$courseTags = $fieldTagsRepo->getTags($tagField, $courseId);
|
||||
}
|
||||
|
||||
$courseDescription = $courseObjectives = $courseTopics = $courseMethodology = $courseMaterial = $courseResources = $courseAssessment = '';
|
||||
$courseCustom = [];
|
||||
foreach ($courseDescriptionTools as $descriptionTool) {
|
||||
switch ($descriptionTool->getDescriptionType()) {
|
||||
case CCourseDescription::TYPE_DESCRIPTION:
|
||||
$courseDescription = Security::remove_XSS($descriptionTool->getContent());
|
||||
break;
|
||||
case CCourseDescription::TYPE_OBJECTIVES:
|
||||
$courseObjectives = $descriptionTool;
|
||||
break;
|
||||
case CCourseDescription::TYPE_TOPICS:
|
||||
$courseTopics = $descriptionTool;
|
||||
break;
|
||||
case CCourseDescription::TYPE_METHODOLOGY:
|
||||
$courseMethodology = $descriptionTool;
|
||||
break;
|
||||
case CCourseDescription::TYPE_COURSE_MATERIAL:
|
||||
$courseMaterial = $descriptionTool;
|
||||
break;
|
||||
case CCourseDescription::TYPE_RESOURCES:
|
||||
$courseResources = $descriptionTool;
|
||||
break;
|
||||
case CCourseDescription::TYPE_ASSESSMENT:
|
||||
$courseAssessment = $descriptionTool;
|
||||
break;
|
||||
case CCourseDescription::TYPE_CUSTOM:
|
||||
$courseCustom[] = $descriptionTool;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$topics = [
|
||||
'objectives' => $courseObjectives,
|
||||
'topics' => $courseTopics,
|
||||
'methodology' => $courseMethodology,
|
||||
'material' => $courseMaterial,
|
||||
'resources' => $courseResources,
|
||||
'assessment' => $courseAssessment,
|
||||
'custom' => array_reverse($courseCustom),
|
||||
];
|
||||
|
||||
$subscriptionUser = CourseManager::is_user_subscribed_in_course($userId, $course->getCode());
|
||||
|
||||
$allowSubscribe = false;
|
||||
if ($course->getSubscribe() || api_is_platform_admin()) {
|
||||
$allowSubscribe = true;
|
||||
}
|
||||
$plugin = BuyCoursesPlugin::create();
|
||||
$checker = $plugin->isEnabled();
|
||||
$courseIsPremium = null;
|
||||
if ($checker) {
|
||||
$courseIsPremium = $plugin->getItemByProduct(
|
||||
$courseId,
|
||||
BuyCoursesPlugin::PRODUCT_TYPE_COURSE
|
||||
);
|
||||
}
|
||||
|
||||
$courseItem = [
|
||||
'code' => $course->getCode(),
|
||||
'visibility' => $course->getVisibility(),
|
||||
'title' => $course->getTitle(),
|
||||
'description' => $courseDescription,
|
||||
'image' => CourseManager::getPicturePath($course, true),
|
||||
'syllabus' => $topics,
|
||||
'tags' => $courseTags,
|
||||
'teachers' => $teachersData,
|
||||
'extra_fields' => $courseValues->getAllValuesForAnItem(
|
||||
$course->getId(),
|
||||
null,
|
||||
true
|
||||
),
|
||||
'subscription' => $subscriptionUser,
|
||||
];
|
||||
|
||||
$metaInfo = '<meta property="og:url" content="'.$urlCourse.'" />';
|
||||
$metaInfo .= '<meta property="og:type" content="website" />';
|
||||
$metaInfo .= '<meta property="og:title" content="'.$courseItem['title'].'" />';
|
||||
$metaInfo .= '<meta property="og:description" content="'.strip_tags($courseDescription).'" />';
|
||||
$metaInfo .= '<meta property="og:image" content="'.$courseItem['image'].'" />';
|
||||
|
||||
$htmlHeadXtra[] = $metaInfo;
|
||||
$htmlHeadXtra[] = api_get_asset('readmore-js/readmore.js');
|
||||
|
||||
/** @var SequenceResourceRepository $sequenceResourceRepo */
|
||||
$sequenceResourceRepo = $em->getRepository('ChamiloCoreBundle:SequenceResource');
|
||||
$requirements = $sequenceResourceRepo->getRequirements(
|
||||
$course->getId(),
|
||||
SequenceResource::COURSE_TYPE
|
||||
);
|
||||
|
||||
$hasRequirements = false;
|
||||
foreach ($requirements as $sequence) {
|
||||
if (!empty($sequence['requirements'])) {
|
||||
$hasRequirements = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasRequirements) {
|
||||
$sequenceList = $sequenceResourceRepo->checkRequirementsForUser($requirements, SequenceResource::COURSE_TYPE, $userId);
|
||||
$allowSubscribe = $sequenceResourceRepo->checkSequenceAreCompleted($sequenceList);
|
||||
}
|
||||
|
||||
$template = new Template($course->getTitle(), true, true, false, true, false);
|
||||
|
||||
$template->assign('course', $courseItem);
|
||||
$essence = Essence\Essence::instance();
|
||||
$template->assign('essence', $essence);
|
||||
$template->assign('is_premium', $courseIsPremium);
|
||||
$template->assign('allow_subscribe', $allowSubscribe);
|
||||
$template->assign('token', $token);
|
||||
$template->assign('url', $urlCourse);
|
||||
$template->assign(
|
||||
'subscribe_button',
|
||||
CoursesAndSessionsCatalog::getRequirements(
|
||||
$course->getId(),
|
||||
SequenceResource::COURSE_TYPE,
|
||||
true,
|
||||
true
|
||||
)
|
||||
);
|
||||
$template->assign('has_requirements', $hasRequirements);
|
||||
$template->assign('sequences', $requirements);
|
||||
|
||||
$layout = $template->get_template('course_home/about.tpl');
|
||||
$content = $template->fetch($layout);
|
||||
$template->assign('content', $content);
|
||||
$template->display_one_col_template();
|
||||
90
main/course_info/delete_course.php
Normal file
90
main/course_info/delete_course.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
use ChamiloSession as Session;
|
||||
|
||||
/**
|
||||
* This script is about deleting a course.
|
||||
* It displays a message box ('are you sure you wish to delete this course')
|
||||
* and deletes the course if the user answers affirmatively.
|
||||
*/
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
$this_section = SECTION_COURSES;
|
||||
$current_course_tool = TOOL_COURSE_MAINTENANCE;
|
||||
|
||||
api_protect_course_script(true);
|
||||
|
||||
$courseInfo = api_get_course_info();
|
||||
|
||||
if (empty($courseInfo)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$courseCode = $courseInfo['code'];
|
||||
$courseName = $courseInfo['name'];
|
||||
|
||||
if (!api_is_allowed_to_edit()) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$tool_name = get_lang('DelCourse');
|
||||
$content = Display::page_subheader(get_lang('CourseTitle').' : '.$courseName);
|
||||
$message = '';
|
||||
|
||||
$message .= Display::return_message(
|
||||
'<strong>'.get_lang('ByDel').'<strong>',
|
||||
'error',
|
||||
false
|
||||
);
|
||||
|
||||
$form = new FormValidator('delete', 'get');
|
||||
$form->addLabel(null, sprintf(get_lang('CourseCodeToEnteredCapitalLettersToConfirmDeletionX'), $courseCode));
|
||||
$form->addText('course_code', get_lang('CourseCode'));
|
||||
$form->addLabel(null, get_lang('AreYouSureToDeleteJS'));
|
||||
|
||||
$buttonGroup[] = $form->addButton('yes', get_lang('Yes'), '', 'danger', '', '', [], true);
|
||||
$buttonGroup[] = $form->addButton('no', get_lang('No'), '', 'primary', '', '', ['id' => 'no_delete'], true);
|
||||
$form->addGroup($buttonGroup);
|
||||
$returnUrl = api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq();
|
||||
if ($form->validate()) {
|
||||
$values = $form->getSubmitValues();
|
||||
$courseCodeFromGet = $values['course_code'];
|
||||
|
||||
if (isset($values['no'])) {
|
||||
api_location($returnUrl);
|
||||
}
|
||||
|
||||
if (isset($values['yes'])) {
|
||||
if ($courseCode === $courseCodeFromGet) {
|
||||
CourseManager::delete_course($courseInfo['code']);
|
||||
// DELETE CONFIRMATION MESSAGE
|
||||
Session::erase('_cid');
|
||||
Session::erase('_real_cid');
|
||||
Display::addFlash(Display::return_message($courseCode.' '.get_lang('HasDel'), 'error', false));
|
||||
api_location(api_get_path(WEB_PATH));
|
||||
} else {
|
||||
Display::addFlash(Display::return_message(get_lang('CourseRegistrationCodeIncorrect'), 'warning'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$message .= $form->returnForm();
|
||||
$interbreadcrumb[] = [
|
||||
'url' => 'maintenance.php',
|
||||
'name' => get_lang('Maintenance'),
|
||||
];
|
||||
|
||||
$htmlHeadXtra[] = '<script>
|
||||
$(function(){
|
||||
/* Asking by course code to confirm recycling*/
|
||||
$("#no_delete").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
window.location = "'.$returnUrl.'";
|
||||
});
|
||||
})
|
||||
</script>';
|
||||
|
||||
$tpl = new Template($tool_name);
|
||||
$tpl->assign('content', $content.$message);
|
||||
$tpl->display_one_col_template();
|
||||
50
main/course_info/download.php
Normal file
50
main/course_info/download.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
|
||||
|
||||
/**
|
||||
* Download script for course info.
|
||||
*/
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
$this_section = SECTION_COURSES;
|
||||
|
||||
if (isset($_GET['archive_path'])) {
|
||||
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
|
||||
} else {
|
||||
$archive_path = CourseArchiver::getBackupDir();
|
||||
}
|
||||
$archive_file = isset($_GET['archive']) ? $_GET['archive'] : null;
|
||||
$archive_file = str_replace(['..', '/', '\\'], '', $archive_file);
|
||||
|
||||
list($extension) = getextension($archive_file);
|
||||
|
||||
if (empty($extension) || !file_exists($archive_path.$archive_file)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$extension = strtolower($extension);
|
||||
$content_type = '';
|
||||
$_cid = api_get_course_int_id();
|
||||
|
||||
if (in_array($extension, ['xml', 'csv', 'imscc', 'mbz']) &&
|
||||
(api_is_platform_admin(true) || api_is_drh() || CourseManager::is_course_teacher(api_get_user_id(), api_get_course_id()))
|
||||
) {
|
||||
$content_type = 'application/force-download';
|
||||
} elseif ('zip' === $extension && $_cid && (api_is_platform_admin(true) || api_is_course_admin())) {
|
||||
$content_type = 'application/force-download';
|
||||
}
|
||||
|
||||
if (empty($content_type)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) {
|
||||
DocumentManager::file_send_for_download(
|
||||
$archive_path.$archive_file,
|
||||
true,
|
||||
$archive_file
|
||||
);
|
||||
exit;
|
||||
} else {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
7
main/course_info/index.html
Normal file
7
main/course_info/index.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=infocours.php">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
1270
main/course_info/infocours.php
Normal file
1270
main/course_info/infocours.php
Normal file
File diff suppressed because it is too large
Load Diff
153
main/course_info/legal.php
Normal file
153
main/course_info/legal.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
use ChamiloSession as Session;
|
||||
|
||||
$cidReset = true;
|
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
$this_section = SECTION_COURSES;
|
||||
|
||||
$course_code = isset($_REQUEST['course_code']) ? Security::remove_XSS($_REQUEST['course_code']) : null;
|
||||
$session_id = isset($_REQUEST['session_id']) ? (int) $_REQUEST['session_id'] : null;
|
||||
$user_id = api_get_user_id();
|
||||
|
||||
if (empty($course_code)) {
|
||||
api_not_allowed();
|
||||
}
|
||||
|
||||
$course_info = CourseManager::get_course_information($course_code);
|
||||
$course_legal = $course_info['legal'];
|
||||
|
||||
$enabled = api_get_plugin_setting('courselegal', 'tool_enable');
|
||||
$pluginExtra = null;
|
||||
$pluginLegal = false;
|
||||
|
||||
if ('true' === $enabled) {
|
||||
$pluginLegal = true;
|
||||
require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
|
||||
$plugin = CourseLegalPlugin::create();
|
||||
$data = $plugin->getData($course_info['real_id'], $session_id);
|
||||
|
||||
if (!empty($data)) {
|
||||
$course_legal = $data['content'];
|
||||
}
|
||||
|
||||
$userData = $plugin->getUserAcceptedLegal(
|
||||
$user_id,
|
||||
$course_info['real_id'],
|
||||
$session_id
|
||||
);
|
||||
|
||||
if (isset($_GET['web_agreement_link'])) {
|
||||
$plugin->saveUserMailLegal(
|
||||
$_GET['web_agreement_link'],
|
||||
$user_id,
|
||||
$course_info['real_id'],
|
||||
$session_id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Build the form
|
||||
$form = new FormValidator('legal', 'GET', api_get_self().'?course_code='.$course_code.'&session_id='.$session_id);
|
||||
$pluginMessage = null;
|
||||
$hideForm = false;
|
||||
if ($pluginLegal && isset($userData) && !empty($userData)) {
|
||||
if ($userData['web_agreement'] == 1) {
|
||||
if (empty($userData['mail_agreement'])) {
|
||||
$pluginMessage = Display::return_message(
|
||||
$plugin->get_lang('YouNeedToConfirmYourAgreementCheckYourEmail')
|
||||
);
|
||||
$hideForm = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$form->addElement('header', get_lang('CourseLegalAgreement'));
|
||||
$form->addLabel(null, Security::remove_XSS($course_legal));
|
||||
if ($pluginLegal && !empty($plugin)) {
|
||||
$form->addElement('label', null, $plugin->getCurrentFile($course_info['real_id'], $session_id));
|
||||
}
|
||||
$form->addElement('hidden', 'course_code', $course_code);
|
||||
$form->addElement('hidden', 'session_id', $session_id);
|
||||
$form->addElement('checkbox', 'accept_legal', null, get_lang('AcceptLegal'));
|
||||
$form->addButtonSave(get_lang('Accept'));
|
||||
|
||||
$variable = 'accept_legal_'.$user_id.'_'.$course_info['real_id'].'_'.$session_id;
|
||||
|
||||
$url = api_get_course_url($course_code, $session_id);
|
||||
|
||||
if ($form->validate()) {
|
||||
$accept_legal = $form->exportValue('accept_legal');
|
||||
if (1 == $accept_legal) {
|
||||
// Register to private course if is allowed.
|
||||
if (empty($session_id) &&
|
||||
COURSE_VISIBILITY_REGISTERED == $course_info['visibility'] &&
|
||||
1 == $course_info['subscribe']
|
||||
) {
|
||||
CourseManager::subscribeUser($user_id, $course_info['code'], STUDENT, 0);
|
||||
}
|
||||
|
||||
CourseManager::save_user_legal($user_id, $course_info, $session_id);
|
||||
if (api_check_user_access_to_legal($course_info)) {
|
||||
Session::write($variable, true);
|
||||
}
|
||||
|
||||
if ($pluginLegal) {
|
||||
header('Location:'.$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$user_pass_open_course = false;
|
||||
if (api_check_user_access_to_legal($course_info) && Session::read($variable)) {
|
||||
$user_pass_open_course = true;
|
||||
}
|
||||
|
||||
if (empty($session_id)) {
|
||||
if (CourseManager::is_user_subscribed_in_course($user_id, $course_code) ||
|
||||
api_check_user_access_to_legal($course_info)
|
||||
) {
|
||||
$user_accepted_legal = CourseManager::is_user_accepted_legal(
|
||||
$user_id,
|
||||
$course_code
|
||||
);
|
||||
|
||||
if ($user_accepted_legal || $user_pass_open_course) {
|
||||
// Redirect to course home
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
api_not_allowed();
|
||||
}
|
||||
} else {
|
||||
if (api_is_platform_admin()) {
|
||||
header('Location: '.$url);
|
||||
}
|
||||
|
||||
$userStatus = SessionManager::get_user_status_in_course_session($user_id, $course_info['real_id'], $session_id);
|
||||
|
||||
if (isset($userStatus) || api_check_user_access_to_legal($course_info)) {
|
||||
$user_accepted_legal = CourseManager::is_user_accepted_legal(
|
||||
$user_id,
|
||||
$course_code,
|
||||
$session_id
|
||||
);
|
||||
if ($user_accepted_legal || $user_pass_open_course) {
|
||||
// Redirect to course session home.
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
api_not_allowed();
|
||||
}
|
||||
}
|
||||
|
||||
Display::display_header();
|
||||
echo $pluginMessage;
|
||||
if ($hideForm == false) {
|
||||
$form->display();
|
||||
}
|
||||
Display::display_footer();
|
||||
106
main/course_info/maintenance.php
Normal file
106
main/course_info/maintenance.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* @author Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com
|
||||
*
|
||||
* @package chamilo.course_info
|
||||
*/
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
$current_course_tool = TOOL_COURSE_MAINTENANCE;
|
||||
$this_section = SECTION_COURSES;
|
||||
|
||||
$nameTools = get_lang('Maintenance');
|
||||
api_protect_course_script(true);
|
||||
api_block_anonymous_users();
|
||||
|
||||
// Check access rights (only teachers are allowed here)
|
||||
if (!api_is_allowed_to_edit()) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
Display::display_header($nameTools);
|
||||
echo Display::page_header($nameTools);
|
||||
|
||||
?>
|
||||
|
||||
<div class="sectiontitle">
|
||||
<?php Display::display_icon('save_import.gif', get_lang('Backup')); ?>
|
||||
<?php echo get_lang('Backup'); ?>
|
||||
</div>
|
||||
<div class="sectioncomment">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('CreateBackup'); ?>
|
||||
</a><br/>
|
||||
<?php echo get_lang('CreateBackupInfo'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('ImportBackup'); ?>
|
||||
</a><br/>
|
||||
<?php echo get_lang('ImportBackupInfo'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../coursecopy/import_moodle.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('ImportFromMoodle'); ?>
|
||||
</a><br/>
|
||||
<?php echo get_lang('ImportFromMoodleInfo'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../coursecopy/export_moodle.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('ExportToMoodle'); ?>
|
||||
</a><br/>
|
||||
<?php echo get_lang('ExportToMoodleInfo'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="sectiontitle">
|
||||
<?php Display::display_icon('copy.gif', get_lang('CopyCourse')); ?>
|
||||
<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('CopyCourse'); ?></a>
|
||||
</div>
|
||||
<div class="sectioncomment"><?php echo get_lang('DescriptionCopyCourse'); ?>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="sectiontitle">
|
||||
<?php Display::display_icon('copy.gif', get_lang('IMSCC13')); ?>
|
||||
<?php echo get_lang('CommonCartridge13'); ?>
|
||||
</div>
|
||||
<div class="sectioncomment">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?php echo api_get_path(WEB_CODE_PATH); ?>common_cartridge/cc13_export.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('ExportCcVersion13'); ?></a>
|
||||
</a><br/>
|
||||
<?php echo get_lang('ExportCcVersion13Info'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo api_get_path(WEB_CODE_PATH); ?>common_cartridge/cc13_import.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('ImportCcVersion13'); ?></a>
|
||||
</a><br/>
|
||||
<?php echo get_lang('ImportCcVersion13Info'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="sectiontitle">
|
||||
<?php Display::display_icon('tool_delete.gif', get_lang('recycle_course')); ?>
|
||||
<a href="../coursecopy/recycle_course.php?<?php echo api_get_cidreq(); ?>">
|
||||
<?php echo get_lang('recycle_course'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="sectioncomment"><?php echo get_lang('DescriptionRecycleCourse'); ?></div>
|
||||
|
||||
<div class="sectiontitle">
|
||||
<?php Display::display_icon('delete.gif', get_lang('DelCourse')); ?>
|
||||
<a href="../course_info/delete_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('DelCourse'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="sectioncomment"><?php echo get_lang('DescriptionDeleteCourse'); ?></div>
|
||||
|
||||
<?php
|
||||
|
||||
Display::display_footer();
|
||||
48
main/course_info/maintenance_coach.php
Normal file
48
main/course_info/maintenance_coach.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* Maintenance for session coach.
|
||||
*
|
||||
* @author Julio Montoya <julio.montoya@beeznest.com>
|
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
|
||||
*
|
||||
* @package chamilo.course_info
|
||||
*/
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
$current_course_tool = TOOL_COURSE_MAINTENANCE;
|
||||
$this_section = SECTION_COURSES;
|
||||
|
||||
$nameTools = get_lang('Maintenance');
|
||||
|
||||
api_protect_course_script(true);
|
||||
api_block_anonymous_users();
|
||||
|
||||
$sessionsCopy = api_get_setting('allow_session_course_copy_for_teachers');
|
||||
if ($sessionsCopy !== 'true') {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
Display::display_header($nameTools);
|
||||
|
||||
echo Display::page_subheader(
|
||||
Display::return_icon(
|
||||
'save_import.gif',
|
||||
get_lang('Backup')
|
||||
).' '.get_lang('Backup')
|
||||
);
|
||||
|
||||
$url = api_get_path(WEB_CODE_PATH).'coursecopy/copy_course_session_selected.php?'.api_get_cidreq();
|
||||
|
||||
$link = Display::url(get_lang('CopyCourse'), $url);
|
||||
?>
|
||||
<div class="sectioncomment">
|
||||
<ul>
|
||||
<li>
|
||||
<?php echo $link; ?><br/>
|
||||
<?php echo get_lang('DescriptionCopyCourse'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
Display::display_footer();
|
||||
32
main/course_info/start.php
Normal file
32
main/course_info/start.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
api_protect_course_script(true);
|
||||
api_block_anonymous_users();
|
||||
|
||||
if (!api_is_allowed_to_edit()) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$course_info = api_get_course_info();
|
||||
|
||||
$directory = $course_info['directory'];
|
||||
$title = $course_info['title'];
|
||||
|
||||
// Preparing a confirmation message.
|
||||
$link = api_get_path(WEB_COURSE_PATH).$directory.'/';
|
||||
|
||||
$tpl = new Template(get_lang('ThingsToDo'));
|
||||
|
||||
$tpl->assign('course_url', $link);
|
||||
$tpl->assign('course_title', Display::url($title, $link));
|
||||
$tpl->assign('course_id', $course_info['code']);
|
||||
$tpl->assign('just_created', isset($_GET['first']) && $_GET['first'] ? 1 : 0);
|
||||
$add_course_tpl = $tpl->get_template('create_course/add_course.tpl');
|
||||
$content = $tpl->fetch($add_course_tpl);
|
||||
|
||||
$tpl->assign('content', $content);
|
||||
$template = $tpl->get_template('layout/layout_1_col.tpl');
|
||||
$tpl->display($template);
|
||||
170
main/course_info/tools.php
Normal file
170
main/course_info/tools.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
// The section for the tabs
|
||||
$this_section = SECTION_COURSES;
|
||||
|
||||
$sessionId = api_get_session_id();
|
||||
|
||||
if (!empty($sessionId)) {
|
||||
api_not_allowed();
|
||||
}
|
||||
|
||||
api_protect_course_script(true);
|
||||
|
||||
if (!api_is_allowed_to_edit()) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : '';
|
||||
$id = isset($_GET['id']) ? (int) $_GET['id'] : '';
|
||||
|
||||
$toolName = get_lang('CustomizeIcons');
|
||||
|
||||
switch ($action) {
|
||||
case 'delete_icon':
|
||||
$tool = CourseHome::getTool($id);
|
||||
if (empty($tool)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$currentUrl = api_get_self().'?'.api_get_cidreq();
|
||||
Display::addFlash(Display::return_message(get_lang('Updated')));
|
||||
CourseHome::deleteIcon($id);
|
||||
header('Location: '.$currentUrl);
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'edit_icon':
|
||||
$tool = CourseHome::getTool($id);
|
||||
if (empty($tool)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$interbreadcrumb[] = [
|
||||
'url' => api_get_self().'?'.api_get_cidreq(),
|
||||
'name' => get_lang('CustomizeIcons'),
|
||||
];
|
||||
$toolName = Security::remove_XSS(stripslashes($tool['name']));
|
||||
|
||||
$currentUrl = api_get_self().'?action=edit_icon&id='.$id.'&'.api_get_cidreq();
|
||||
|
||||
$form = new FormValidator('icon_edit', 'post', $currentUrl);
|
||||
$form->addHeader(get_lang('EditIcon'));
|
||||
$form->addHtml('<div class="col-md-7">');
|
||||
$form->addText('name', get_lang('Name'));
|
||||
$form->addInternalUrl('link', get_lang('Links'));
|
||||
$allowedPictureTypes = ['jpg', 'jpeg', 'png'];
|
||||
$form->addFile('icon', get_lang('CustomIcon'));
|
||||
$form->addRule(
|
||||
'icon',
|
||||
get_lang('OnlyImagesAllowed').' ('.implode(',', $allowedPictureTypes).')',
|
||||
'filetype',
|
||||
$allowedPictureTypes
|
||||
);
|
||||
$form->addSelect(
|
||||
'target',
|
||||
get_lang('LinkTarget'),
|
||||
[
|
||||
'_self' => get_lang('LinkOpenSelf'),
|
||||
'_blank' => get_lang('LinkOpenBlank'),
|
||||
]
|
||||
);
|
||||
$form->addSelect(
|
||||
'visibility',
|
||||
get_lang('Visibility'),
|
||||
[1 => get_lang('Visible'), 0 => get_lang('Invisible')]
|
||||
);
|
||||
$form->addTextarea(
|
||||
'description',
|
||||
get_lang('Description'),
|
||||
['rows' => '3', 'cols' => '40']
|
||||
);
|
||||
$form->addButtonUpdate(get_lang('Update'));
|
||||
$form->addHtml('</div>');
|
||||
$form->addHtml('<div class="col-md-5">');
|
||||
if (isset($tool['custom_icon']) && !empty($tool['custom_icon'])) {
|
||||
$form->addLabel(
|
||||
get_lang('CurrentIcon'),
|
||||
Display::img(
|
||||
CourseHome::getCustomWebIconPath().$tool['custom_icon']
|
||||
)
|
||||
);
|
||||
|
||||
$form->addCheckBox('delete_icon', null, get_lang('DeletePicture'));
|
||||
}
|
||||
$form->addHtml('</div>');
|
||||
$form->setDefaults($tool);
|
||||
$content = $form->returnForm();
|
||||
|
||||
if ($form->validate()) {
|
||||
$data = $form->getSubmitValues();
|
||||
CourseHome::updateTool($id, $data);
|
||||
Display::addFlash(Display::return_message(get_lang('Updated')));
|
||||
if (isset($data['delete_icon'])) {
|
||||
CourseHome::deleteIcon($id);
|
||||
}
|
||||
$currentUrlReturn = api_get_self().'?'.api_get_cidreq();
|
||||
header('Location: '.$currentUrlReturn);
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'list':
|
||||
default:
|
||||
$toolList = CourseHome::toolsIconsAction(
|
||||
api_get_course_int_id(),
|
||||
api_get_session_id()
|
||||
);
|
||||
$iconsTools = '<div id="custom-icons">';
|
||||
$iconsTools .= Display::page_header(get_lang('CustomizeIcons'), null, 'h4');
|
||||
$iconsTools .= '<div class="row">';
|
||||
foreach ($toolList as $tool) {
|
||||
if (str_contains($tool['link'], '../plugin/')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tool['name'] = Security::remove_XSS(stripslashes($tool['name']));
|
||||
$toolIconName = 'Tool'.api_underscore_to_camel_case($tool['name']);
|
||||
$toolIconName = isset($$toolIconName) ? get_lang($toolIconName) : $tool['name'];
|
||||
|
||||
$iconsTools .= '<div class="col-md-2">';
|
||||
$iconsTools .= '<div class="items-tools">';
|
||||
|
||||
if (!empty($tool['custom_icon'])) {
|
||||
$image = CourseHome::getCustomWebIconPath().$tool['custom_icon'];
|
||||
$icon = Display::img($image, $toolIconName);
|
||||
} else {
|
||||
$image = (substr($tool['image'], 0, strpos($tool['image'], '.'))).'.png';
|
||||
$icon = Display::return_icon(
|
||||
$image,
|
||||
$toolIconName,
|
||||
['id' => 'tool_'.$tool['id']],
|
||||
ICON_SIZE_BIG,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
$delete = (!empty($tool['custom_icon'])) ? "<a class=\"btn btn-default\" onclick=\"javascript:
|
||||
if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
|
||||
"')) return false;\" href=\"".api_get_self().'?action=delete_icon&id='.$tool['iid'].'&'.api_get_cidreq()."\">
|
||||
<em class=\"fa fa-trash-o\"></em></a>" : "";
|
||||
$edit = '<a class="btn btn-default" href="'.api_get_self().'?action=edit_icon&id='.$tool['iid'].'&'.api_get_cidreq().'"><em class="fa fa-pencil"></em></a>';
|
||||
|
||||
$iconsTools .= '<div class="icon-tools">'.$icon.'</div>';
|
||||
$iconsTools .= '<div class="name-tools">'.$toolIconName.'</div>';
|
||||
$iconsTools .= '<div class="toolbar">'.$edit.$delete.'</div>';
|
||||
$iconsTools .= '</div>';
|
||||
$iconsTools .= '</div>';
|
||||
}
|
||||
$iconsTools .= '</div>';
|
||||
$iconsTools .= '</div>';
|
||||
$content = $iconsTools;
|
||||
break;
|
||||
}
|
||||
|
||||
$tpl = new Template($toolName);
|
||||
$tpl->assign('content', $content);
|
||||
$template = $tpl->get_template('layout/layout_1_col.tpl');
|
||||
$tpl->display($template);
|
||||
Reference in New Issue
Block a user