Bläddra i källkod

Update plugins

jmontoyaa 8 år sedan
förälder
incheckning
81699d648a

+ 0 - 0
plugin/add_facebook_login_button/template.tpl → plugin/add_facebook_login_button/template.html.twig


+ 0 - 42
plugin/ext_auth_chamilo_logout_button_behaviour/index.php

@@ -1,42 +0,0 @@
-<?php
-// personalize the logout button behaviour
-global $_user;
-$_template['show_message'] = false;
-
-if (!api_is_anonymous() &&
-    api_get_setting('cas_activate') == 'true' &&
-    $_user['auth_source'] == CAS_AUTH_SOURCE
-) {
-    $_template['show_message']   = true;
-    // the link URL
-    $link_url = "#";
-    if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url'])) {
-        $link_url = api_htmlentities($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url']);
-    }
-    // the infobulle
-    $link_infobulle = "Vous devez fermer votre navigateur pour clore votre session de travail.";
-    if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle'])) {
-        $link_infobulle = api_htmlentities($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle']);
-    }
-    // $link_image=1 if we replace the logout button by a grey one 'exit_na'
-    $link_image = "1";
-    if (empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image'])) {
-        $link_image = "";
-    }
-    // checkbox to disaply an alert box when clicnkig on the logout button
-    $alert_onoff = "1";
-    if (empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff'])) {
-        $alert_onoff = "";
-    }
-    // alert text to display if check is on
-    $alert_text = "\\\\nVous êtes connectés avec votre compte universitaire.\\\\n\\\\nVous devez *** fermer votre navigateur *** pour clore votre session de travail.";
-    if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text'])) {
-        $alert_text = $plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text'];
-    }
-
-    $_template['link_url'] = $link_url;
-    $_template['link_infobulle'] = $link_infobulle;
-    $_template['link_image'] = $link_image;
-    $_template['alert_onoff'] = $alert_onoff;
-    $_template['alert_text'] = $alert_text;
-}

+ 0 - 47
plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php

