dirroot/mod/certificate/lib.php"); if (empty($form->name)) { $form->name = ''; } if (empty($form->emailteachers)) { $form->emailteachers = 0; } if (empty($form->save)) { $form->save = 0; } if (empty($form->delivery)) { $form->delivery = 0; } if (empty($form->certificatetype)) { $form->certificatetype = "landscape"; } if (!isset($form->borderstyle)) { $form->borderstyle = 0; } if (!isset($form->bordercolor)) { $form->bordercolor = 0; } if (!isset($form->printwmark)) { $form->printwmark = 0; } if (!isset($form->printdate)) { $form->printdate = 0; } if (!isset($form->datefmt)) { $form->datefmt = 0; } if (!isset($form->printnumber)) { $form->printnumber = 0; } if (!isset($form->printgrade)) { $form->printgrade = 0; } if (!isset($form->gradefmt)) { $form->gradefmt = 0; } if (!isset($form->printsignature)) { $form->printsignature = 0; } if (!isset($form->printteacher)) { $form->printteacher = 0; } if (!isset($form->printseal)) { $form->printseal = 0; } /// Color options /// (also to be expanded in the future, perhaps...) $coloroptions[0] = get_string('borderblack', 'certificate'); $coloroptions[1] = get_string('borderbrown', 'certificate'); $coloroptions[2] = get_string('borderblue', 'certificate'); $coloroptions[3] = get_string('bordergreen', 'certificate'); /// Date options $dateoptions[0] = get_string('no'); $dateoptions[1] = get_string('receiveddate', 'certificate'); if (isset($course->enrolenddate)){ $dateoptions[2] = get_string('courseenddate', 'certificate'); } /// Date Format options $dateformatoptions[1] = "January 1, 2000"; $dateformatoptions[2] = "January 1st, 2000"; $dateformatoptions[3] = "1 January 2000"; $dateformatoptions[4] = "January 2000"; /// yes no options $yesnooptions[0] = get_string('no'); $yesnooptions[1] = get_string('yes'); /// load available borders $file = array(); $borderstyleoptions = array(); $bordercolors = array(); /// load border files $my_path = "$CFG->dirroot/mod/certificate/pix/borders"; if ($handle = opendir($my_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $i = strpos($file, '-'); /// Name of border files is border-color.jpg if($i > 1) { /// Set the style name $borderstyleoptions[substr($file, 0, $i)] = substr($file, 0, $i); /// Add the available colors if( ! isset($bordercolors[substr($file, 0, $i)])) { $bordercolors[substr($file, 0, $i)] = array(); } if (isset($bordercolors[substr($file, 0, $i)])) { $position = count($bordercolors[substr($file, 0, $i)]); } else { $position = 0; } $bordercolors[substr($file, 0, $i)][$position] = substr($file, $i+1, -4); } } } closedir($handle); } /// Sort borders ksort($borderstyleoptions); /// Add default borders array_unshift($borderstyleoptions, ''); $borderstyleoptions[0] = get_string('borderlines', 'certificate'); array_unshift($borderstyleoptions, ''); $borderstyleoptions[0] = get_string('bordernone', 'certificate'); /// Add colors for default borders $bordercolors['1'] = array(get_string('borderblack', 'certificate'), get_string('borderbrown', 'certificate'), get_string('borderblue', 'certificate'), get_string('bordergreen', 'certificate')); /// Calculate selected color $colorindex = 0; if(isset($bordercolors[$form->borderstyle])) { foreach($bordercolors[$form->borderstyle] as $temp) { if(strcmp($temp, $form->bordercolor) == 0 ) { break; } $colorindex++; } } /// load watermark files $my_path = "$CFG->dirroot/mod/certificate/pix/watermarks"; if ($handle = opendir($my_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $i = strpos($file, '.png'); if($i > 1) { $wmarkoptions[$file] = substr($file, 0, $i); } } } closedir($handle); } /// Order watermarks ksort($wmarkoptions); /// Add default watermarks array_unshift($wmarkoptions, ''); $wmarkoptions[0] = get_string('no'); /// load signature files $my_path = "$CFG->dirroot/mod/certificate/pix/signatures"; if ($handle = opendir($my_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $i = strpos($file, '.png'); if($i > 1) { $signatureoptions[$file] = substr($file, 0, $i); } } } closedir($handle); } /// Order signatures array_unshift($signatureoptions, ''); $signatureoptions[0] = get_string('no'); /// load seal files $my_path = "$CFG->dirroot/mod/certificate/pix/seals"; if ($handle = opendir($my_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $i = strpos($file, '.png'); if($i > 1) { $sealoptions[$file] = substr($file, 0, $i); } } } closedir($handle); } /// Sort seals ksort($sealoptions); /// Add default seals array_unshift($sealoptions, ''); $sealoptions[0] = get_string('no'); /// Find available grades $gradeoptions = certificate_get_mod_grades($course); /// Grade format options $gradeformatoptions[1] = get_string('gradepercent', 'certificate'); $gradeformatoptions[2] = get_string('gradepoints', 'certificate'); $gradeformatoptions[3] = get_string('gradeletter', 'certificate'); ?>
:
: emailteachers, ""); helpbutton('emailteachers', get_string('emailteachers', 'certificate'), "certificate"); ?>
: save, ""); helpbutton('save', get_string('savecertificate', 'certificate'), "certificate"); ?>
: delivery, '', '', ''); helpbutton('deliver', get_string('deliver', 'certificate'), "certificate"); ?>
: certificatetype, ''); helpbutton('types', get_string('certificatetype', 'certificate'), 'certificate'); ?>
: borderstyle, '', 'certstyle(document.certform.borderstyle.options[document.certform.borderstyle.selectedIndex].value)'); helpbutton('border', get_string('border', 'certificate'), 'certificate'); ?>
: bordercolor, ''); helpbutton('border', get_string('border', 'certificate'), 'certificate'); ?>
: printwmark, ''); helpbutton('watermark', get_string('printwmark', 'certificate'), 'certificate'); ?>
: printdate, ''); helpbutton('date', get_string('datehelp', 'certificate'), 'certificate'); ?>
: datefmt, ''); helpbutton('date', get_string('datehelp', 'certificate'), 'certificate'); ?>
: printnumber, ''); helpbutton('code', get_string('printcode', 'certificate'), 'certificate'); ?>
: printgrade, ''); helpbutton('grade', get_string('grade', 'certificate'), 'certificate'); ?>
: gradefmt, ''); helpbutton('grade', get_string('grade', 'certificate'), 'certificate'); ?>
: printteacher, ''); helpbutton('teacher', get_string('printteacher', 'certificate'), 'certificate'); ?>
: printsignature, ''); helpbutton('signature', get_string('printsignature', 'certificate'), 'certificate'); ?>
: printseal, ''); helpbutton('seal', get_string('printseal', 'certificate'), 'certificate'); ?>