function show($view, $loc = null, $title = '') { pathos_lang_loadDictionary('modules', 'containermodule'); $source_select = array(); $clickable_mods = null; // Show all $dest = null; $singleview = '_container'; $singlemodule = 'containermodule'; if (pathos_sessions_isset('source_select') && defined('SELECTOR')) { $source_select = pathos_sessions_get('source_select'); $singleview = $source_select['view']; $singlemodule = $source_select['module']; $clickable_mods = $source_select['showmodules']; if (!is_array($clickable_mods)) { $clickable_mods = null; } $dest = $source_select['dest']; } global $db; $container = null; if (!isset($this) || !isset($this->_hasParent) || $this->_hasParent == 0) { // Top level container. $container = $db->selectObject('container', "external='" . serialize(null) . "' AND internal='" . serialize($loc) . "'"); if ($container == null) { $container->external = serialize(null); $container->internal = serialize($loc); $container->view = $view; $container->title = $title; $container->id = $db->insertObject($container, 'container'); } if (!defined('PREVIEW_READONLY') || defined('SELECTOR')) { $view = $container->view; } $title = $container->title; } $template = new template('containermodule', $view, $loc); if ($dest) { $template->assign('dest', $dest); } $template->assign('singleview', $singleview); $template->assign('singlemodule', $singlemodule); $template->assign('top', $container); $containers = array(); foreach ($db->selectObjects('container', "external='" . serialize($loc) . "'") as $c) { if ($c->is_private == 0 || pathos_permissions_check('view', pathos_core_makeLocation($loc->mod, $loc->src, $c->id))) { $containers[$c->rank] = $c; } } if (!defined('SYS_WORKFLOW')) { require_once BASE . 'subsystems/workflow.php'; } ksort($containers); foreach (array_keys($containers) as $i) { $location = unserialize($containers[$i]->internal); $modclass = $location->mod; if (class_exists($modclass)) { $mod = new $modclass(); ob_start(); $mod->_hasParent = 1; $mod->show($containers[$i]->view, $location, $containers[$i]->title); $containers[$i]->output = trim(ob_get_contents()); ob_end_clean(); $policy = pathos_workflow_getPolicy($modclass, $location->src); $containers[$i]->info = array('module' => $mod->name(), 'source' => $location->src, 'hasContent' => $mod->hasContent(), 'hasSources' => $mod->hasSources(), 'hasViews' => $mod->hasViews(), 'class' => $modclass, 'supportsWorkflow' => $mod->supportsWorkflow() ? 1 : 0, 'workflowPolicy' => $policy ? $policy->name : '', 'workflowUsesDefault' => pathos_workflow_moduleUsesDefaultPolicy($location->mod, $location->src) ? 1 : 0, 'clickable' => $clickable_mods == null || in_array($modclass, $clickable_mods)); } else { $containers[$i]->output = sprintf(TR_CONTAINERMODULE_MODNOTFOUND, $location->mod); $containers[$i]->info = array('module' => sprintf(TR_CONTAINERMODULE_UNKNOWNMOD, $location->mod), 'source' => $location->src, 'hasContent' => 0, 'hasSources' => 0, 'hasViews' => 0, 'class' => $modclass, 'supportsWorkflow' => 0, 'workflowPolicy' => '', 'workflowUsesDefault' => 0, 'clickable' => 0); } $containers[$i]->moduleLocation = $location; $cloc = null; $cloc->mod = $loc->mod; $cloc->src = $loc->src; $cloc->int = $containers[$i]->id; $containers[$i]->permissions = array('administrate' => pathos_permissions_check('administrate', $location) ? 1 : 0, 'configure' => pathos_permissions_check('configure', $location) ? 1 : 0); //$containers[$i]->hasPerms = pathos_permissions_checkOnSource($location->mod,$location->src); } $template->assign('containers', $containers); $template->assign('hasParent', isset($this) && isset($this->_hasParent) ? 1 : 0); $template->register_permissions(array('administrate', 'add_module', 'edit_module', 'delete_module', 'order_modules'), $loc); $template->output(); }
require_once BASE . "subsystems/forms.php"; } pathos_forms_initialize(); $form = new form(); $policies = array(); $assoc = $db->selectObject("approvalpolicyassociation", "module='" . $_GET['m'] . "' AND source='" . $_GET['s'] . "'"); if (!$assoc) { $assoc = $db->selectObject("approvalpolicyassociation", "module='" . $_GET['m'] . "' AND is_global='1'"); } if (!$assoc) { $assoc->policy_id = 0; } if (!defined("SYS_WORKFLOW")) { require_once BASE . "subsystems/workflow.php"; } if (pathos_workflow_moduleUsesDefaultPolicy($_GET['m'], $_GET['s'])) { $assoc->policy_id = 0; } foreach ($db->selectObjects("approvalpolicy") as $pol) { $policies[$pol->id] = $pol->name; } uasort($policies, "strnatcasecmp"); $realpol = array(); $defaultpol = pathos_workflow_getDefaultPolicy($_GET['m']); if ($defaultpol) { $realpol = array(-1 => TR_WORKFLOW_NOPOLICY, 0 => sprintf(TR_WORKFLOW_DEFAULTPOLICY, $defaultpol->name)); } else { $realpol = array(-1 => TR_WORKFLOW_NOPOLICY, 0 => sprintf(TR_WORKFLOW_DEFAULTPOLICY, TR_WORKFLOW_NOPOLICY)); } foreach ($policies as $key => $name) { $realpol[$key] = $name;