• Main Page
  • Modules
  • Classes
  • Files
  • File List

classes/plugins/ImportExportPlugin.inc.php

00001 <?php
00002 
00017 import('classes.plugins.Plugin');
00018 
00019 class ImportExportPlugin extends Plugin {
00020    function ImportExportPlugin() {
00021       parent::Plugin();
00022    }
00023 
00029    function getName() {
00030       assert(false); // Should always be overridden
00031    }
00032 
00038    function getDisplayName() {
00039       assert(false); // Should always be overridden
00040    }
00041 
00045    function getDescription() {
00046       assert(false); // Should always be overridden
00047    }
00048 
00053    function display(&$args) {
00054       $templateManager =& TemplateManager::getManager();
00055       $templateManager->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
00056    }
00057 
00063    function executeCLI($scriptName, &$args) {
00064       $this->usage();
00065       // Implemented by subclasses
00066    }
00067 
00071    function usage($scriptName) {
00072       // Implemented by subclasses
00073    }
00074 
00078    function getManagementVerbs() {
00079       return array(
00080          array(
00081             'importexport',
00082             __('manager.importExport')
00083          )
00084       );
00085    }
00086 
00090    function getManagementVerbLinkAction(&$request, $verb, $defaultUrl) {
00091       $router =& $request->getRouter();
00092       $dispatcher =& $router->getDispatcher();
00093 
00094       list($verbName, $verbLocaleKey) = $verb;
00095 
00096       switch($verbName) {
00097          case 'importexport':
00098             import('lib.pkp.classes.linkAction.request.RedirectAction');
00099             $actionRequest = new RedirectAction($dispatcher->url($request, ROUTE_PAGE, null, 'manager',
00100                'importexport', array('plugin', $this->getName())));
00101 
00102             $linkAction = new LinkAction(
00103                $verbName,
00104                $actionRequest,
00105                $verbLocaleKey,
00106                null
00107             );
00108 
00109             return $linkAction;
00110          default:
00111             return array();
00112       }
00113    }
00114 
00118    function manage($verb, $args) {
00119       if ($verb === 'importexport') {
00120          $request->redirectUrl($this->getManagementVerbUrl($verb));
00121       }
00122       return false;
00123    }
00124 
00128    function smartyPluginUrl($params, &$smarty) {
00129       $path = array('plugin', $this->getName());
00130       if (is_array($params['path'])) {
00131          $params['path'] = array_merge($path, $params['path']);
00132       } elseif (!empty($params['path'])) {
00133          $params['path'] = array_merge($path, array($params['path']));
00134       } else {
00135          $params['path'] = $path;
00136       }
00137       return $smarty->smartyUrl($params, $smarty);
00138    }
00139 
00140 }
00141 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1