@@ -1,47 +0,0 @@
-<?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)
- */
-
-//the plugin title
-$plugin_info['title']      = 'Enable or disable logout button';
-
-//the comments that go with the plugin
-$plugin_info['comment']     = "If you use some other authentication than local Chamilo authentication, you may have to disable the Chamilo logout button and give users information about your SSO logout.";
-//the plugin version
-$plugin_info['version']     = '1.0';
-//the plugin author
-$plugin_info['author']      = 'Hubert Borderiou';
-//the plugin configuration
-$form = new FormValidator('eaclbb_form');
-$form->addElement("html", "<div class='normal-message'>Fill the text boxes below to overwrite the default values used in this plugin</div>");
-$form->addElement('text', 'eaclbb_form_link_url', 'Page to load when clicking on the logout button');
-$form->addElement('text', 'eaclbb_form_link_infobulle', 'Tooltip text for the logout button (displayed on mouseover)');
-$form->addElement('checkbox', 'eaclbb_form_link_image', "Display the logout button disabled (black and white)", "",  array('checked' => true));
-$form->addElement('checkbox', 'eaclbb_form_alert_onoff', "Display an alert when clicking on the logout button", "",  array('checked' => true));
-$form->addElement('text', 'eaclbb_form_alert_text', "Text displayed in the alert box when clickng on the logout button (if checkbox above has been checked).");
-
-$form->addButtonSave(get_lang('Save'), 'submit_button');
-//get default value for form
-$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url');
-$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle');
-$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image');
-$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff');
-$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text');
-$defaults['eaclbb_form_link_url'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url['eaclbb_form_link_url'];
-$defaults['eaclbb_form_link_infobulle'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle['eaclbb_form_link_infobulle'];
-$defaults['eaclbb_form_link_image'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image['eaclbb_form_link_image'];
-$defaults['eaclbb_form_alert_onoff'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff['eaclbb_form_alert_onoff'];
-$defaults['eaclbb_form_alert_text'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text['eaclbb_form_alert_text'];
-$form->setDefaults($defaults);
-//display form
-$plugin_info['settings_form'] = $form;
-
-// Set the templates that are going to be used
-$plugin_info['templates']   = array('template.tpl');

+ 0 - 15
plugin/ext_auth_chamilo_logout_button_behaviour/readme.txt

@@ -1,15 +0,0 @@
-README
-<br/><br/>
-If you use some other authentication than local Chamilo authentication, you may want to disable the Chamilo logout button and display information about your SSO logout.<br/>
-With this plugin, you can<br/>
-- change the logout URL of the button<br/>
-- disable the logout button<br/>
-- display it in grey style<br/>
-- change the button tooltip on mouseover<br/>
-- add an alert message if user click on the button<br/>
-<br/>
-Related plugins <br/>
-Add a button to login using CAS<br/>
-Add a button to logout from CAS<br/>
-Add a button to login using FACEBOOK account<br/>
-Add a button to login using Shibboleth<br/>

+ 0 - 12
plugin/ext_auth_chamilo_logout_button_behaviour/template.tpl

@@ -1,12 +0,0 @@
-{% if ext_auth_chamilo_logout_button_behaviour.show_message %}
-    <script type="text/javascript">
-        $("#logout_button").attr('href', '{{ ext_auth_chamilo_logout_button_behaviour.link_url }}' );
-        $("#logout_button").attr('title', '{{ ext_auth_chamilo_logout_button_behaviour.link_infobulle }}' );
-        {% if ext_auth_chamilo_logout_button_behaviour.alert_onoff %}
-            $("#logout_button").attr('onclick', 'alert("{{ ext_auth_chamilo_logout_button_behaviour.alert_text }}")' );
-        {% endif %}            
-        {% if ext_auth_chamilo_logout_button_behaviour.link_image %}
-            $("#logout_button img").attr('src', '{{ "exit_na.png"|icon(22) }}');
-        {% endif %}    
-    </script>
-{% endif %}

+ 0 - 36
src/Chamilo/CoreBundle/Resources/views/default/layout/login_form.html.twig

@@ -1,36 +0,0 @@
-{% if not is_granted('IS_AUTHENTICATED_FULLY') %}
-{% if login_form %}
-    <div id="login_block" class="panel panel-default">
-        <div class="panel-body">
-        {{ login_language_form }}
-
-        {% if plugin_login_top is not null %}
-            <div id="plugin_login_top">
-                {{ plugin_login_top }}
-            </div>
-        {% endif %}
-
-        {{ login_failed }}
-        {{ login_form }}
-
-        {% if "allow_lostpassword" | get_setting == 'true' or "allow_registration" | get_setting == 'true' %}
-            <ul class="nav nav-pills nav-stacked">
-                {% if "allow_registration" | get_setting != 'false' %}
-                    <li><a href="{{ _p.web_main }}auth/inscription.php"> {{ 'SignUp' | get_lang }} </a></li>
-                {% endif %}
-
-                {% if "allow_lostpassword" | get_setting == 'true' %}
-                    <li><a href="{{ _p.web_main }}auth/lostPassword.php"> {{ 'LostPassword' | get_lang }} </a></li>
-                {% endif %}
-            </ul>
-        {% endif %}
-
-        {% if plugin_login_bottom is not null %}
-            <div id="plugin_login_bottom">
-                {{ plugin_login_bottom }}
-            </div>
-        {% endif %}
-        </div>
-    </div>
-{% endif %}
-{% endif %}

+ 244 - 0
src/Chamilo/CoreBundle/Settings/CasSettingsSchema.php

@@ -0,0 +1,244 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Settings;
+
+use Chamilo\CoreBundle\Entity\Course;
+use Chamilo\CoreBundle\Entity\Manager\CourseManager;
+use Chamilo\CoreBundle\Entity\Repository\CourseRepository;
+use Chamilo\CourseBundle\Tool\BaseTool;
+use Chamilo\CourseBundle\ToolChain;
+use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
+use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
+use Sylius\Bundle\SettingsBundle\Transformer\ObjectToIdentifierTransformer;
+use Symfony\Component\Form\FormBuilderInterface;
+use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
+
+/**
+ * Class CourseSettingsSchema
+ * @package Chamilo\CoreBundle\Settings
+ */
+class CourseSettingsSchema implements SchemaInterface
+{
+    /**
+     * @var ToolChain
+     */
+    protected $toolChain;
+
+    /**
+     * @var CourseManager
+     */
+    protected $courseManager;
+
+    public function setToolChain(ToolChain $tools)
+    {
+        $this->toolChain = $tools;
+    }
+
+    /**
+     * @param CourseManager $manager
+     */
+    public function setCourseManager($manager)
+    {
+        $this->courseManager = $manager;
+    }
+
+    /**
+     * @return array
+     */
+    public function getProcessedToolChain()
+    {
+        $tools = [];
+        /** @var BaseTool $tool */
+        foreach ($this->toolChain->getTools() as $tool) {
+            $name = $tool->getName();
+            //$key = $tool->getName();
+            $tools[$name] = $name;
+        }
+
+        return $tools;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function buildSettings(SettingsBuilderInterface $builder)
+    {
+        $tools = $this->getProcessedToolChain();
+        $em = $this->courseManager->getEntityManager();
+
+        $builder
+            ->setDefaults(
+                array(
+                    'homepage_view' => 'activity_big',
+                    'show_tool_shortcuts' => '', //?
+                    'active_tools_on_create' => $tools,
+                    'display_coursecode_in_courselist' => 'false',
+                    'display_teacher_in_courselist' => 'true',
+                    'student_view_enabled' => 'true',
+                    'go_to_course_after_login' => 'false',
+                    'show_navigation_menu' => 'false',
+                    'enable_tool_introduction' => 'false',
+                    'breadcrumbs_course_homepage' => 'course_title',
+                    'example_material_course_creation' => 'true',
+                    'allow_course_theme' => 'true',
+                    'allow_users_to_create_courses' => 'true',
+                    'show_courses_descriptions_in_catalog' => 'true',
+                    'send_email_to_admin_when_create_course' => 'false',
+                    'allow_user_course_subscription_by_course_admin' => 'true',
+                    'course_validation' => 'false',
+                    'course_validation_terms_and_conditions_url' => '',
+                    'course_hide_tools' => [],
+                    'scorm_cumulative_session_time' => 'true',
+                    'courses_default_creation_visibility' => '2',
+                    //COURSE_VISIBILITY_OPEN_PLATFORM
+                    'allow_public_certificates' => 'false',
+                    'allow_lp_return_link' => 'true',
+                    'course_creation_use_template' => '',
+                    'hide_scorm_export_link' => 'false',
+                    'hide_scorm_copy_link' => 'false',
+                    'hide_scorm_pdf_link' => 'true',
+                    'course_catalog_published' => 'false',
+                    'course_images_in_courses_list' => 'true',
+                    'teacher_can_select_course_template' => 'true',
+                    'show_toolshortcuts' => '',
+                    'enable_record_audio' => 'false'
+                )
+            )
+            ->setAllowedTypes(
+                array(
+                    'homepage_view' => array('string'),
+                    'show_tool_shortcuts' => array('string'),
+                    'active_tools_on_create' => array('array'),
+                    'course_hide_tools' => array('array'),
+                    'display_coursecode_in_courselist' => array('string'),
+                    'display_teacher_in_courselist' => array('string'),
+                    'student_view_enabled' => array('string'),
+                )
+            )
+            ->setTransformer(
+                'active_tools_on_create',
+                new ArrayToIdentifierTransformer()
+            )
+            ->setTransformer(
+                'course_hide_tools',
+                new ArrayToIdentifierTransformer()
+            )
+            ->setTransformer(
+                'course_creation_use_template',
+                new ObjectToIdentifierTransformer($em->getRepository('ChamiloCoreBundle:Course'))
+            )
+        ;
+
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function buildForm(FormBuilderInterface $builder)
+    {
+        $tools = $this->getProcessedToolChain();
+
+        $builder
+            ->add(
+                'homepage_view',
+                'choice',
+                array(
+                    'choices' => array(
+                        'activity' => 'activity',
+                        'activity_big' => 'activity_big',
+                    ),
+                )
+            )
+            ->add('show_tool_shortcuts', 'yes_no')
+            ->add(
+                'active_tools_on_create',
+                'choice',
+                array(
+                    'choices' => $tools,
+                    'multiple' => true,
+                    'expanded' => true,
+                )
+            )
+            ->add('display_coursecode_in_courselist', 'yes_no')
+            ->add('display_teacher_in_courselist', 'yes_no')
+            ->add('student_view_enabled', 'yes_no')
+            ->add('go_to_course_after_login', 'yes_no')
+            ->add(
+                'show_navigation_menu',
+                'choice',
+                array(
+                    'choices' => array(
+                        'false' => 'No',
+                        'icons' => 'IconsOnly',
+                        'text' => 'TextOnly',
+                        'iconstext' => 'IconsText',
+                    ),
+                )
+            )
+            ->add('enable_tool_introduction', 'yes_no')
+            ->add(
+                'breadcrumbs_course_homepage',
+                'choice',
+                array(
+                    'choices' => array(
+                        'course_home' => 'CourseHomepage',
+                        'course_code' => 'CourseCode',
+                        'course_title' => 'CourseTitle',
+                        'session_name_and_course_title' => 'SessionNameAndCourseTitle',
+                    ),
+                )
+            )
+            ->add('example_material_course_creation', 'yes_no')
+            ->add('allow_course_theme', 'yes_no')
+            ->add('allow_users_to_create_courses', 'yes_no')
+            ->add('show_courses_descriptions_in_catalog', 'yes_no')
+            ->add('send_email_to_admin_when_create_course', 'yes_no')
+            ->add('allow_user_course_subscription_by_course_admin', 'yes_no')
+            ->add('course_validation', 'yes_no')
+            ->add('course_validation_terms_and_conditions_url', 'url')
+            ->add(
+                'course_hide_tools',
+                'choice',
+                array(
+                    'choices' => $tools,
+                    'multiple' => true,
+                    'expanded' => true,
+                )
+            )
+            ->add('scorm_cumulative_session_time', 'yes_no')
+            ->add(
+                'courses_default_creation_visibility',
+                'choice',
+                array(
+                    'choices' => array(
+                        '3' => 'Public',
+                        '2' => 'Open',
+                        '1' => 'Private',
+                        '0' => 'Closed',
+                    ),
+                )
+            )
+            ->add('allow_public_certificates', 'yes_no')
+            ->add('allow_lp_return_link', 'yes_no')
+            ->add(
+                'course_creation_use_template',
+                'entity',
+                array(
+                    //'choices' => $courses,
+                    'class' => 'Chamilo\CoreBundle\Entity\Course',
+                    'placeholder' => 'Choose ...',
+                    'empty_data'  => null
+                )
+            )
+            ->add('hide_scorm_export_link', 'yes_no')
+            ->add('hide_scorm_copy_link', 'yes_no')
+            ->add('hide_scorm_pdf_link', 'yes_no')
+            ->add('course_catalog_published', 'yes_no')
+            ->add('course_images_in_courses_list', 'yes_no')
+            ->add('teacher_can_select_course_template', 'yes_no')
+            ->add('show_toolshortcuts', 'yes_no')
+            ->add('enable_record_audio', 'yes_no')
+        ;
+    }
+}