updatescriptformandatoryids.php 504 Bytes
<?php

require_once(dirname(__FILE__) . '/../../config.php');

global $USER, $CFG, $PAGE, $COURSE,$DB, $context;



function updatemoduleids(){
	global $USER,$CFG,$DB;
	
	$sql="insert into mdl_local_mandatory_activities(course,cmid, mandatory)
(select course, string_agg(id::text,',') as cmid ,1 from mdl_course_modules where id in (select activity_id from mdl_block_lp_track_week_schedule mbltws  where module_type='Activity')
group by course)";
	
	$insert=$DB->execute($sql);
	
	
}


updatemoduleids();