How can I create new Resource in Moodle? - plugins

I have to create new Resource in Moodle (currently available resources are Book, File, Label etc). I know how to create an activity module in Moodle. I think both activity and resource are created in similar way. Then how can I align the newly created resource below the RESOURCES section(while adding the activity/resource in course).
Please help me to find any link/suggestion regarding to create resources in Moodle....

In your plugin's PLUGINNAME_supports function, just return MOD_ARCHETYPE_RESOURCE when asked about feature FEATURE_MOD_ARCHETYPE.
See example at the start of the mod/page/lib.php file -https://github.com/moodle/moodle/blob/master/mod/page/lib.php

Related

Creating moodle plugin to accept REST calls and create activities/notice/files

Im quite new to moodle development. Im trying to post activity/notice to a selected course. I could not find any webservice for creating activities within a course. Is there any way i could create a plug-in where i could make a REST call to the plug so that it would create a notice?. An example would help allot.
STEP 1
To create local plugin you can follow following folder structure according to Moodle documentation (https://docs.moodle.org/dev/Local_plugins)-
local/
yourplugin/
db/
access.php
install.php
install.xml
lang/
en/
yourplugin.php
index.php
settings.php
version.php
Meanwhile, creating local plugin does not always really solve all problems as there are limitation depending what you really want to achieve.
what worked for me was editing //moodle_dir/course/modedit.php file, and i was able to make REST Call to add scorm activity to any course i want.

Creating new form in moodle

I have created a new module in moodle from the link New Module. I have installed that as well and it is showing up in the Administration ->Activities.
How to add a new form against that module to get the user inputs?
Please check the mod_form.php in the documentation. This is used to add an instance of the new activity. Please check the existing modules also.

How to crete New Web Service inside moodle?

I am go through the service module inside moodle , how can i add my own function and class for handling some operations such as enrolling and register . is it possible or not
You need to create a new plugin (probably a 'local' plugin) and add a webservice within it:
https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin
this might help
https://docs.moodle.org/dev/Web_service_API_functions
even this---
https://docs.moodle.org/31/en/Using_web_services
I created a new web service "core_completion_override_course_completion_status"
Duplicate any existing web service and replace the words as per your need in the method name, class name etc.
Increate Moodle main version from version.php in root moodle folder.

Set workflow model id (path)

When I create a new workflow model in AEM, it gets created under /etc/workflow/models. How do I get it to be created under a different path like /etc/workflow/models/myapp ? The only way I can think of is changing the path in CRXDE after the workflow gets created. Wanted so if there is a better way to do this.
Better way to move workflow to another place would be:
go to /miscadmin#/etc/workflow/models
use button "Move..."
Unfortunately, it seems, that there is no easy way to change place, where worflows, which are created through UI, are stored. To do this you should:
override "/libs/cq/workflow/widgets/source/widget/ModelsPanel.js" in you project, where you can find action this.newAction, where you will be able to change propery parentPath to /etc/workflow/models/myapp. But you can run into troubles after upgrading to another version of AEM.
also you can be interested in service Granite Workflow Service where you can set (through /system/console/configMgr) path to your models, which should be shown in Workflow Console /libs/cq/workflow/content/console.html. (Also it's applicable to CQ 5.6.1, for some older versions, you should configure Day CQ Workflow Service).

alfresco web services cmisWS soap createdocument

Can someone help me out how I would go on about create documents to repository using soap createDocument.
I have a custom content model and and when I add a new document does not have the properties of the content model.
<ns:properties> <ns1:propertyId
propertyDefinitionId="cmis:objectTypeId">
<ns1:value>cmis:document</ns1:value>
<ns1:value>cms:customModel</ns1:value> </ns:properties>
Also I am looking to upload multiple attachments at time but right now I can't
<ns:contentStream>
<ns:mimeType>application/octet-stream</ns:mimeType>
<!-- Optional:-->
<ns:filename></ns:filename>
<ns:stream><xsl:copy-of select="//someelement"></xsl:copy-of></ns:stream>
</ns:contentStream>
any help on how I can get this working is greatly appreciated.
You should use OpenCMIS or a similar CMIS library instead of writing to the WS binding directly.
You appear to be attempting to set two values for cmis:objectTypeId. If you are trying to create an instance of cms:customModel, that should be the only value.
You aren't setting any custom property values in the snippets you provided.
To my knowledge, there is nothing in the spec allows you to provide multiple attachments simultaneously. You should get a single upload working first.