79597958

Date: 2025-04-29 08:55:26
Score: 0.5
Natty:
Report link
Requirements: sgtempplugin

Plugin/ActivityName: concentrationsolution (max 20chars)

step#1 : create a version file in plugin directory

step#2: Database table: Fields (from slide)

>> Db/access.php (required)
>> Db/install.xml (required)
>> Db/upgrade.php (add or delete new field/column)
>> Db/services.php (register mobile side APIs)



step#3: CRUD Operations:

Create: mod_form.php (Read data and store into database)
Store: lib.php (Submit, Update, Delete)



step#4: Read data from database and perform calculations:

Main file: view.php
Including library:
$PAGE->requires->js(new moodle_url($root . '/mod/concentrationsol/library/js/student_view.js?v=1.2'), true);



step#5: library/js/student_view.js: 
All Javascript related work (load image, animations, etc)

We need different values from database(view.php) in js file.

NOTE#
Now a days we are creating our plugin/activity in React.js (put all React components in this js folder)



step#6: Pass data to our template 
>> template/form.mustache

There are two different ways to pass data into plugin template:
1. From view.php 
$JSdata = array(
    'numToIdMapping' => $numtoidmappinng,
    'primesToMultiples' => $primestomultiples,
    'maxRetries' => $max_retries,
    'courseModuleID' => $id,
);
$PAGE->requires->js_init_call('initData', array($JSdata));

1. Classes/render/renderer.php
(Recommended )



Extra: 
>> classes/Helper.php (helper class regarding plugin requirements)

Mobile App API: 
>> classes/external.php (create external mobile app APIs)



step#7: create/generate your template 

>> template/form.mustache


step#8:  Styling your mustache

>> styles.css



step#9:  Backup Folder
(We can take backup of our plugin/activity and restore it into)

Maximum rename 




Extra Folders:

Lang folder: 

En: define strings
Urd:
Arbi:

pix folder:  put images related to this plugin
Reasons:
  • Blacklisted phrase (1): this plugin
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Muhammad Naveed Khan