Actualización
This commit is contained in:
6
plugin/hello_world/README.md
Normal file
6
plugin/hello_world/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Hello world plugin
|
||||
===
|
||||
|
||||
This plugin is a minimal code to serve as example of what a plugin has to contain.
|
||||
|
||||
This file will be linked in the plugin settings page through a README button.
|
||||
18
plugin/hello_world/index.php
Normal file
18
plugin/hello_world/index.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package chamilo.plugin.hello_world
|
||||
*/
|
||||
|
||||
// See also the share_user_info plugin
|
||||
|
||||
echo '<div class="well">';
|
||||
if (!empty($plugin_info['settings']['hello_world_show_type'])) {
|
||||
echo "<h2>".$plugin_info['settings']['hello_world_show_type']."</h2>";
|
||||
} else {
|
||||
echo "<h2>Hello world</h2>";
|
||||
}
|
||||
|
||||
//Using get_lang inside a plugin
|
||||
echo get_lang('HelloPlugin');
|
||||
|
||||
echo '</div>';
|
||||
14
plugin/hello_world/install.php
Normal file
14
plugin/hello_world/install.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/* PHP code to install the plugin
|
||||
* For example:
|
||||
*
|
||||
// To query something to the database
|
||||
|
||||
$table = Database::get_main_table(TABLE_MAIN_USER); // TABLE_MAIN_USER is a constant check the main/inc/database.constants.inc.php
|
||||
$sql = "SELECT firstname, lastname FROM $table_users ";
|
||||
$users = Database::query($sql);
|
||||
|
||||
You can also use the Chamilo classes
|
||||
$users = UserManager::get_user_list();
|
||||
|
||||
*/
|
||||
7
plugin/hello_world/lang/english.php
Normal file
7
plugin/hello_world/lang/english.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright (c) 2012 University of Geneva
|
||||
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>
|
||||
*/
|
||||
$strings['HelloPlugin'] = "Hello!";
|
||||
3
plugin/hello_world/lang/french.php
Normal file
3
plugin/hello_world/lang/french.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$strings['HelloPlugin'] = "Salut!";
|
||||
3
plugin/hello_world/lang/spanish.php
Normal file
3
plugin/hello_world/lang/spanish.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$strings['HelloPlugin'] = "Hola chaval!";
|
||||
41
plugin/hello_world/plugin.php
Normal file
41
plugin/hello_world/plugin.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* This script is a configuration file for the date plugin.
|
||||
* You can use it as a master for other platform plugins (course plugins are slightly different).
|
||||
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins).
|
||||
*
|
||||
* @package chamilo.plugin
|
||||
*
|
||||
* @author Julio Montoya <gugli100@gmail.com>
|
||||
*/
|
||||
/**
|
||||
* Plugin details (must be present).
|
||||
*/
|
||||
|
||||
/* Plugin config */
|
||||
|
||||
//the plugin title
|
||||
$plugin_info['title'] = 'Hello world';
|
||||
//the comments that go with the plugin
|
||||
$plugin_info['comment'] = "Shows a hello world message";
|
||||
//the plugin version
|
||||
$plugin_info['version'] = '1.0';
|
||||
//the plugin author
|
||||
$plugin_info['author'] = 'Julio Montoya';
|
||||
|
||||
/* Plugin optional settings */
|
||||
|
||||
/*
|
||||
* This form will be showed in the plugin settings once the plugin was installed
|
||||
* in the plugin/hello_world/index.php you can have
|
||||
* access to the value: $plugin_info['settings']['hello_world_show_type']
|
||||
*/
|
||||
|
||||
$form = new FormValidator('hello_world_form');
|
||||
|
||||
//A simple select
|
||||
$options = ['hello_world' => 'Hello World', 'hello' => 'Hello', 'hi' => 'Hi!'];
|
||||
$form->addElement('select', 'show_type', 'Hello world types', $options);
|
||||
$form->addButtonSave(get_lang('Save'), 'submit_button');
|
||||
|
||||
$plugin_info['settings_form'] = $form;
|
||||
2
plugin/hello_world/uninstall.php
Normal file
2
plugin/hello_world/uninstall.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
/* PHP code to uninstall the plugin */
|
||||
Reference in New Issue
Block a user