This commit is contained in:
Xes
2025-08-14 22:39:38 +02:00
parent 3641e93527
commit 5403f346e3
3370 changed files with 327179 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class CourseBlockPlugin.
*/
class CourseBlockPlugin extends Plugin
{
public $isCoursePlugin = true;
public $addCourseTool = false;
// When creating a new course this settings are added to the course
public $course_settings = [
[
'name' => 'course_block_pre_footer',
'type' => 'textarea',
],
[
'name' => 'course_block_footer_left',
'type' => 'textarea',
],
[
'name' => 'course_block_footer_center',
'type' => 'textarea',
],
[
'name' => 'course_block_footer_right',
'type' => 'textarea',
],
];
protected function __construct()
{
parent::__construct(
'0.1',
'Julio Montoya',
[
'tool_enable' => 'boolean',
]
);
}
/**
* @return CourseBlockPlugin
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
public function install()
{
// Installing course settings
$this->install_course_fields_in_all_courses(false);
}
public function uninstall()
{
// Deleting course settings
$this->uninstall_course_fields_in_all_courses();
}
/**
* @param string $region
*
* @return string
*/
public function renderRegion($region)
{
$content = '';
switch ($region) {
case 'footer_left':
$content = api_get_course_setting('course_block_footer_left');
$content = $content === -1 ? '' : $content;
break;
case 'footer_center':
$content = api_get_course_setting('course_block_footer_center');
$content = $content === -1 ? '' : $content;
break;
case 'footer_right':
$content = api_get_course_setting('course_block_footer_right');
$content = $content === -1 ? '' : $content;
break;
case 'pre_footer':
$content = api_get_course_setting('course_block_pre_footer');
$content = $content === -1 ? '' : $content;
break;
}
return $content;
}
}

View File

@@ -0,0 +1,8 @@
1. Enabled the plugin from the list of plugins.
2. Click "Configure" once the plugin was enabled.
3. Select tool_enable = Yes and save.
4. Go into a *course* (not course session) and enter the Settings tool.
5. In the "Course block" section fill the footer options.
6. Once the form was saved, you will notice that the text you fill in step .5
will appear in the Chamilo footer.

View File

@@ -0,0 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../../main/inc/global.inc.php';

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,9 @@
<?php
/* For license terms, see /license.txt */
require_once __DIR__.'/config.php';
if (!api_is_platform_admin()) {
exit('You must have admin permissions to install plugins');
}
CourseBlockPlugin::create()->install();

View File

@@ -0,0 +1,11 @@
<?php
$strings['plugin_title'] = "Course block";
$strings['plugin_comment'] = "Add header and footer in a course";
$strings['tool_enable'] = 'Enable plugin';
$strings['tool_enable_help'] = 'Once enabled, you will have to configure the plugin inside the course configuration, then from the course homepage (a button will appear there only for the teacher)';
$strings['course_block_footer_left'] = 'Footer left';
$strings['course_block_footer_center'] = 'Footer center';
$strings['course_block_footer_right'] = 'Footer right';
$strings['course_block_pre_footer'] = 'Pre footer';

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,4 @@
<?php
require_once __DIR__.'/config.php';
$plugin_info = CourseBlockPlugin::create()->get_info();