- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Tutorial how to create admin menu entry that is calling custom PHP script
- nkamp01
- Topic Author
- Offline
- New Member
Less
More
3 years 3 months ago #210684
by nkamp01
Tutorial how to create admin menu entry that is calling custom PHP script was created by nkamp01
Hello,
If I google on manual/Tutorial about limesurvey plugin (and/or development), I find 'old documentation of 5 years ago like that from Reportico (PHP 5.3).
So is there a new more recent documentation to build a plugin for limesurvey?
Also when I search on the official plugin page, there are old plugins for limesurvey version 2.05 but I'm using limesurvey 3.25.
My feeling is that the documentation is not up to date or do I not search good enough?
We have python scripts to anylyse the assessment data. But for now this is running from the commandline (Linux).
What I like todo is
I have PHP 7.4.14, LimeSurvey 3.25
I hope that someone can help me a bit further.
Nico
If I google on manual/Tutorial about limesurvey plugin (and/or development), I find 'old documentation of 5 years ago like that from Reportico (PHP 5.3).
So is there a new more recent documentation to build a plugin for limesurvey?
Also when I search on the official plugin page, there are old plugins for limesurvey version 2.05 but I'm using limesurvey 3.25.
My feeling is that the documentation is not up to date or do I not search good enough?
We have python scripts to anylyse the assessment data. But for now this is running from the commandline (Linux).
What I like todo is
- add a new main menu item at the admin site "Assessment Result" for example, with a submenu item "analyse assessment"
- When I click on the menu item "analyse assessment", an page is openend with three fields to fill in by the user. and a start button.
- When I press the start button, submit to the server and from the PHP code the python scripts are executed.
- The python scripts are now creating an html page, I hope that I can embed in page of limesurvey, so that you can see the result in LimeSurvey.
I have PHP 7.4.14, LimeSurvey 3.25
I hope that someone can help me a bit further.
Nico
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13647
- Thank you received: 2491
3 years 3 months ago #210692
by DenisChenu
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.
Replied by DenisChenu on topic Tutorial how to create admin menu entry that is calling custom PHP script
Did you look at core plugins ?
There are some in demo directory
Else : manual.limesurvey.org/Available_third_party_plugins is a better list for uptodate plugins
Else
There are some in demo directory
Else : manual.limesurvey.org/Available_third_party_plugins is a better list for uptodate plugins
Else
- manual.limesurvey.org/BeforeToolsMenuRender or create a right menu : gitlab.com/SondagesPro/managament/respon...tAndManage.php#L1770
- Why not use survey settings ? manual.limesurvey.org/BeforeSurveySettings else : github.com/LimeSurvey/LimeSurvey/blob/03...PluginHelper.php#L21
- manual.limesurvey.org/NewSurveySettings or PluginHelper
- python is not PHP …
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.
The topic has been locked.
- nkamp01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
3 years 3 months ago #210709
by nkamp01
Replied by nkamp01 on topic Tutorial how to create admin menu entry that is calling custom PHP script
Thanks DenisChenu.
I've been through the Available_third_party plugins, but these have been changed in 2014 if I go to github.
And the others, is going to github with an PHP file, but then? No explanation or what I can or should do.
There is in plugin directory an directory "Example". But can activate that plugin? How? Were can I find the documentation about this?
I know python is something different than PHP.
I have changed my mind a little. I want to add a button at the survey bar, see my screenshot. And when I press on that button than it should do what I have written were this thread is started with.
I have found in the files:
If I'm not looking at right place than it's my fault, but for me now it's hard to find, sorry.
I've been through the Available_third_party plugins, but these have been changed in 2014 if I go to github.
And the others, is going to github with an PHP file, but then? No explanation or what I can or should do.
There is in plugin directory an directory "Example". But can activate that plugin? How? Were can I find the documentation about this?
I know python is something different than PHP.
I have changed my mind a little. I want to add a button at the survey bar, see my screenshot. And when I press on that button than it should do what I have written were this thread is started with.
I have found in the files:
- htdocs\limesurvey\application\views\admin\survey\surveybar_view.php
Code:
<!-- Extra menus from plugins --> <?php App()->getController()->renderPartial( '/admin/survey/surveybar_plugins', [ 'beforeSurveyBarRender' => $beforeSurveyBarRender ] ); ?>
- htdocs\limesurvey\application\views\admin\survey\surveybar_plugins.php. I expect that the array $beforeSurveyBarRender will be filled with menu items of plugins. But were do I place these plugins? I mean in the limesurvey/plugin directory or htdocs\limesurvey\application\core\plugins\
If I'm not looking at right place than it's my fault, but for me now it's hard to find, sorry.
Attachments:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13647
- Thank you received: 2491
3 years 3 months ago #210762
by DenisChenu
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.
Replied by DenisChenu on topic Tutorial how to create admin menu entry that is calling custom PHP script
All my plugins are free like a speech …
> I hope that someone can help me with some to documentation how to add a plugin and activate it.
extensions.sondages.pro/about/install-an...-for-limesurvey.html
> I hope that someone can help me with some to documentation how to add a plugin and activate it.
extensions.sondages.pro/about/install-an...-for-limesurvey.html
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.
The topic has been locked.
- nkamp01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
3 years 3 months ago #210773
by nkamp01
Replied by nkamp01 on topic Tutorial how to create admin menu entry that is calling custom PHP script
Hello DenisChenu,
I have seen these, I have tried three plugins, but till now, I can't find were I'm looking for.
I have just installed "export all answers", try to activate and than I get the error message "class 'exportCompleteAnswers' does not have a method 'beforeActivate'".
But is there an document or another plugin, that is adding a button at the top-menu bar of the survey, so that I can look at that one how that needs to be done?
There is an array named "$beforeSurveyBarRender", so this means in my opinion that there are specific plugins for the survey page.
Does anyone know a plugin for the survey page?
I have seen these, I have tried three plugins, but till now, I can't find were I'm looking for.
I have just installed "export all answers", try to activate and than I get the error message "class 'exportCompleteAnswers' does not have a method 'beforeActivate'".
But is there an document or another plugin, that is adding a button at the top-menu bar of the survey, so that I can look at that one how that needs to be done?
There is an array named "$beforeSurveyBarRender", so this means in my opinion that there are specific plugins for the survey page.
Does anyone know a plugin for the survey page?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13647
- Thank you received: 2491
3 years 3 months ago #210782
by DenisChenu
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.
Replied by DenisChenu on topic Tutorial how to create admin menu entry that is calling custom PHP script
> I have just installed "export all answers", try to activate and than I get the error message "class 'exportCompleteAnswers' does not have a method 'beforeActivate'".
LimeSurvey version and buildnumber ?
How you can have this ? Way to reproduce ?
LimeSurvey version and buildnumber ?
How you can have this ? Way to reproduce ?
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.
The topic has been locked.
- nkamp01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
3 years 3 months ago #210796
by nkamp01
Replied by nkamp01 on topic Tutorial how to create admin menu entry that is calling custom PHP script
LS Version: 3.25.8+210118.
Download the plugin, unzip, put in the plugin directory, remove "-master" from the dir name.
Than go to the plugin manager, try to activate and I got the error.
PHP version 7.4.xx.
But I was hoping that you could point to a plugin which is adding a menu button at the top-bar menu of the Survey page. Or point me to documentation how I can do this...
Download the plugin, unzip, put in the plugin directory, remove "-master" from the dir name.
Than go to the plugin manager, try to activate and I got the error.
PHP version 7.4.xx.
But I was hoping that you could point to a plugin which is adding a menu button at the top-bar menu of the Survey page. Or point me to documentation how I can do this...
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13647
- Thank you received: 2491
3 years 3 months ago #210798
by DenisChenu
Only way : tool menu or left menu (via DB update)
Else : fixed : gitlab.com/SondagesPro/ExportAndStats/ex...3a9b6016b9aca1a4e4c1
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.
Replied by DenisChenu on topic Tutorial how to create admin menu entry that is calling custom PHP script
No way except javascript hacking.But I was hoping that you could point to a plugin which is adding a menu button at the top-bar menu of the Survey page. Or point me to documentation how I can do this...
Only way : tool menu or left menu (via DB update)
Else : fixed : gitlab.com/SondagesPro/ExportAndStats/ex...3a9b6016b9aca1a4e4c1
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.
The topic has been locked.
- nkamp01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
3 years 3 months ago #210809
by nkamp01
Replied by nkamp01 on topic Tutorial how to create admin menu entry that is calling custom PHP script
Maybe I'm something wrong but I cant't activate the plugin by now due:
If I doing something wrong or I'm not looking at the right place, i hope than tell me.
Only were I'm looking for is:
Code:
call_user_func() expects parameter 1 to be a valid callback, class 'exportCompleteAnswers' does not have a method 'beforeActivate'C:\Program_Files_Portable\xampp\htdocs\limesurvey\application\libraries\PluginManager\PluginManager.php(185)173 */ 174 public function dispatchEvent(PluginEvent $event, $target = array()) 175 { 176 $eventName = $event->getEventName(); 177 if (is_string($target)) { 178 $target = array($target); 179 } 180 if (isset($this->subscriptions[$eventName])) { 181 foreach ($this->subscriptions[$eventName] as $subscription) { 182 if (!$event->isStopped() 183 && (empty($target) || in_array(get_class($subscription[0]), $target))) { 184 $subscription[0]->setEvent($event); 185 [color=#e74c3c][b]call_user_func($subscription);[/b][/color] 186 } 187 } 188 } 189 190 return $event; 191 } 192 193 /** 194 * Scans the plugin directory for plugins. 195 * This function is not efficient so should only be used in the admin interface 196 * that specifically deals with enabling / disabling plugins. 197 */
If I doing something wrong or I'm not looking at the right place, i hope than tell me.
Only were I'm looking for is:
- adding a button at the top-menu bar of the survey page.
- and when the user click on that button, new functionality created by me will placed at that survey page with cobweb and / or barchart based on the assesment data
- I suppose that needs to be done by an plugin, so that if we update limesurvey to a new version, these functionality is not lost.
The topic has been locked.