kt3template.inc.php.tmp
来自「PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。」· TMP 代码 · 共 459 行 · 第 1/2 页
TMP
459 行
function getThemeCSSResourcesForIE() { return array_keys($this->theme_ie_only_css); } function requireCSSStandalone($sCSS) { $this->css_standalone[$sCSS] = 1; } function getCSSStandalone() { return array_keys($this->css_standalone); } function setPageContents($contents) { $this->contents = $contents; } function setShowPortlets($bShow) { $this->show_portlets = $bShow; } /* set the breadcrumbs. the first item is the area name. the rest are breadcrumbs. */ function setBreadcrumbs($aBreadcrumbs) { $breadLength = count($aBreadcrumbs); if ($breadLength != 0) { $this->breadcrumbSection = $this->_actionhelper($aBreadcrumbs[0]); // handle the menu if (($aBreadcrumbs[0]["action"]) && ($this->menu[$aBreadcrumbs[0]["action"]])) { $this->menu[$aBreadcrumbs[0]["action"]]["active"] = 1; } } if ($breadLength > 1) { $this->breadcrumbs = array_map(array(&$this, "_actionhelper"), array_slice($aBreadcrumbs, 1)); } } function setBreadcrumbDetails($sBreadcrumbDetails) { $this->breadcrumbDetails = $sBreadcrumbDetails; } function setUser($oUser) { $this->user = $oUser; } function setContentClass($sClass) { $this->content_class = $sClass; } // FIXME refactor setSection to be generic, not an if-else. // assume this is admin for now. function setSection($sSection) { if ($sSection == 'administration') { $this->componentLabel = _kt('DMS Administration'); $this->componentClass = 'administration'; $this->menu['administration']['active'] = 1; } else if ($sSection == 'dashboard') { $this->componentLabel = _kt('Dashboard'); $this->componentClass = 'dashboard'; } else if ($sSection == 'browse') { $this->componentLabel = _kt('Browse Documents'); $this->componentClass = 'browse_collections'; } else if ($sSection == 'view_details') { $this->componentLabel = _kt('Document Details'); $this->componentClass = 'document_details'; } else if ($sSection == 'search') { $this->componentLabel = _kt('Search'); $this->componentClass = 'search'; } else if ($sSection == 'preferences') { $this->componentLabel = _kt('Preferences'); $this->componentClass = 'preferences'; } else { $this->componentLabel = _kt('Dashboard'); $this->componentClass = 'dashboard'; } } function addError($sError) { array_push($this->errStack, $sError); } function addInfo($sInfo) { array_push($this->infoStack, $sInfo); } /** no-one cares what a portlet is, but it should be renderable, and have its ->title member set. */ function addPortlet($oPortlet) { array_push($this->portlets, $oPortlet); } /* LEGACY */ var $deprecationWarning = "Legacy UI API: "; function setCentralPayload($sCentral) { $this->contents = $sCentral; $this->addError($this->deprecationWarning . "called <strong>setCentralPayload</strong>"); } function setOnloadJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setOnloadJavascript (no-act)</strong>"); } function setDHtmlScrolling($appendix) { $this->addError($this->deprecationWarning . "called <strong>setDHTMLScrolling (no-act)</strong>"); } function setFormAction($appendix) { $this->addError($this->deprecationWarning . "called <strong>setFormAction (no-act)</strong>"); } function setSubmitMethod($appendix) { $this->addError($this->deprecationWarning . "called <strong>setSubmitMethod (no-act)</strong>"); } function setHasRequiredFields($appendix) { $this->addError($this->deprecationWarning . "called <strong>setHasRequiredFields (no-act)</strong>"); } function setAdditionalJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setAdditionalJavascript (no-act)</strong>"); } function hideSection() { $this->hide_section = true; } function setSecondaryTitle($sSecondary) { $this->secondary_title = $sSecondary; } /* final render call. */ function render() { global $default; $oConfig = KTConfig::getSingleton(); if (empty($this->contents)) { $this->contents = ""; } if (is_string($this->contents) && (trim($this->contents) === "")) { $this->addError(_kt("This page did not produce any content")); $this->contents = ""; } if (!is_string($this->contents)) { $this->contents = $this->contents->render(); } // if we have no portlets, make the ui a tad nicer. if (empty($this->portlets)) { $this->show_portlets = false; } if (empty($this->title)) { if (!empty($this->breadcrumbDetails)) { $this->title = $this->breadcrumbDetails; } else if (!empty($this->breadcrumbs)) { $this->title = array_slice($this->breadcrumbs, -1); $this->title = $this->title[0]['label']; } else if (!empty($this->breadcrumbSection)) { $this->title = $this->breadcrumbSection['label']; } else { $this->title = $this->componentLabel; } } $this->userMenu = array(); if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) { $sBaseUrl = KTUtil::kt_url(); if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) { $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl.'/presentation/logout.php'); } else { $this->userMenu['preferences'] = array('label' => _kt('Preferences'), 'url' => $sBaseUrl.'/preferences.php'); $this->userMenu['aboutkt'] = array('label' => _kt('About'), 'url' => $sBaseUrl.'/about.php'); $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl.'/presentation/logout.php'); } } else { $this->userMenu['login'] = array('label' => _kt('Login'), 'url' => $sBaseUrl.'/login.php'); } // FIXME we need a more complete solution to navigation restriction if (!is_null($this->menu['administration']) && !is_null($this->user)) { if (!Permission::userIsSystemAdministrator($this->user->getId())) { unset($this->menu['administration']); } } $sContentType = 'Content-type: ' . $this->contentType; if(!empty($this->charset)) { $sContentType .= '; charset=' . $this->charset; }; header($sContentType); $savedSearches = SearchHelper::getSavedSearches($_SESSION['userID']); $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate($this->template); $aTemplateData = array( "page" => $this, "systemversion" => $default->systemVersion, "versionname" => $default->versionName, 'smallVersion' => substr($default->versionName, -17), 'savedSearches'=> $savedSearches); if ($oConfig->get("ui/automaticRefresh", false)) { $aTemplateData['refreshTimeout'] = (int)$oConfig->get("session/sessionTimeout") + 3; } // unlike the rest of KT, we use echo here. echo $oTemplate->render($aTemplateData); } /** heler functions */ // returns an array ("url", "label") function _actionhelper($aActionTuple) { $aTuple = Array("label" => $aActionTuple["name"]); if ($aActionTuple["action"]) { $aTuple["url"] = generateControllerLink($aActionTuple["action"], $aActionTuple["query"]); } else if ($aActionTuple["url"]) { $sUrl = $aActionTuple["url"]; $sQuery = KTUtil::arrayGet($aActionTuple, 'query'); if ($sQuery) { $sUrl = KTUtil::addQueryString($sUrl, $sQuery); } $aTuple["url"] = $sUrl; } else if ($aActionTuple["query"]) { $aTuple['url'] = KTUtil::addQueryStringSelf($aActionTuple["query"]); } else { $aTuple["url"] = false; } return $aTuple; } function setHelp($sHelpPage) { $this->helpPage = $sHelpPage; } function getHelpURL() { if (empty($this->helpPage)) { return null; } return KTUtil::ktLink('help.php',$this->helpPage); } function getReqTime() { $microtime_simple = explode(' ', microtime()); $finaltime = (float) $microtime_simple[1] + (float) $microtime_simple[0]; return sprintf("%.3f", ($finaltime - $GLOBALS['_KT_starttime'])); } function getDisclaimer() { $oRegistry =& KTPluginRegistry::getSingleton(); $oPlugin =& $oRegistry->getPlugin('ktstandard.disclaimers.plugin'); if (!PEAR::isError($oPlugin) && !is_null($oPlugin)) { return $oPlugin->getPageDisclaimer(); } else { return; } }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?