Making social/share plugin icons more little see #4598

skala
Julio Montoya 13 years ago
parent a9b0610f04
commit 0bfa8cfe39
  1. 21
      main/inc/lib/plugin.lib.php
  2. 10
      main/inc/lib/template.lib.php
  3. 3
      main/template/default/layout/topbar.tpl
  4. 2
      plugin/add_cas_login_button/plugin.php
  5. 2
      plugin/follow_buttons/index.php
  6. 8
      plugin/follow_buttons/plugin.php
  7. 57
      plugin/follow_buttons/template.tpl
  8. 3
      plugin/share_buttons/index.php
  9. 18
      plugin/share_buttons/plugin.php

@ -170,14 +170,23 @@ class AppPlugin {
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/index.php";
if (file_exists($plugin_file)) {
//Printing the plugin index.php file
require $plugin_file;
//We set the $template variable in order to use Smarty
if (isset($_template) && !empty($_template)) {
$template->assign($plugin_name, $_template);
}
//If the variable $_template is set we assign those values to be accesible in Twig
if (isset($_template)) {
$_template['plugin_info'] = $plugin_info;
} else {
$_template = array();
$_template['plugin_info'] = $plugin_info;
}
//Setting the plugin info available in the template if exists
$template->assign($plugin_name, $_template);
//Loading the Smarty template plugin files if exists
//Loading the Twig template plugin files if exists
$template_list = array();
if (isset($plugin_info) && isset($plugin_info['templates'])) {
$template_list = $plugin_info['templates'];
@ -187,7 +196,7 @@ class AppPlugin {
foreach ($template_list as $plugin_tpl) {
if (!empty($plugin_tpl)) {
//$template_plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/$plugin_tpl"; //for smarty
$template_plugin_file = "$plugin_name/$plugin_tpl"; // for twig
$template_plugin_file = "$plugin_name/$plugin_tpl"; // for twig
$template->display($template_plugin_file);
}
}

@ -39,17 +39,23 @@ class Template {
Twig_Autoloader::register();
$template_paths = array(
api_get_path(SYS_CODE_PATH).'template',
api_get_path(SYS_CODE_PATH).'template', //template folder
api_get_path(SYS_PLUGIN_PATH) //plugin folder
);
$loader = new Twig_Loader_Filesystem($template_paths);
$this->twig = new Twig_Environment($loader, array(
//'cache' => api_get_path(SYS_ARCHIVE_PATH),
//'cache' => api_get_path(SYS_ARCHIVE_PATH), //path to the cache folder
'autoescape' => false,
//'debug' => true,
//'auto_reload' => true
//'optimizations' => 0 // turn on optimizations with -1
));
$debug = new Twig_Extension_Debug();
$this->twig->addExtension($debug);
$this->twig->addFilter('get_lang',new Twig_Filter_Function('get_lang'));
$this->twig->addFilter('get_path',new Twig_Filter_Function('api_get_path'));
$this->twig->addFilter('get_setting',new Twig_Filter_Function('api_get_setting'));

@ -43,6 +43,9 @@
<li><a href="{{ _p.web_main }}admin/course_list.php">{{"CourseList"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/session_list.php">{{"SessionsList"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/settings.php">{{"Settings"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}admin/settings.php?category=Plugins">{{"Plugins"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/settings.php?category=Regions">{{"Regions"|get_lang }}</a></li>
</ul>
</li>
{% endif %}

@ -20,6 +20,7 @@ $plugin_info['comment'] = "If CAS is activated, this plugin add a text and a
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$form = new FormValidator('add_cas_button_form');
$form->addElement('text', 'cas_button_label', 'CAS connexion title', '');
@ -30,6 +31,7 @@ $form->addElement('style_submit_button', 'submit_button', get_lang('Save'));
$tab_default_add_cas_login_button_cas_button_label = api_get_setting('add_cas_login_button_cas_button_label');
$tab_default_add_cas_login_button_cas_button_comment = api_get_setting('add_cas_login_button_cas_button_comment');
$tab_default_add_cas_login_button_cas_image_url = api_get_setting('add_cas_login_button_cas_image_url');
$defaults = array();
$defaults['cas_button_label'] = $tab_default_add_cas_login_button_cas_button_label['add_cas_login_button'];
$defaults['cas_button_comment'] = $tab_default_add_cas_login_button_cas_button_comment['add_cas_login_button'];
$defaults['cas_image_url'] = $tab_default_add_cas_login_button_cas_image_url['add_cas_login_button'];

@ -11,7 +11,7 @@ $_template = null;
$_template['facebook'] = 'chamilolms'; //http://www.facebook.com/your-profile
$_template['twitter'] = 'chamilo_news'; //http://twitter.com/your-profile
$_template['linkedin'] = ''; //http://www.linkedin.com/in/your-profile
$_template['linkedin'] = 'chamilo_news'; //http://www.linkedin.com/in/your-profile
$_template['googleplus'] = ''; //https://plus.google.com/your-profile
$_template['youtube'] = ''; //http://www.youtube.com/user/your-profile
$_template['flickr'] = ''; //http://www.flickr.com/photos/your-profile

@ -20,4 +20,10 @@ $plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Julio Montoya';
$plugin_info['templates'] = array('template.tpl');
$plugin_info['templates'] = array('template.tpl');
//For bigger icons change this value to addthis_32x32_style
$plugin_info['icon_class'] = '';
//To use vertical alignment change this value to
$plugin_info['position'] = 'addthis_default_style'; //addthis_vertical_style

@ -1,33 +1,34 @@
<div class="well">
<!-- 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}
{% if follow_buttons.message is not empty %}
<h3>{{ follow_buttons.message }}</h3>
{% endif %}
<div class="addthis_toolbox {{ follow_buttons.plugin_info.icon_class}} {{ follow_buttons.plugin_info.position}} ">
{% if follow_buttons.facebook is not empty %}
<a class="addthis_button_facebook_follow" addthis:userid="{{ follow_buttons.facebook }}"></a>
{% endif %}
{% if follow_buttons.twitter is not empty %}
<a class="addthis_button_twitter_follow" addthis:userid="{{ follow_buttons.twitter }}"></a>
{% endif %}
{% if follow_buttons.linkedin is not empty %}
<a class="addthis_button_linkedin_follow" addthis:userid="{{ follow_buttons.linkedin }}"></a>
{% endif %}
{% if follow_buttons.googleplus is not empty %}
<a class="addthis_button_google_follow" addthis:userid="{{ follow_buttons.googleplus }}"></a>
{% endif %}
{% if follow_buttons.youtube is not empty %}
<a class="addthis_button_youtube_follow" addthis:userid="{{ follow_buttons.youtube }}"></a>
{% endif %}
{% if follow_buttons.flickr is not empty %}
<a class="addthis_button_flickr_follow" addthis:userid="{{ follow_buttons.flickr }}"></a>
{% endif %}
{% if follow_buttons.vimeo is not empty %}
<a class="addthis_button_vimeo_follow" addthis:userid="{{ follow_buttons.vimeo }}"></a>
{% endif %}
{% if follow_buttons.rss is not empty %}
<a class="addthis_button_rss_follow" addthis:url="{{ follow_buttons.rss }}"></a>
{% endif %}
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f69d7995360186c"></script>
<!-- AddThis Button END -->

@ -3,10 +3,9 @@
* Controller for example date plugin
* @package chamilo.plugin.share_buttons
*/
echo '<div class="well">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<div class="addthis_toolbox addthis_default_style '.$plugin_info['icon_class'].' ">
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>

@ -20,19 +20,5 @@ $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;
//For bigger icons change this value to addthis_32x32_style
$plugin_info['icon_class'] = '';

Loading…
Cancel
Save