-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev Added automatic timestamping for fields created/modified in LSAct…
…iveRecordTables Dev Added AuditLog plugin base
- Loading branch information
Showing
5 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
class AuditLog extends PluginBase { | ||
|
||
protected $storage = 'DbStorage'; | ||
static protected $description = 'Example plugin'; | ||
|
||
protected $settings = array( | ||
'logo' => array( | ||
'type' => 'logo', | ||
'path' => 'assets/logo.png' | ||
), | ||
'message' => array( | ||
'type' => 'string', | ||
'label' => 'Message' | ||
) | ||
); | ||
|
||
public function __construct(PluginManager $manager, $id) { | ||
parent::__construct($manager, $id); | ||
|
||
|
||
/** | ||
* Here you should handle subscribing to the events your plugin will handle | ||
*/ | ||
//$this->subscribe('afterPluginLoad', 'helloWorld'); | ||
$this->subscribe('beforeSurveySettings'); | ||
$this->subscribe('newSurveySettings'); | ||
} | ||
|
||
/** | ||
* This event is fired by the administration panel to gather extra settings | ||
* available for a survey. | ||
* The plugin should return setting meta data. | ||
* @param PluginEvent $event | ||
*/ | ||
public function beforeSurveySettings(PluginEvent $event) | ||
{ | ||
$event->set("surveysettings.{$this->id}", array( | ||
'name' => get_class($this), | ||
'settings' => array( | ||
'auditing' => array( | ||
'type' => 'select', | ||
'options'=>array(0=>'No', | ||
1=>'Yes'), | ||
'default'=>0, | ||
'tab'=>'notification', // @todo: Setting no used yet | ||
'category'=>'Auditing for person-related data', // @todo: Setting no used yet | ||
'label' => 'Audit log for this survey:', | ||
'current' => $this->get('auditing', 'Survey', $event->get('survey')) | ||
) | ||
) | ||
)); | ||
} | ||
|
||
public function newSurveySettings(PluginEvent $event) | ||
{ | ||
foreach ($event->get('settings') as $name => $value) | ||
{ | ||
$this->set($name, $value, 'Survey', $event->get('survey')); | ||
} | ||
} | ||
|
||
} |
Empty file.