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

plugins/generic/addThis/AddThisSettingsForm.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.form.Form');
00016 
00017 class AddThisSettingsForm extends Form {
00019    var $_press;
00020 
00022    var $_plugin;
00023 
00027    function AddThisSettingsForm(&$plugin, &$press) {
00028       parent::Form($plugin->getTemplatePath() . 'settings.tpl');
00029       $this->setPress($press);
00030       $this->setPlugin($plugin);
00031 
00032       // Validation checks for this form
00033       $this->addCheck(new FormValidatorPost($this));
00034    }
00035 
00036    //
00037    // Getters and Setters
00038    //
00043    function &getPress() {
00044       return $this->_press;
00045    }
00046 
00051    function setPress($press) {
00052       $this->_press =& $press;
00053    }
00054 
00059    function &getPlugin() {
00060       return $this->_plugin;
00061    }
00062 
00067    function setPlugin($plugin) {
00068       $this->_plugin =& $plugin;
00069    }
00070 
00071    //
00072    // Overridden template methods
00073    //
00077    function initData() {
00078       $plugin =& $this->getPlugin();
00079       $press =& $this->getPress();
00080 
00081       if (isset($plugin)) {
00082          $this->_data = array(
00083             'addThisProfileId' => $press->getSetting('addThisProfileId'),
00084             'addThisUsername' => $press->getSetting('addThisUsername'),
00085             'addThisPassword' => $press->getSetting('addThisPassword'),
00086             'addThisDisplayStyle' => $press->getSetting('addThisDisplayStyle'),
00087          );
00088       }
00089    }
00090 
00095    function fetch(&$request) {
00096       $plugin =& $this->getPlugin();
00097       $press =& $this->getPress();
00098 
00099       $templateMgr =& TemplateManager::getManager();
00100       $templateMgr->assign('pluginName', $plugin->getName());
00101       $templateMgr->assign('pluginBaseUrl', $request->getBaseUrl() . '/' . $plugin->getPluginPath());
00102 
00103       $displayStyles = array(
00104          'small_toolbox' => 'img/toolbox-small.png',
00105          'plus_one_share_counter' => 'img/plusone-share.gif',
00106          'small_toolbox_with_share' => 'img/small-toolbox.jpg',
00107          'large_toolbox' => 'img/toolbox-large.png',
00108          'simple_button' => 'img/share.jpg',
00109          'button' => 'img/button.jpg',
00110       );
00111 
00112       $templateMgr->assign('displayStyles', $displayStyles);
00113 
00114       foreach ($this->_data as $key => $value) {
00115          $templateMgr->assign($key, $value);
00116       }
00117 
00118       return $templateMgr->fetch($plugin->getTemplatePath() . 'settings.tpl');
00119    }
00120 
00125    function readInputData() {
00126       $this->readUserVars(array(
00127          'addThisDisplayStyle',
00128          'addThisUsername',
00129          'addThisPassword',
00130          'addThisProfileId',
00131       ));
00132    }
00133 
00138    function execute() {
00139       $plugin =& $this->getPlugin();
00140       $press =& $this->getPress();
00141 
00142       $press->updateSetting('addThisDisplayStyle', trim($this->getData('addThisDisplayStyle'), "\"\';"), 'string');
00143       $press->updateSetting('addThisProfileId', trim($this->getData('addThisProfileId'), "\"\';"), 'string');
00144       $press->updateSetting('addThisUsername', trim($this->getData('addThisUsername'), "\"\';"), 'string');
00145       $press->updateSetting('addThisPassword', trim($this->getData('addThisPassword'), "\"\';"), 'string');
00146    }
00147 }
00148 ?>

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