Ejemplo n.º 1
0
function cm_certificate_get_templates()
{
    global $CFG, $COURSE;
    // Add default templates
    $my_path = "{$CFG->dirroot}/curriculum/pix/certificate/templates";
    $templateoptions = array();
    if (file_exists($my_path) && ($handle = opendir($my_path))) {
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, '.php', 1)) {
                $i = strpos($file, '.');
                if ($i > 1) {
                    $templateoptions[$file] = substr($file, 0, $i);
                }
            }
        }
        closedir($handle);
    }
    // Add custom images
    cm_certificate_check_data_path('templates');
    $my_path = "{$CFG->dataroot}/{$COURSE->id}/curriculum/pix/certificate/templates";
    if (file_exists($my_path) && ($handle = opendir($my_path))) {
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, '.php', 1)) {
                $i = strpos($file, '.');
                if ($i > 1) {
                    $templateoptions[$file] = substr($file, 0, $i);
                }
            }
        }
        closedir($handle);
    }
    // Sort templates
    ksort($templateoptions);
    return $templateoptions;
}
Ejemplo n.º 2
0
/**
 * Get the availavble certificate templates from the filesystem
 *
 * @param none
 * @return array An array of
 */
function cm_certificate_get_templates()
{
    global $CFG;
    // Add default templates
    $templateoptions = array();
    $my_path = $CFG->dirroot . '/local/elisprogram/pix/certificate/templates';
    if (file_exists($my_path) && is_dir($my_path) && ($handle = opendir($my_path))) {
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, '.php', 1)) {
                $templateoptions[$file] = basename($file, '.php');
            }
        }
        closedir($handle);
    }
    // Add custom images
    cm_certificate_check_data_path('templates');
    $my_path = $CFG->dataroot . '/local/elisprogram/pix/certificate/templates';
    if (file_exists($my_path) && is_dir($my_path) && ($handle = opendir($my_path))) {
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, '.php', 1)) {
                $templateoptions[$file] = basename($file, '.php');
            }
        }
        closedir($handle);
    }
    // Sort templates
    ksort($templateoptions);
    return $templateoptions;
}