classes/plugins/Plugin.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 // $Id$
00016 
00017 
00018 import('plugins.PKPPlugin');
00019 
00020 class Plugin extends PKPPlugin {
00024    function Plugin() {
00025       parent::PKPPlugin();
00026    }
00027 
00028    function getTemplatePath() {
00029       $basePath = dirname(dirname(dirname(__FILE__)));
00030       return "file:$basePath/" . $this->getPluginPath() . '/';
00031    }
00032 
00041    function register($category, $path) {
00042       $returner = parent::register($category, $path);
00043       if ($this->getNewConferencePluginSettingsFile()) {
00044          HookRegistry::register ('ConferenceSiteSettingsForm::execute', array(&$this, 'installConferenceSettings'));
00045       }
00046       return $returner;
00047    }
00048 
00049    function getSetting($conferenceId, $schedConfId, $name) {
00050       if (!Config::getVar('general', 'installed')) return null;
00051       $pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
00052       return $pluginSettingsDao->getSetting($conferenceId, $schedConfId, $this->getName(), $name);
00053    }
00054 
00063    function updateSetting($conferenceId, $schedConfId, $name, $value, $type = null) {
00064       $pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
00065       $pluginSettingsDao->updateSetting($conferenceId, $schedConfId, $this->getName(), $name, $value, $type);
00066    }
00067 
00074    function getNewConferencePluginSettingsFile() {
00075       return null;
00076    }
00077 
00084    function installConferenceSettings($hookName, $args) {
00085       $conference =& $args[1];
00086 
00087       $pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
00088       $pluginSettingsDao->installSettings($conference->getId(), 0, $this->getName(), $this->getNewConferencePluginSettingsFile());
00089 
00090       return false;
00091    }
00092 
00099    function installSiteSettings($hookName, $args) {
00100       $installer =& $args[0];
00101       $result =& $args[1];
00102 
00103       $pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
00104       $pluginSettingsDao->installSettings(0, 0, $this->getName(), $this->getInstallSitePluginSettingsFile());
00105 
00106       return false;
00107    }
00108    
00113    function getCurrentVersion() {
00114       $versionDao =& DAORegistry::getDAO('VersionDAO'); 
00115       $product = basename($this->getPluginPath());
00116       $installedPlugin = $versionDao->getCurrentVersion($product);
00117       
00118       if ($installedPlugin) {
00119          return $installedPlugin;
00120       } else {
00121          return false;
00122       }
00123    }
00124 }
00125 
00126 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7