- Posts: 85
- Thank you received: 9
Ask the community, share ideas, and connect with other LimeSurvey users!
class AddAdminFields extends PluginBase { protected $storage = 'DbStorage'; static protected $name = 'Add Fields to Admin'; static protected $description = 'Add Fields to Admin Screens on surveys'; protected $settings = array( 'ClientName' => array( 'type' => 'text', 'content' => 'Add the Client Name', ), 'ProjectManager' => array( 'type' => 'text', 'content' => 'Add the Project Manager Name', ), 'Tel' => array( 'type' => 'text', 'content' => 'Add the Managers Tel:', ), ); public function init() { $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() { $event = $this->event; $event->set("surveysettings.{$this->id}", array( 'name' => get_class($this), 'settings' => array( 'ClientName'=>array( 'type'=>'text', 'label'=>'Client Name', 'help'=>'Enter the Client Name.', 'current' => $this->get('ClientName', 'Survey', $event->get('survey'),$this->get('ClientName',null,null,$this->settings['ClientName']['default'])), ), 'ProjectManager'=>array( 'type'=>'text', 'label'=>'Project Manager', 'help'=>'Project Managers Name', 'current' => $this->get('ProjectManger', 'Survey', $event->get('survey'),$this->get('ProjectManager',null,null,$this->settings['ProjectManager']['default'])), ), 'Tel'=>array( 'type'=>'text', 'label'=>'Telephone', 'help'=>'Enter Telephone No..', 'current' => $this->get('Tel', 'Survey', $event->get('survey'),$this->get('Tel',null,null,$this->settings['Tel']['default'])), ) ) )); } public function newSurveySettings() { $event = $this->event; foreach ($event->get('settings') as $name => $value) { /* In order use survey setting, if not set, use global, if not set use default */ $default=$event->get($name,null,null,isset($this->settings[$name]['default'])?$this->settings[$name]['default']:NULL); $this->set($name, $value, 'Survey', $event->get('survey'),$default); } } }
I'm not able to offer a good solution …1. Columns on the Survey List Page - After Survey Name
'm not able to offer a good solution …2. Above the Welcome Text on the Survey Display Page: (they are not publically available just internal).