Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/plugin/resubscription/src/Resubscription.php

78 lines
1.6 KiB

<?php
/* For licensing terms, see /license.txt */
/**
* Limit session resubscriptions
*
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
class Resubscription extends Plugin implements HookPluginInterface
{
/**
* Class constructor
*/
protected function __construct()
{
$options = array(
'calendar_year' => get_lang('CalendarYear'),
'natural_year' => get_lang('NaturalYear')
);
$parameters = array(
'resubscription_limit' => array(
'type' => 'select',
'options' => $options
)
);
parent::__construct('0.1', 'Imanol Losada Oriol', $parameters);
}
/**
* Instance the plugin
* @staticvar null $result
* @return Resubscription
*/
static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* Install the plugin
*/
public function install()
{
$this->installHook();
}
/**
* Uninstall the plugin
* @return void
*/
public function uninstall()
{
$this->uninstallHook();
}
/**
* Install the Resubscription hook
*/
public function installHook()
{
$hook = HookResubscription::create();
HookResubscribe::create()->attach($hook);
}
/**
* Uninstall the Resubscription hook
*/
public function uninstallHook()
{
$hook = HookResubscription::create();
HookResubscribe::create()->detach($hook);
}
}