parent
46ae5379d5
commit
539b61ed2a
@ -0,0 +1,7 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/* OLPCPeruFilter parameters that will be registered in the course settings */ |
||||
|
||||
require_once '../../main/inc/global.inc.php'; |
||||
require_once 'lib/olpc_peru_filter_plugin.class.php'; |
@ -0,0 +1,38 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* This script shows a list of options that are taken from a Squid configuration |
||||
* directory and lets the teacher choose which filter options to enable for his |
||||
* course. |
||||
*/ |
||||
/** |
||||
* Configuration settings. Update if your Squid files are somewhere else |
||||
*/ |
||||
define('BLACKLISTS_ENABLED_FILE','/var/sqg/blacklists'); |
||||
define('BLACKLISTS_DIR','/var/squidGuard/blacklists'); |
||||
/** |
||||
* Reading list |
||||
*/ |
||||
$list = scandir(BLACKLISTS_DIR); |
||||
$categories = array(); |
||||
foreach ($list as $file) { |
||||
if (substr($file,0,1) == '.' or $file == 'custom_blacklist' or is_dir(BLACKLIST_DIR.'/'.$file)) { |
||||
continue; |
||||
} |
||||
$categories[] = $file; |
||||
} |
||||
sort($categories); |
||||
/** |
||||
* Generate a checkboxes list with the names of the categories found in the |
||||
* directory. Already check if the category belongs to a $blacklist |
||||
*/ |
||||
$blacklist = file(BLACKLISTS_ENABLED_FILE); |
||||
foreach ($categories as $category) { |
||||
foreach ($blacklist as $blacklisted) { |
||||
$checked = ''; |
||||
if ($category == trim($blacklisted)) { |
||||
$checked = ' checked="checked"'; |
||||
} |
||||
echo '<input type="checkbox" name="blacklists[]" value="'.$category.'" '.$checked.'>'.$category.'</input><br />'; |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* This script is included by main/admin/settings.lib.php and generally |
||||
* includes things to execute in the main database (settings_current table) |
||||
* @package chamilo.plugin.olpc_peru_filter |
||||
*/ |
||||
/** |
||||
* Initialization |
||||
*/ |
||||
|
||||
require_once 'config.php'; |
||||
OLPCPeruFilterPlugin::create()->install(); |
||||
|
@ -0,0 +1,8 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
//Needed in order to show the plugin title |
||||
$strings['plugin_title'] = "OLPC Peru Filter plugin"; |
||||
$strings['plugin_comment'] = "Add the possibility to configure the filtering of external contents through a Squid filter on XS server of the OLPC Peru project"; |
||||
$strings['tool_enable'] = 'Enable OLPC Peru Filter'; |
||||
$strings['tool_enable_help'] = "When this option is enabled, a new configuration section will appear in the course configuration settings, which will allow you to select categories of contents for filtering through Squid on an XS school server of the OLPC Peru project (this can easily be extended to other servers)"; |
||||
|
@ -0,0 +1,8 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
//Needed in order to show the plugin title |
||||
$strings['plugin_title'] = "Plugin para filtro de OLPC Peru"; |
||||
$strings['plugin_comment'] = "Añadir la posibilidad de configurar el filtrado de contenidos externos a través del filtro Squid de un servidor XS del proyecto OLPC Perú"; |
||||
$strings['tool_enable'] = 'Activar filtro OLPC Perú'; |
||||
$strings['tool_enable_help'] = "Cuando esta opción esté activada, una nueva sección de configuración aparecerá en los parámetros de configuración, lo que le permitirá de seleccionar categorías de contenidos para filtrar a través de Squid en un servidor XS de escuela dentro del proyecto OLPC Perú (podría ser extendido a otros servidores)"; |
||||
|
@ -0,0 +1,48 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/* To show the plugin course icons you need to add these icons: |
||||
* main/img/icons/22/plugin_name.png |
||||
* main/img/icons/64/plugin_name.png |
||||
* main/img/icons/64/plugin_name_na.png |
||||
*/ |
||||
class OLPC_Peru_FilterPlugin extends Plugin |
||||
{ |
||||
|
||||
//When creating a new course, these settings are added to the course |
||||
public $course_settings = array( |
||||
// array('name' => 'big_blue_button_welcome_message', 'type' => 'text'), |
||||
// array('name' => 'big_blue_button_record_and_store', 'type' => 'checkbox') |
||||
); |
||||
|
||||
static function create() { |
||||
static $result = null; |
||||
return $result ? $result : $result = new self(); |
||||
} |
||||
|
||||
protected function __construct() { |
||||
parent::__construct('0.1', 'Yannick Warnier, Aliosh Neira', array('tool_enable' => 'boolean')); |
||||
} |
||||
|
||||
function install() { |
||||
//Installing course settings |
||||
$this->install_course_fields_in_all_courses(); |
||||
} |
||||
|
||||
function uninstall() { |
||||
$t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
||||
$t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS); |
||||
//New settings |
||||
/* |
||||
$sql = "DELETE FROM $t_settings WHERE variable = 'olpc_peru_filter_tool_enable'"; |
||||
Database::query($sql); |
||||
//Old settings deleting just in case |
||||
$sql = "DELETE FROM $t_settings WHERE variable = 'olpc_peru_filter_plugin'"; |
||||
Database::query($sql); |
||||
$sql = "DELETE FROM $t_options WHERE variable = 'olpc_peru_filter_plugin'"; |
||||
Database::query($sql); |
||||
*/ |
||||
//Deleting course settings |
||||
$this->uninstall_course_fields_in_all_courses(); |
||||
} |
||||
} |
@ -0,0 +1,4 @@ |
||||
<?php |
||||
$course_plugin = 'olpc_peru_filter'; //needed in order to load the plugin lang variables |
||||
require_once 'config.php'; |
||||
$plugin_info = OLPC_Peru_FilterPlugin::create()->get_info(); |
@ -0,0 +1 @@ |
||||
This plugin will create administration settings to configure the content filtering on OLPC Peru's XS servers (uses Squid). |
@ -0,0 +1,13 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* This script is included by main/admin/settings.lib.php when unselecting a |
||||
* plugin and is meant to remove things installed by the install.php script |
||||
* in both the global database and the courses tables |
||||
* @package chamilo.plugin.olpc_peru_filter |
||||
*/ |
||||
/** |
||||
* Queries |
||||
*/ |
||||
require_once 'config.php'; |
||||
OLPCPeruFilterPlugin::create()->uninstall(); |
Loading…
Reference in new issue