function course_certificate_token_values in Course 6
Implements hook_token_values().
File
- modules/
course_certificate/ course_certificate.module, line 60
Code
function course_certificate_token_values($type, $object = NULL, $options = array()) {
if ($type == 'certificate') {
$values = array();
$sql = 'SELECT * FROM {course_report} WHERE nid = %d AND uid = %d';
if ($report = db_fetch_object(db_query($sql, $object['node']->nid, $object['user']->uid))) {
$values['certificate-date_completed'] = date(variable_get('course_report_certificate_time_format', 'F jS, Y'), $report->date_completed);
}
$values['certificate-number'] = time() . '-' . $object['node']->nid;
return $values;
}
}