dirroot.'/mod/certificate/lib.php'); /// Set defaults if (!isset($form->name)) { $form->name = ''; } if (!isset($form->type)) { $form->type = 0; } if (!isset($form->border_style)) { $form->border_style = 0; } if (!isset($form->border_color)) { $form->border_color = 0; } if (!isset($form->print_wmark)) { $form->print_wmark = 0; } if (!isset($form->date_fmt)) { $form->date_fmt = 0; } if (!isset($form->print_number)) { $form->print_number = 0; } if (!isset($form->print_grade)) { $form->print_grade = 0; } if (!isset($form->print_signature)) { $form->print_signature = 0; } if (!isset($form->print_teacher)) { $form->print_teacher = 0; } if (!isset($form->print_seal)) { $form->print_seal = 0; } /// get list of certificate types defined in language file /// (someday this should go to some beautiful pluggable formats) $i = 0; $str = get_string("type$i", 'certificate'); while(substr_count($str, '[[') == 0) { $typeoptions[$i++] = $str; $str = get_string("type$i", 'certificate'); if ($i >10 ) break; } /// Color options /// (also to be explanded in the future, perhaps...) $coloroptions[0] = get_string('border_black', 'certificate'); $coloroptions[1] = get_string('border_brown', 'certificate'); $coloroptions[2] = get_string('border_blue', 'certificate'); $coloroptions[3] = get_string('border_green', 'certificate'); /// Date Format options /// (to be changed to Moodle date/time functions...) $dateoptions[0] = get_string('no_date', 'certificate'); $dateoptions[1] = "January 1, 2000"; $dateoptions[2] = "January 1st, 2000"; $dateoptions[3] = "1 January 2000"; $dateoptions[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.png 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('border_lines', 'certificate'); array_unshift($borderstyleoptions, ''); $borderstyleoptions[0] = get_string('border_none', 'certificate'); /// Add colors for default borders $bordercolors['1'] = array(get_string('border_black', 'certificate'), get_string('border_brown', 'certificate'), get_string('border_blue', 'certificate'), get_string('border_green', 'certificate')); /// Calculate selected color $colorindex = 0; if(isset($bordercolors[$form->border_style])) { foreach($bordercolors[$form->border_style] as $temp) { if(strcmp($temp, $form->border_color) == 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 ksort($signatureoptions); /// Add default signatures array_unshift($signatureoptions, ''); $signatureoptions[0] = get_string('sig_line', 'certificate'); 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('seal_no', 'certificate'); /// Find available grades $gradeoptions = cert_get_grades($course); ?>
:
: type, ""); helpbutton('type', '', 'certificate', true, true); ?>
: border_style, '', 'cert_style(document.certform.border_style.options[document.certform.border_style.selectedIndex].value)'); helpbutton('style', '', 'certificate', true, true); ?>
: border_color, ''); helpbutton('color', '', 'certificate', true, true); ?>
: print_wmark, ''); helpbutton('watermark', '', 'certificate', true, true); ?>
: date_fmt, ''); helpbutton('date_format', '', 'certificate', true, true); ?>
: print_number, ''); helpbutton('cert', '', 'certificate', true, true); ?>
: print_grade, ''); helpbutton('grade', '', 'certificate', true, true); ?>
: print_signature, ''); helpbutton('signature', '', 'certificate', true, true); ?>
: print_teacher, ''); helpbutton('teacher', '', 'certificate', true, true); ?>
: print_seal, ''); helpbutton('seal', '', 'certificate', true, true); ?>
certificate_autopreview == 1) { echo ''; echo '' ; } else { echo ''; echo '' ; } ?> " /> " /> mode == 'update' && ($CFG->certificate_autopreview == 1)) { echo '
'; echo ''; } ?>