Actualización
This commit is contained in:
94
plugin/courseblock/CourseBlockPlugin.php
Normal file
94
plugin/courseblock/CourseBlockPlugin.php
Normal 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;
|
||||
}
|
||||
}
|
||||
8
plugin/courseblock/README.md
Normal file
8
plugin/courseblock/README.md
Normal 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.
|
||||
|
||||
4
plugin/courseblock/config.php
Normal file
4
plugin/courseblock/config.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../../main/inc/global.inc.php';
|
||||
1
plugin/courseblock/index.php
Normal file
1
plugin/courseblock/index.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
||||
9
plugin/courseblock/install.php
Normal file
9
plugin/courseblock/install.php
Normal 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();
|
||||
11
plugin/courseblock/lang/english.php
Normal file
11
plugin/courseblock/lang/english.php
Normal 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';
|
||||
1
plugin/courseblock/lang/french.php
Normal file
1
plugin/courseblock/lang/french.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
||||
1
plugin/courseblock/lang/spanish.php
Normal file
1
plugin/courseblock/lang/spanish.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
||||
4
plugin/courseblock/plugin.php
Normal file
4
plugin/courseblock/plugin.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/config.php';
|
||||
$plugin_info = CourseBlockPlugin::create()->get_info();
|
||||
Reference in New Issue
Block a user