php - How to get the week slot of activity in Moodle? -
php - How to get the week slot of activity in Moodle? -
i add together activity (say assignment) in particular week section moodle
.consider have access activity. how know start , end date of activity?
consider add together activity under
30 september - 6 october.
how can date??
i know logged in user details available in $user object , accessable page.
similarly have date slot of activity pages. how can this. think question clear , help great....
this part of availability api : https://docs.moodle.org/dev/availability_api
it depends on context want pick informations.
for example, assign activity has database fields duedate
, allowsubmissionsfromdate
allow start , end date of activity.
this query 1 above :
global $db; $query = 'select id, duedate, allowsubmissionsfromdate {assign} id = :id'; $results = $db->get_record_sql($query, array('id' => 1));
edit :
you should mdl_course_sections
table. week course of study format defines 2 dates availablefrom
, availableuntil
.
after getting course of study id (there different ways this)
$context = context_course::instance($course->id);
you can create query acitivity id :
$section = 'select section {course_modules} id = :id'; $results = $db->get_record_sql($section, array('id' => xxx));
and query mdl_course_sections
table using section id got lastly query :
$dates = 'select availablefrom, availableuntil {course_modules} id = :sectionid';
check out sample results providing timestamp values giving ability week of section :
mysql> select id, availablefrom, availableuntil mdl_course_modules availablefrom <> 0 , availableuntil <> 0; +-----+---------------+----------------+ | id | availablefrom | availableuntil | +-----+---------------+----------------+ | 590 | 1414713600 | 1417392000 | | 591 | 1414713600 | 1419984000 | +-----+---------------+----------------+
php moodle
Comments
Post a Comment