LMSouq
moodle-core AI Answered

Find the context id inside a block in Moodle

DE
Deepu Sasidharan
1 month ago
3 views
Problem Description
How to get the `context` and `context id` in **Moodle 2.9.1**. Currently I am in a block : **Question Paper** In form submission action page I need the `context id`. I don't know how to get the `context` is inside a block (or module). My code is look like this: **question_action.php** require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/locallib.php'); global $DB, $CFG; require_once("$CFG->libdir/resourcelib.php"); if(isset($_GET['id'])){ $cid = $_GET['id'];} //course id if(isset($_GET['poolid'])){ $paper= $_GET['paper'];} //question paper id How I find the `context` and `context id` here..

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base