Fix customfooter

ofaj
jmontoyaa 10 years ago
parent f3c53ae075
commit 78fa5c9dc1
  1. 19
      plugin/customfooter/index.php
  2. 24
      plugin/customfooter/install.php
  3. 19
      plugin/customfooter/plugin.php

@ -3,14 +3,13 @@
* @package chamilo.plugin.customfooter * @package chamilo.plugin.customfooter
*/ */
echo '<div class="well">'; if (isset($plugin_info['current_region'])) {
if (!empty($plugin_info['settings']['customfooter_show_type'])) { switch($plugin_info['current_region']) {
echo "<h2>".$plugin_info['settings']['customfooter_show_type']."</h2>"; case 'footer_left':
} else { echo $plugin_info['settings']['customfooter_footer_left'];
echo "<h2>Custom Footer</h2>"; break;
case 'footer_right':
echo $plugin_info['settings']['customfooter_footer_right'];
break;
}
} }
//Using get_lang inside a plugin
echo get_lang('CustomFooter');
echo '</div>';

@ -1,17 +1,29 @@
<?php <?php
/* PHP code to install the plugin /* PHP code to install the plugin
* For example: * For example:
* *
// To query something to the database // 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 $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 "; $sql = "SELECT firstname, lastname FROM $table_users ";
$users = Database::query($sql); $users = Database::query($sql);
You can also use the Chamilo classes You can also use the Chamilo classes
$users = UserManager::get_user_list(); $users = UserManager::get_user_list();
*/ */
global $_configuration; global $_configuration;
api_add_setting(@$_configuration['defaults']['customfooter_footer_left'], 'customfooter_footer_left', 'customfooter', 'setting', 'Plugins'); api_add_setting(
api_add_setting(@$_configuration['defaults']['customfooter_footer_right'], 'customfooter_footer_right', 'customfooter', 'setting', 'Plugins'); @$_configuration['defaults']['customfooter_footer_left'],
'customfooter_footer_left',
'customfooter',
'setting',
'Plugins'
);
api_add_setting(
@$_configuration['defaults']['customfooter_footer_right'],
'customfooter_footer_right',
'customfooter',
'setting',
'Plugins'
);

@ -6,8 +6,7 @@
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
*/ */
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; require_once __DIR__.'/lib/customfooter_plugin.class.php';
require_once dirname(__FILE__).'/lib/customfooter_plugin.class.php';
/** /**
* Plugin details (must be present) * Plugin details (must be present)
@ -16,19 +15,19 @@ require_once dirname(__FILE__).'/lib/customfooter_plugin.class.php';
/* Plugin config */ /* Plugin config */
//the plugin title //the plugin title
$plugin_info['title'] = 'Custom Footer'; $plugin_info['title'] = 'Custom Footer';
//the comments that go with the plugin //the comments that go with the plugin
$plugin_info['comment'] = "Drives configuration parameters that plugs custom footer notes"; $plugin_info['comment'] = "Drives configuration parameters that plugs custom footer notes";
//the plugin version //the plugin version
$plugin_info['version'] = '1.0'; $plugin_info['version'] = '1.0';
//the plugin author //the plugin author
$plugin_info['author'] = 'Valery Fremaux'; $plugin_info['author'] = 'Valery Fremaux, Julio Montoya';
/* Plugin optional settings */ /* Plugin optional settings */
/* /*
* This form will be showed in the plugin settings once the plugin was installed * 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'] * in the plugin/hello_world/index.php you can have access to the value: $plugin_info['settings']['hello_world_show_type']
*/ */
@ -48,7 +47,7 @@ foreach ($config as $fooid => $configrecord) {
$form->addElement('text', 'footer_left', $plugininstance->get_lang('footerleft')); $form->addElement('text', 'footer_left', $plugininstance->get_lang('footerleft'));
$form->addElement('text', 'footer_right', $plugininstance->get_lang('footerright')); $form->addElement('text', 'footer_right', $plugininstance->get_lang('footerright'));
$form->addElement('style_submit_button', 'submit_button', $plugininstance->get_lang('Save')); $form->addButtonSave($plugininstance->get_lang('Save'));
$form->setDefaults($form_settings); $form->setDefaults($form_settings);

Loading…
Cancel
Save