Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Access Plugin through URL

  • Dennis
  • Dennis's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 8 months ago #218581 by Dennis
Access Plugin through URL was created by Dennis
Hi, I would like to use an URL for a plugin, for example something like limesurvey.mydomain.org/myplugin?option=Y
Is this possible? And if so, what event to use?

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 8 months ago #218622 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL

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 following user(s) said Thank You: tassoman

Please Log in to join the conversation.

More
2 years 2 months ago #225479 by tassoman
Replied by tassoman on topic Access Plugin through URL
Ciao Denis,
using NewDirectRequest is for building public pages/routes? How can I check ACL for super-admins backend? I just set an url /admin/mypluginpage ?

«All your survey answers are belong to us »

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 2 months ago #225481 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL

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 following user(s) said Thank You: tassoman

Please Log in to join the conversation.

More
2 years 2 months ago #225489 by tassoman
Replied by tassoman on topic Access Plugin through URL
Thank you for the examples, I study on it.
I want to release a plugin for blacklisted IPs view and management. And session count.
(for example "there are XY responders online, SZ administrators)

«All your survey answers are belong to us »

Please Log in to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #225791 by tassoman
Replied by tassoman on topic Access Plugin through URL
Denis, I followed your hint and I manage to build a superuser admin link, binding a method to the pluginhelper route.

I created a "views" folder with a twig file in it, but I have this exception:

"AdminController cannot find the requested view "plugin_views_folder3.views.testPage"


I'm trying:
Code:
public funtion pageTest()
{
  return $this->renderPartial('testPage', array() , true);
}

Looks like I've triggered the wrong controller?

«All your survey answers are belong to us »
Last edit: 2 years 1 month ago by tassoman.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #225793 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL
I don't use twig for admin

But to use twig : you need to register to getPluginTwigPath

See: gitlab.com/SondagesPro/managament/respon...tAndManage.php#L2227 for a complete page.

WARNING : i have some issue currently with Login page by survey in some condition n(hard to find …)

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.

Please Log in to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #225795 by tassoman
Replied by tassoman on topic Access Plugin through URL
I got things done like this:
Code:
return $this->api->renderTwig( dirname(__FILE__) . '/views/pageTest.twig', [ "time" => time()]);

«All your survey answers are belong to us »
Last edit: 2 years 1 month ago by tassoman.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #225799 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL
It work ?

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.

Please Log in to join the conversation.

More
2 years 1 month ago #225811 by tassoman
Replied by tassoman on topic Access Plugin through URL
Yes, it works!
But now I'm unable to load custom CSS and JS ...
I will publish a full working plugin useful to monitor banned IP addresses and current sessions statistics, people voting, admins loggedin ...

«All your survey answers are belong to us »

Please Log in to join the conversation.

  • Dennis
  • Dennis's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 1 month ago - 2 years 1 month ago #225878 by Dennis
Replied by Dennis on topic Access Plugin through URL
Hhhm, I just can't get it to work. My code is very basic:
Code:
<?php
class ShowAnswers extends PluginBase {
  static protected $description = 'Show answers';
  static protected $name = 'ShowAnswers';
 
  public function init()
  {
    $this->subscribe('newDirectRequest');
  }
 
  public function newDirectRequest()
  {
    $this->api->createUrl('plugins/direct', array('plugin' => 'ShowAnswers', 'function' => 'action'));
  }
 
  public function action()
  {
    echo "We've started!";
  }
}


The plugin is loaded and I expected to access it at the URL limesurvey/index.php/plugins/ShowAnswers, but get a "The system is unable to find the requested action "ShowAnswers".

It must be something pretty basic, any ideas?
Last edit: 2 years 1 month ago by Dennis.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago - 2 years 1 month ago #225880 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL
Why use newDirectRequest to show a link ?
Url can be
Code:
limesurvey/index.php/plugins/direct/plugin/ShowAnswers
(see gitlab.com/SondagesPro/managament/respon...stAndManage.php#L354 )

Best is to use beforeToolsMenuRender
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L321

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.
Last edit: 2 years 1 month ago by DenisChenu.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose