- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Create a new view in plugin
- elvey
- Topic Author
- Offline
- New Member
Would someone be able to point me towards the appropriate resources for this task? Thanks you
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13637
- Thank you received: 2491
There are no existing included solution actually, have some hack to do it actually
Starting by
$aData['clang'] = $clang = Yii::app()->lang; $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl'); $aData['surveyid']=$aData['iSurveyID']=$aData['iSurveyId'] = $this->iSurveyId; $sViewPath = '/admin/survey'; $oAdminController=new AdminController('admin'); $oCommonAction = new Survey_Common_Action($oAdminController,'survey');
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
- elvey
- Topic Author
- Offline
- New Member
- Posts: 2
- Thank you received: 0
I am guessing this is creating a new action which is then saved to the admin controller. However I am unsure where the action code is set. Is there a parameter I can use to set a callback method? Otherwise I see most existing actions have classes that extend Survey_Common_Action in application/controllers/admin so could I create another class such as this that can be loaded from within my plugin directory?
Finally I'm not sure what to do with $sViewPath. Should this be set in $aData?
- atlet
- Offline
- New Member
- Posts: 1
- Thank you received: 0
elvey wrote: Thanks for your help. I will however ask for a little more guidance if possible.
I am guessing this is creating a new action which is then saved to the admin controller. However I am unsure where the action code is set. Is there a parameter I can use to set a callback method? Otherwise I see most existing actions have classes that extend Survey_Common_Action in application/controllers/admin so could I create another class such as this that can be loaded from within my plugin directory?
Finally I'm not sure what to do with $sViewPath. Should this be set in $aData?
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13637
- Thank you received: 2491
private function displayContent($aData=false) { if(!$aData){$aData=array();} $aData['clang'] = $clang = Yii::app()->lang; $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl'); $aData['surveyid']=$aData['iSurveyID']=$aData['iSurveyId'] = $this->iSurveyId; $sViewPath = '/admin/survey'; $oAdminController=new AdminController('admin'); $oCommonAction = new Survey_Common_Action($oAdminController,'survey'); ob_start(); //header("Content-type: text/html; charset=UTF-8"); // needed for correct UTF-8 encoding $oAdminController->_getAdminHeader(); $oAdminController->_showadminmenu($this->iSurveyId); if($this->iSurveyId) $oCommonAction->_surveybar($this->iSurveyId); if($this->fContent){ self::render($this->fContent,$aData);// Surely better with ->render .... } $oAdminController->_loadEndScripts(); $oAdminController->_getAdminFooter('http://manual.limesurvey.org', $clang->gT('LimeSurvey online manual')); $sOutput = ob_get_contents(); ob_clean(); App()->getClientScript()->render($sOutput); echo $sOutput; Yii::app()->end(); } private function render($file,$aData=false){ if($aData) { foreach($aData as $data=>$value){ $$data=$value; } } include_once(dirname(__FILE__)."/".$this->fContent);// Surely better with ->render .... }
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
- sparkbird
- Offline
- New Member
- Posts: 1
- Thank you received: 2
manual.limesurvey.org/Add_new_menu_and_view_by_a_plugin
- david2013
- Offline
- Senior Member
- Posts: 42
- Thank you received: 6
When I download it using latest version. I doesn't work. After I change the line below, it works for me
'href' => "plugins/direct/rewards?function=assignRewards",
'href' => $this->api->createUrl('plugins/direct', array('plugin' => 'Rewards', 'function' => 'assignRewards')),
- jdd2405
- Offline
- New Member
- Posts: 1
- Thank you received: 0
Anyway, the admin menu item only shows up when visiting the plugins page. On the admin start page and all the other admin pages there is no additional menu item visible. Why is that?
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13637
- Thank you received: 2491
Because only plugin page use the new menu extension.jdd2405 wrote: Anyway, the admin menu item only shows up when visiting the plugins page. On the admin start page and all the other admin pages there is no additional menu item visible. Why is that?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
- Mazi
- Offline
- Official LimeSurvey Partner
I think I once saw an example but can't find it...
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13637
- Thank you received: 2491
if(Permission::model()->hasSurveyPermission($surveyid,'yourpermission')){ //Add the menu }
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
- Mazi
- Offline
- Official LimeSurvey Partner
I'll just ping you for some plugin development soonDenisChenu wrote:
Code:if(Permission::model()->hasSurveyPermission($surveyid,'yourpermission')){ //Add the menu }
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com