コード例 #1
0
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: examplecontent.php,v 1.6 2005/02/19 00:32:28 filetreefrog Exp $
##################################################
// Part of Extensions category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('extensions', pathos_core_makeLocation('administrationmodule'))) {
    pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $modclass = $_GET['name'];
    $template = new template('administrationmodule', '_examplecontent', $loc);
    $views = array();
    $loc = pathos_core_makeLocation($modclass, '@example');
    foreach (pathos_template_listModuleViews($modclass) as $view) {
        echo $view;
        $v = null;
        $v->view = $view;
        ob_start();
        call_user_func(array($modclass, 'show'), $view, $loc, 'Example Title');
        $v->content = ob_get_contents();
        ob_end_clean();
        $views[] = $v;
    }
    $template->assign('views', $views);
    $template->output();
} else {
    echo SITE_403_HTML;
}
コード例 #2
0
function pathos_template_listModuleViews($module, $lang = LANG)
{
    $views = array();
    $langdir = $lang == 'en' ? '' : $lang . '/';
    if (is_readable(BASE . "modules/{$module}/views/{$langdir}")) {
        $dh = opendir(BASE . "modules/{$module}/views/{$langdir}");
        while (($file = readdir($dh)) !== false) {
            if (substr($file, -4, 4) == ".tpl" && substr($file, 0, 1) != "_") {
                $views[] = substr($file, 0, -4);
            }
        }
    }
    if (is_readable(THEME_BASE . "modules/{$module}/views/{$langdir}")) {
        $dh = opendir(THEME_BASE . "modules/{$module}/views/{$langdir}");
        while (($file = readdir($dh)) !== false) {
            if (substr($file, -4, 4) == ".tpl" && substr($file, 0, 1) != "_") {
                $view = substr($file, 0, -4);
                if (!in_array($view, $views)) {
                    $views[] = $view;
                }
            }
        }
    }
    if (!count($views) && $lang != 'en') {
        return pathos_template_listModuleViews($module, 'en');
    }
    return $views;
}
コード例 #3
0
     $module = new $moduleclass();
     $mod = null;
     // Get basic module meta info
     $mod->name = $module->name();
     $mod->author = $module->author();
     $mod->description = $module->description();
     if (isset($container->view) && $container->internal->mod == $moduleclass) {
         $mod->defaultView = $container->view;
     } else {
         $mod->defaultView = DEFAULT_VIEW;
     }
     // Get support flags
     $mod->supportsSources = $module->hasSources() ? 1 : 0;
     $mod->supportsViews = $module->hasViews() ? 1 : 0;
     // Get a list of views
     $mod->views = pathos_template_listModuleViews($moduleclass);
     natsort($mod->views);
     if (!$haveclass) {
         $js_init .= pathos_javascript_class($mod, 'Module');
         $js_init .= "var modules = new Array();\r\n";
         $js_init .= "var modnames = new Array();\r\n\r\n";
         $haveclass = true;
     }
     $js_init .= "modules.push(" . pathos_javascript_object($mod, "Module") . ");\r\n";
     $js_init .= "modnames.push('" . $moduleclass . "');\r\n";
     $mods[$moduleclass] = $module->name();
 }
 $js_init .= "\r\n</script>";
 $template->assign('js_init', $js_init);
 $template->assign('modules', $mods);
 $template->assign('loc', $loc);