if (isset($child['parent']) && $child['parent'] !== '/') { $parent .= $child['parent']; } $obj = utopia::GetInstance($mid); $position = $obj->GetSortOrder(); if (isset($child['fieldLinks']) && $mid === $cm) { $position = 0; } if ($position > $highestpos) { $highestpos = $position; } uMenu::AddItem($parent . $mid, $obj->GetTitle(), $obj->GetURL(), $parent, null, $position); } self::CreateLinkMenu($mid); } if ($module === $cm) { // add separators $i = -10001; while ($i < $highestpos) { uMenu::AddItem('_sep_' . $i, '', '', '_modlinks_', null, $i); $i = $i + 1000; } } } public static function InitLinkMenu() { self::CreateLinkMenu(); } } utopia::SetVar('modlinks', '{menu._modlinks_}'); uEvents::AddCallback('BeforeRunModule', 'modLinks::InitLinkMenu');
static function Launcher($module = NULL) { if ($module == NULL) { $module = self::GetCurrentModule(); } if (!utopia::ModuleExists($module)) { utopia::PageNotFound(); } utopia::SetVar('current_module', $module); self::QueueLauncher($module); $currentModule = reset(self::$launchers); do { $obj = utopia::GetInstance($currentModule); utopia::SetVar('title', $obj->GetTitle()); // run module timer_start('Run Module: ' . $currentModule); $obj->_RunModule(); timer_end('Run Module: ' . $currentModule); } while ($currentModule = next(self::$launchers)); }
public static function assertContent() { $o = utopia::GetInstance(__CLASS__); if (self::$asserted) { return; } self::$asserted = true; $rec = self::findPage(); if (!$rec) { if (utopia::GetCurrentModule() == __CLASS__) { utopia::PageNotFound(); } return; } $canEdit = uEvents::TriggerEvent('CanAccessModule', 'uCMS_Edit') !== FALSE; if (!$canEdit && !$rec['is_published']) { utopia::PageNotFound(); } if (!isset($_GET['preview']) && !isset($_GET['edit']) && !$rec['is_published']) { utopia::PageNotFound(); } echo '<div class="cms-' . $rec['cms_id'] . '">{content}</div>'; utopia::SetVar('cms_id', $rec['cms_id']); utopia::SetVar('cms_parent_id', $rec['parent']); $path = $o->GetCmsParents($rec['cms_id']); utopia::SetVar('cms_parents', $path); utopia::SetVar('cms_root_id', reset($path)); utopia::SetDescription($rec['description']); if (!utopia::UsingTemplate() || utopia::UsingTemplate(TEMPLATE_BLANK)) { return; } utopia::UseTemplate(self::GetTemplate($rec['cms_id'])); }