Is there a way to inherit the Moodle quiz module? - moodle

I've been tasked with developing a custom quiz module that functions exactly like the core quiz module but with some UI modifications. The issue is that our users still need to use the core quiz module as well.
Is there a way to create a new activity that inherits all of the quiz module?
Or alternatively, is there a way to conditionally override the quiz renderer based on a custom quiz setting that can be changed in the core quiz settings?
Thanks ahead of time.

You cannot extend the whole module, however, what you can do is copy quiz module in your custom folder and make all classes extend mod/quiz classes. Rename all requires too to point to your module. Don't forget to put dependency in version.php file

Related

Scala-Play: How to dynamically generate a view?

For a Web Service framework I am currently working on I'd like to add the possibility to test the generic Json services based on their metadata. It should be possible to dynamically build a view to let users test available Web Services. Is there a provision or some supported way to generate views dynamically in Play? if not and supposing that I simply make a template and generate it on the fly, how can this view be injected into the application at runtime?
I will be happy to see documentation/examples/pointers that could help develop such solution ...
I am assuming that you want to create a scala.html and use it on somewhere by taking the html created, is that?
If you create a scala template myView.scala.html then on MyController you can call views.html.myView.render().body(); Then you would have the html created by the template.
Template Documentation

How to name a base class for create and edit functionality?

I have a UI application which contains a dialog allowing to edit/create an entity. However create/edit classes share much code. What's the best names you can suggest for the base class?

Add a web page to a site built in Zend Framework

I am a sort-of newbie with MVC and Zend in particular. I have taken over a project from another team, site is built in Zend framework. There is an admin dashboard to add content, assets like images and media, a blog and a portal into Zen Cart for the store.
What is the easiest method of adding a new web page that has as its contents several things that are dynamic - items for sale, music to listen to, blog entries, news items from the database and a featured artist. All of this is stored in the MySQL db. I just do not know enough about MVC to make it work correctly.
I can create a page in the admin dashboard and use as the URL another "module" that already exists, but if I attempt to copy a module folder (for instance the folder called musiclive is almost exactly what I need except I need to add another column of elements...) the admin dashboard does not render. I know that I need to create some sort of "view" and fiddle with or create a controller, but not sure of the easiest method of doing this. I probably have to tell the admin dashboard I have added another "module" but it really is just the main or home page of the site - the other guys never built it because it was rich with details and I guess they put it off. I also probably have to change the files inside the module folder to reflect a different page.
Would love some help or pointers. Ask if you need more details on what the heck I am describing here...
Create a new controller in that same module instead of copying the whole module if the module is so similar to your requirements. And then extend already built resources like forms, models. I strongly recommend you to read about zend framework documentation, especially skeleton application tutorial. That will increase your knowledge as well as make you understand MVC and your current project.
http://framework.zend.com/learn/
One more thing there are 2 versions of zend framework and both are entirely different. You need to know the version in which the project is built. Zend framework 2 has following generic directory structure:
config/
autoload/
application.config.php
module
Application/
config/
src/
view
Module.php
SomeOtherModule/
...
public/
vendor/

How to structure MEF that sets label at runtime?

I have a windows form with a label on it. I want to set the labels value at runtime depending on which assembly is inside a directory. I am not sure which code goes where:
UI Form has a label.
2 class libraries that implement an interface.
Should I have another class that does the MEF composition work and do I need to call that in the constructor of the UI Form.
If I need to call it at the forms constructor and I have many forms, does this mean I have to call it in very form.
I am using MEF for the first time in a WPF application I'm developing and what you describe above is about how I managed my MEF modules.
Below is a summary of what I have done:
Create a separate class for MEF composition. I named mine Modules. This class should do all of the MEF composition. You can either do the composition when the object is created or make a method for it. (Modules.DoComposition())
I create an instance of this Modules class in the constructor of my main UI window. Composition will be done at this time. (Create in the ViewModel if you are using MVVM design pattern.)
I pass a reference to my Modules object in the constructor of any additional form that needs access to it. That way all forms will have access to your Modules object without needing to do composition again.

How to extend Alfresco Share existing activity list dashlet with my own activity type?

In Community 4.0.a, I'm posting my custom activities in the repo following this: http://wiki.alfresco.com/wiki/3.0_Activities_Developer_Guide
I have defined my own activity type, with custom bundles and pagelink to display custom needs in the activity dashlet.
But I face an issue, I need to specialize the output based on the activity-type in a similar way of what is done already in activity-list.get.js in the specialize() function.
I can't hack the js cause I'm packaging things in my own amp for Share.
What is the best way to do it? Is there some kind of extension point or do I need to override completely the dashlet?
The old way (3.x) to change the behaviour of a webscript controller is to copy the code and overwrite the Javascript by placing it under web-extension: alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/activity-list.get.js. There you can modify the specialize() function or whatever you need to do.
All files you place in the alfresco/web-extension/site-webscripts folder will replace original files in the share.war WEB-INF/classes/alfresco/site-webscripts classpath. Best practice is to place your customizations in the tomcat/shared/classes/alfresco/web-extension folder so you don't need to modify the WAR file.
Alfresco 4.0 provides a new way to change the javascript controllers of a webscript. You can add additional Javascript code that will run after the original code. This is preferable because you don't need to change original code and you can upgrade more easily later. To use it you need to get familiar with the new Share extension modules concept. See David Draper's Blog for more info on that.