|
| 1 | +<?php |
| 2 | +function buildPageOptions($page,$app_http) { |
| 3 | + $html = ''; |
| 4 | + if ($page->getOptions()) { |
| 5 | + $html .= " <div class=\"col col-sm-8\"> |
| 6 | + <ul class=\"nav nav-pills\">"; |
| 7 | + foreach ($page->getOptions() as $subnav) { |
| 8 | + $isCurrent = (isset($data['action']) && isset($subnav['action']) && $subnav['action'] == $data['action']) || (!isset($data['action']) && !isset($subnav['action'])); |
| 9 | + $html .= " <li".(($isCurrent) ? ' class="active"':'')."> |
| 10 | + <a class=\"capitalize".(isset($subnav['modal']) ? ' do-loadmodal':'')."\" href=\"{$app_http}".((isset($subnav['action'])) ? "?action={$subnav['action']}":'')."\">{$subnav['name']}</a> |
| 11 | + </li>"; |
| 12 | + } |
| 13 | + $html .= ' </ul> |
| 14 | + </div>'; |
| 15 | + } |
| 16 | + return $html; |
| 17 | +} |
| 18 | + |
| 19 | +function buildPrimaryNavigation($pages,$controllerName,$path_http,$globalUser) { |
| 20 | + $html = ''; |
| 21 | + if ($globalUser->isLoggedIn()) { |
| 22 | + foreach ($pages as $controllerKey=>$sitePage) { |
| 23 | + $html .= ' <li'.(($controllerKey == $controllerName) ? ' class="active"':'').'>'; |
| 24 | + if (!$sitePage->isAdminPage() || ($sitePage->isAdminPage() && $globalUser->isAdmin())) { |
| 25 | + $html .= "<a class=\"capitalize\" href=\"{$path_http}{$sitePage->getPath()}/\">{$sitePage->getName()}</a>"; |
| 26 | + } |
| 27 | + $html .= ' </li>'; |
| 28 | + } |
| 29 | + } |
| 30 | + return $html; |
| 31 | +} |
| 32 | + |
| 33 | +function buildSearchForm($page,$app_http) { |
| 34 | + $html = ''; |
| 35 | + if ($page->isSearchable()) { |
| 36 | + $html .= '<div class="col col-sm-4"> |
| 37 | + <form id="doSearch" class="do-get" name="search" method="POST" action="'.$app_http.'"> |
| 38 | + <input type="hidden" name="action" value="search" /> |
| 39 | + <div class="input-group"> |
| 40 | + <input id="searchTerm" class="form-control" type="text" name="term" />'; |
| 41 | + $html .= ' <span class="input-group-btn"> |
| 42 | + <input id="searchResults" class="btn btn-default" type="submit" name="submit" value="Search" /> |
| 43 | + </span> |
| 44 | + </div> |
| 45 | + <div class="inline-block" id="searchStatus"> |
| 46 | + <a class="hidden" href="#clearSearch">clear search</a> |
| 47 | + </div> |
| 48 | + </form> |
| 49 | + </div>'; |
| 50 | + } |
| 51 | + return $html; |
| 52 | +} |
| 53 | + |
| 54 | +function buildSystemMessages($systemMessages=null) { |
| 55 | + $html = '<div class="sysMsg col-sm-10">'; |
| 56 | + if ($systemMessages) { |
| 57 | + foreach ($systemMessages as $sysMsg) { |
| 58 | + $typeMap = array('error'=>'danger'); |
| 59 | + $msgType = $sysMsg->getType(); |
| 60 | + if (array_key_exists($msgType,$typeMap)) { |
| 61 | + $msgType = $typeMap[$msgType]; |
| 62 | + } |
| 63 | + $html .= " <div class=\"alert alert-{$msgType}\">{$sysMsg->getMessage()}</div>"; |
| 64 | + } |
| 65 | + } |
| 66 | + $html .= '</div>'; |
| 67 | + return $html; |
| 68 | +} |
| 69 | + |
| 70 | +function buildUserDashboard($globalUser,$path_http) { |
| 71 | + $html = ''; |
| 72 | + if ($globalUser->isLoggedIn()) { |
| 73 | + $html .= '<div class="col-sm-2"> |
| 74 | + <span>Hi <a href="'.$path_http.'user.php?action=edit">'.$globalUser->getProfileValue('username').'</a>! (<a href="'.$path_http.'user.php?action=logout">logout</a>)</span> |
| 75 | + </div>'; |
| 76 | + } |
| 77 | + return $html; |
| 78 | +} |
| 79 | + |
| 80 | +function buildPageHeader($page,$app_http) { |
| 81 | + $html = ''; |
| 82 | + if (!empty($page)) { |
| 83 | + if ($page->getTitle()) { |
| 84 | + $html .= " |
| 85 | + <div class=\"page-header\"> |
| 86 | + <h1>{$page->getTitle()}</h1> |
| 87 | + </div>"; |
| 88 | + } |
| 89 | + |
| 90 | + $html .= '<div id="subNav" class="row">'; |
| 91 | + $html .= buildPageOptions($page,$app_http); |
| 92 | + $html .= buildSearchForm($page,$app_http); |
| 93 | + $html .= '</div>'; |
| 94 | + } |
| 95 | + $html .= ' <div id="modalContent">'; |
| 96 | + if (!empty($page) && $page->getSubTitle()) { |
| 97 | + $html .= " <div class=\"page-header\"> |
| 98 | + <h1 class=\"capitalize\"><small>{$page->getSubTitle()}</small></h1> |
| 99 | + </div>"; |
| 100 | + } |
| 101 | + return $html; |
| 102 | +} |
| 103 | + |
| 104 | +$themeFolder = $config['ACTIVE_THEME']; |
| 105 | +$themePath = $config['PATH_THEMES'].$themeFolder.'/'; |
| 106 | +?> |
| 107 | +<!DOCTYPE html> |
| 108 | +<html> |
| 109 | + <head> |
| 110 | + <meta charset="utf-8"> |
| 111 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 112 | + <title><?php echo APP_NAME;?></title> |
| 113 | + <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /> |
| 114 | + |
| 115 | + <meta name="apple-mobile-web-app-capable" content="yes" /> |
| 116 | + <meta name="apple-mobile-web-app-status-bar-style" content="default" /> |
| 117 | + <link rel="apple-touch-icon" href="iphone-icon.png" /> |
| 118 | + |
| 119 | + <link rel="stylesheet" type="text/css" href="<?php echo $config['PATH_THEMES'];?>tamu/css/bootstrap.min.css" media="screen"/> |
| 120 | + <link rel="stylesheet" type="text/css" href="<?php echo $config['PATH_THEMES'];?>tamu/css/prism.css" media="screen"/> |
| 121 | + <link rel="stylesheet" type="text/css" href="<?php echo $config['PATH_THEMES'];?>tamu/css/TAMUglobal.css" media="screen"/> |
| 122 | + |
| 123 | + <link rel="stylesheet" type="text/css" href="<?php echo $config['PATH_CSS'];?>helpers.css" media="screen"/> |
| 124 | + <link rel="stylesheet" type="text/css" href="<?php echo $themePath;?>css/style.css" media="screen"/> |
| 125 | + |
| 126 | +<?php |
| 127 | +if (is_file("{$config['PATH_APP']}{$controllerName}.css")) { |
| 128 | + echo '<link rel="stylesheet" type="text/css" href="'.$config['PATH_CSS'].$controller.'.css" media="screen"/>'; |
| 129 | +} |
| 130 | +?> |
| 131 | + <script type="text/javascript" src="<?php echo $config['PATH_JS'];?>vendor/jquery.min.js"></script> |
| 132 | + <!-- Bootstrap JS - Latest compiled and minified JavaScript --> |
| 133 | + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> |
| 134 | + |
| 135 | + <script type="text/javascript"> |
| 136 | + var app_http = '<?php echo $app_http;?>'; |
| 137 | + </script> |
| 138 | + |
| 139 | + <script type="text/javascript" src="<?php echo $config['PATH_JS'];?>pipit.functions.js"></script> |
| 140 | + <script type="text/javascript" src="<?php echo $config['PATH_JS'];?>pipit.listeners.js"></script> |
| 141 | + <script type="text/javascript" src="<?php echo $themePath;?>js/theme.js"></script> |
| 142 | + |
| 143 | +<?php |
| 144 | +if ($controllerName != 'default' && is_file("{$config['PATH_APP']}site/resources/js/{$controllerName}.js")) { |
| 145 | + echo '<script type="text/javascript" src="'.$config['PATH_JS'].$controllerName.'.js"></script>'; |
| 146 | +} |
| 147 | + |
| 148 | +?> |
| 149 | + <link rel="shortcut icon" href="ico/favicon.ico"> |
| 150 | + </head> |
| 151 | + <body> |
| 152 | + <a href="#content" class="sr-only sr-only-focusable">Skip to main content</a> |
| 153 | + <div id="theModal" class="modal fade" tabindex="-1" role="dialog"> |
| 154 | + <div class="modal-dialog modal-lg"> |
| 155 | + <div class="modal-content"> |
| 156 | + <div class="modal-header"> |
| 157 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
| 158 | + <span aria-hidden="true">×</span> |
| 159 | + </button> |
| 160 | + </div> |
| 161 | + <div class="modal-body"></div> |
| 162 | + </div> |
| 163 | + </div> |
| 164 | + </div> |
| 165 | + <header class="globalHeader"> |
| 166 | + <tl-header page-title="<?php echo $config['APP_NAME'];?>" suppress-call-to-action="true"> |
| 167 | +<?php |
| 168 | +if ($globalUser->isLoggedIn()) { |
| 169 | + foreach ($pages as $controllerKey => $sitePage) { |
| 170 | + $showNavLink = false; |
| 171 | + if ($sitePage->isAdminPage() && $globalUser->isAdmin()) { |
| 172 | + $showNavLink = true; |
| 173 | + } else if ($sitePage->getAccessLevel() < SECURITY_ADMIN) { |
| 174 | + $showNavLink = true; |
| 175 | + } |
| 176 | + if ($showNavLink) { |
| 177 | + echo "<wvre-nav-li href=\"{$config['PATH_HTTP']}{$sitePage->getPath()}/\"> |
| 178 | + <wvre-text value=\"{$sitePage->getName()}\"/> |
| 179 | + </wvre-nav-li>"; |
| 180 | + } |
| 181 | + } |
| 182 | +} |
| 183 | +?> |
| 184 | + </header> |
| 185 | + <div id="systemBar" class="clearfix"> |
| 186 | +<?php |
| 187 | +echo buildSystemMessages($systemMessages); |
| 188 | +echo buildUserDashboard($globalUser,$config['PATH_HTTP']); |
| 189 | +?> |
| 190 | + </div> |
| 191 | + <div class="container clearfix"> |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | +<?php |
| 196 | +echo buildPageHeader($page,$app_http); |
| 197 | +?> |
0 commit comments