Adding 2 plugins that uses the addthis.com share tools see #1840

skala
Julio Montoya 13 years ago
parent ee29f4b650
commit bc0d374834
  1. 21
      main/inc/lib/plugin.lib.php
  2. 19
      plugin/follow_buttons/index.php
  3. 23
      plugin/follow_buttons/plugin.php
  4. 3
      plugin/follow_buttons/readme.txt
  5. 33
      plugin/follow_buttons/template.tpl
  6. 18
      plugin/share_buttons/index.php
  7. 38
      plugin/share_buttons/plugin.php
  8. 4
      plugin/show_user_info/index.php
  9. 3
      plugin/show_user_info/plugin.php
  10. 4
      plugin/show_user_info/template.tpl

@ -144,26 +144,29 @@ class AppPlugin {
function get_all_plugin_contents_by_block($block, $template) {
global $_plugins;
if (isset($_plugins[$block]) && is_array($_plugins[$block])) {
//if (1) {
foreach ($_plugins[$block] as $plugin_name) {
//Load the plugin information
//The plugin_info variable is available inside the plugin index
//The plugin_info variable is available inside the plugin index
$plugin_info = $this->get_plugin_info($plugin_name);
//We also where the plugin is
$plugin_info['current_region'] = $block;
// Loading the plugin/XXX/index.php file
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/index.php";
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/index.php";
if (file_exists($plugin_file)) {
require $plugin_file;
//We set the $template variable in order to use smarty
if (isset($_template) && !empty($_template)) {
foreach($_template as $key =>$value) {
$template->assign($key, $value);
//We set the $template variable in order to use smarty
if (isset($_template) && !empty($_template)) {
/*
foreach ($_template as $key =>$value) {
$template->assign($plugin_name[$key], $value);
}
*/
$template->assign($plugin_name, $_template);
}
//Loading the smarty template files if exists
@ -173,14 +176,14 @@ class AppPlugin {
}
if (!empty($template_list)) {
foreach($template_list as $plugin_tpl) {
foreach ($template_list as $plugin_tpl) {
if (!empty($plugin_tpl)) {
$template_plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/$plugin_tpl";
$template->display($template_plugin_file);
}
}
}
}
}
}
}
return true;

@ -0,0 +1,19 @@
<?php
/**
* Controller for example date plugin
* @package chamilo.plugin.sharethis
*/
//Plugin settings
$_template = null;
//$_template['message'] = 'Follow us';
$_template['facebook'] = 'chamilolms';
$_template['twitter'] = 'chamilo_news';
$_template['linkedin'] = '';
$_template['googleplus'] = '';
$_template['youtube'] = '';
$_template['flickr'] = '';
$_template['vimeo'] = '';
$_template['rss'] = 'http://www.chamilo.org/';

@ -0,0 +1,23 @@
<?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'] = 'Follow icons';
//the comments that go with the plugin
$plugin_info['comment'] = "Add social icons (implemented using addthis.com)";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Julio Montoya';
$plugin_info['templates'] = array('template.tpl');

@ -0,0 +1,3 @@
README
Edit the main/plugin/follow_buttons/index.php file in order to add your settings

@ -0,0 +1,33 @@
<!-- AddThis Button BEGIN -->
{if !empty($follow_buttons.message)}
<h3>{$follow_buttons.message}</h3>
{/if}
<div class="addthis_toolbox addthis_32x32_style addthis_default_style">
{if !empty($follow_buttons.facebook)}
<a class="addthis_button_facebook_follow" addthis:userid="{$follow_buttons.facebook}"></a>
{/if}
{if !empty($follow_buttons.twitter)}
<a class="addthis_button_twitter_follow" addthis:userid="{$follow_buttons.twitter}"></a>
{/if}
{if !empty($follow_buttons.linkedin)}
<a class="addthis_button_linkedin_follow" addthis:userid="{$follow_buttons.linkedin}"></a>
{/if}
{if !empty($follow_buttons.googleplus)}
<a class="addthis_button_google_follow" addthis:userid="{$follow_buttons.googleplus}"></a>
{/if}
{if !empty($follow_buttons.youtube)}
<a class="addthis_button_youtube_follow" addthis:userid="{$follow_buttons.youtube}"></a>
{/if}
{if !empty($follow_buttons.flickr)}
<a class="addthis_button_flickr_follow" addthis:userid="{$follow_buttons.flickr}"></a>
{/if}
{if !empty($follow_buttons.vimeo)}
<a class="addthis_button_vimeo_follow" addthis:userid="{$follow_buttons.vimeo}"></a>
{/if}
{if !empty($follow_buttons.rss)}
<a class="addthis_button_rss_follow" addthis:url="{$follow_buttons.rss}"></a>
{/if}
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f69d7995360186c"></script>
<!-- AddThis Button END -->

@ -0,0 +1,18 @@
<?php
/**
* Controller for example date plugin
* @package chamilo.plugin.share_buttons
*/
echo '
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f69d6f847541385"></script>
<!-- AddThis Button END -->';

@ -0,0 +1,38 @@
<?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'] = 'Share this page';
//the comments that go with the plugin
$plugin_info['comment'] = "Show social icons to share a page using addthis.com";
//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 = array('hello_world' => 'Hello World', 'hello' =>'Hello', 'hi' =>'Hi!');
$form->addElement('select', 'show_type', 'Hello world types', $options);
$form->addElement('style_submit_button', 'submit_button', get_lang('Save'));
$plugin_info['settings_form'] = $form;

@ -13,6 +13,6 @@ if (!api_is_anonymous()) {
$user_info = api_get_user_info($user_id);
//You can also use smarty setting variables in the special variable called template
$_template['my_user_info'] = $user_info;
$_template['my_username'] = $user_info['username'];
$_template['user_info'] = $user_info;
$_template['username'] = $user_info['username'];
}

@ -10,7 +10,8 @@
*/
//the plugin title
$plugin_info['title'] = 'Show user information';
$plugin_info['title'] = 'Show user information';
//the comments that go with the plugin
$plugin_info['comment'] = "Shows a welcome message, (this is an example to uses smarty)";
//the plugin version

@ -24,9 +24,9 @@
4. Read more
You can also see more examples in the the main/template/default/layout files
*}
{if $show_message}
{if $show_user_info.show_message}
<div class="well">
{"Welcome"|get_lang} {$my_user_info.complete_name} ({$my_username})
{"Welcome"|get_lang} {$show_user_info.user_info.complete_name} ({$show_user_info.username})
<br />
The administrator - {"siteName"|api_get_setting}
</div>

Loading…
Cancel
Save