How to trigger callback in moodle 3.6 (PHP) - php

We have 2 application one is main application and second is moodle 3.6, we want to trigger a callback from Moodle to our main application when a user starts a course or complete a course, How to implement this functionality.
Thanks in advance.

You may code it along this lines:
Create a plugin for Moodle, if you are just handling this "event emission" thing, you may just make a "local plugin" (https://docs.moodle.org/dev/Local_plugins). I recommend you to use a plugin skeleton generator to generate the boilerplate code for the plugin: https://moodle.org/plugins/tool_pluginskel
In your plugin, register the event observers for the relevant core events (documentation here: https://docs.moodle.org/dev/Event_2#Event_observers ). For example: course_completed would be an straightforward one according to your needs. You have a list of events here: https://docs.moodle.org/dev/Event_2#Existing_events .
From the listener method linked to the observer you can make the relevant external calls to your main app.

Related

Bigcommerce custom private apps development storefront content injection blueprint and stencil

I am trying to create a custom private app for my client, this app will interact in the storefront.
eg. I need to put a button on storefront product page and when that button click popup will show and the content of popup will come from my private app website.
The problem in broad is I cannot find a documentation wherein it will discuss all for eg. how to support blueprint and stencil for UI or content that I'll inject on the storefront.
By the way, I already successfully setup the hello-world-app-php-silex.
The specific problem that I am facing now is I am able to inject the content( button and bootstrap modal ) for blueprint framework, however, I cannot make it works on the stencil.
Any suggestion or tutorial link?
Thanks!
BigCommerce recently released the ability to programmatically inject scrpts on Stencil using the Script API here is the API documentation and guidelines on how to approach the blueprint vs stencil
https://developer.bigcommerce.com/api/v3/scripts.html
Also, you can find some examples on injecting snippets by editing theme files here:
https://stencil.bigcommerce.com/docs/checkout-injection#footer however, using the API is highly recommended. That way the theme can be kept on the upgrade path.
I hope that helps.

Using the Asana API, how can I create a project based on a custom template?

I would like to programmatically add projects, based on a default custom template we have already made in Asana. Is this possible?
verheul, sorry for the delay - we had a little bit of connection issues in tying together all our channels.
We don't have any API feature for programmatically using an Asana template to create a project, but I've added this request to our API backlog. The best workaround that I can think to offer you right now is to have your program copy the template itself; that is, create a new project, then for each task in the template, create a new task just like it in the new project. In essence, write the template copy functionality that uses the Asana template as the source.
Our API documentation should be of some help here, and although this is a bit of a workaround, hopefully this will help you get moving!

Create custom notification event Carttrob

If I need to create a custom notification event, that sends an email when the user arrives to the ORDER SUMMARY page (coming from CHECKOUT page, but I don't think that matter) what should I do?
I found this on the documentation: https://www.cartthrob.com/docs/developers/notifications/index.html#registering-an-event
But is necessary to create an extension or a module only for an event?
Can you provide me a very basic example on how can I create an event and how can I call it on the order_summary.html ? Maybe an EE tag?
(I'm with Vector, the people behind CartThrob)
You'll definitely need some kind of custom code to create a custom event. Typically yes, that'd be in the form of an extension or module.
That said, it doesn't need to necessarily be a CartThrob notification in your case. Something like this might work: https://devot-ee.com/add-ons/email-from-template
If you want to use CartThrob notifications, you'd have your custom module or extension add the notification type to CartThrob as shown on the page you linked. Then on the summary page you'd have a tag from your custom module, and that tag's logic would fire the notification.
If you need more help with this it's certainly something we can build for you. Feel free to email us at support#cartthrob.com!

Feature Toggles in Symfony

Our Symfony application is currently one application, that will soon require ability to have multiple sites point to the same Symfony core and have slightly different functionality based on which site it is currently on.
As an example we might have a banner showing on one site but not another. Another example is a payment option that will be enabled/disabled on the different sites. Or another one is different fields on a form on the different sites.
Has anybody had experience structuring Symfony application in this way?
If you want to "theme" your application you can use the LiipThemeBundle, it really works well. For the features activation/deactivation you also have the FeatureToggleBundle bundle (quiet recent).
You could also implement a basic helper like this:
/**
* Check if a feature is activated.
*
* #param string $feature Name of the feature
*
* #throws AccessDeniedHttpException
*/
protected function checkFeature($feature)
{
$features = $this->container->getParameter('app.features')
if (!$features[$feature]) {
throw new AccessDeniedHttpException();
}
}
...
$this->checkFeature('contact_form');
With this kind of configuration:
app.features:
contact_form: false
You have to know that using kernel event listener you can do most of the work.
You can in a 'CoreBundle' for example refer the user to a different template depending on the domain name where he is, using the kernel.request event.
So in your situation it would be easy for a site to showing a banner in a site but not another.
You can look this article that explains it :
Twig templating using event listener
Yess thats the advantage of symfony
symfony use the kernel connected with routing and controller and then response is being created.
If you want to use multiple applications in symfony you can do this very easily and that is an advantage of symfony.For this you just need to add some routing and everything will be done automatically.
You can use symfony form class to add forms and append them to other pages with required field without creating whole form again.
If you want to add or remove some features on/off you can just do this by app class or by creating different controllers.

Joomla Events Override

Is it possible for plugins to block System Events in Joomla? I'm currently using a url rewriting plugin and the onAfterRoute event does not seem to be called (which I need for another plugin)
Thanks
Plugins shouldn't be blocking the onAfterRoute event. However, plugins responding to that event must be published after they are installed.
Also, onAfterRoute is called after the URL is parsed and variables have been pushed into JRequest. Is this this point where you're wanting the plugin to be called, or does it need to come before onAfterRoute?
Does the other plugin (the one that uses onAfterRoute) work if you disable the URL rewriting plugin? If not, then that's not the problem.
If it does, then I suggest you look at the plugin and find the bit that targets onAfterRoute to see what it's doing. (Maybe post it here if it's not too involved.)

Categories