Hey All,
I found the above line in a piece of code somebody made for me.
The number 13 properly comes from resource, but I am wondering is 13 unified for the resource module? Or is that line just a hack.
For me it sounds like if he needed ot figure out the ID for the resource type rater then filling in 13...
Ries
$this->_cmr = get_record('course_modules','instance',$resource->id,'course',$resource->course,'module',13);
by Deleted user -
Number of replies: 3
In reply to Deleted user
Re: $this->_cmr = get_record('course_modules','instance',$resource->id,'course',$resource->course,'module',13);
by Hubert Chathi -
It's a hack, and the code will break on other sites. I'm not very familiar with that set of tables, but I'm guessing that the 13 comes from the id field of the mdl_modules table.
In reply to Hubert Chathi
Re: $this->_cmr = get_record('course_modules','instance',$resource->id,'course',$resource->course,'module',13);
by Deleted user -
I indeed thought so alreadsy,
what I currently did is to retrieve the module id by name and pass that through the function.
Is is also possible to do a straight join within get_record?? The will properly also give a performance increase aswell because I don't have to call up teh DB twice but just one time.
Ries
what I currently did is to retrieve the module id by name and pass that through the function.
Is is also possible to do a straight join within get_record?? The will properly also give a performance increase aswell because I don't have to call up teh DB twice but just one time.
Ries
In reply to Deleted user
Re: $this->_cmr = get_record('course_modules','instance',$resource->id,'course',$resource->course,'module',13);
by Hubert Chathi -
No, you can't do a join with get_record. You'd need to use get_record_sql and pass in a full SQL query.