-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
153 lines (135 loc) · 5.56 KB
/
header.php
File metadata and controls
153 lines (135 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php wp_title( '|', true, 'right' ); ?> <?php bloginfo('name'); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<script type="text/javascript" src="//use.typekit.net/anb1nws.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script type="text/javascript">
var theme_dir = "<?php echo get_theme_root(); ?>";
var theme_url = "<?php echo get_template_directory_uri() ?>";
var theme_branch = "<?php if($_GET['theme']) echo $_GET['theme']; else echo "dev"; ?>";
</script>
<script src="http://beta.openbadges.org/issuer.js"></script>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5shiv.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<?php
global $pending_reviews;
global $current_user; get_currentuserinfo();
global $section;
global $view;
?>
<?php
if(is_page()) { $page_slug = 'page-'.$post->post_name; }
elseif($_GET['s']) {}
elseif(get_post_meta($post->ID, 'badge_type', true)) $section .= " single-".get_post_meta($post->ID, 'badge_type', true);
?>
<body <?php body_class($page_slug ." ". $section); ?>>
<div id="container">
<header>
<div id="main-nav">
<h1 id="branding"><a href="/">Aquapons</a></h1>
<ul id="navigation">
<li class="badges <?php if($section=='badges') echo 'selected'; ?>">
<a href="http://aquapons.info/badges-overview/">Badges</a>
<div class="sub-nav">
<ul>
<li><a href="http://aquapons.info/badges/aquapons-badges/">Aquapons</a></li>
<li><a href="http://aquapons.info/badges/skills-badges/">Skills</a></li>
<!-- <li><a href="http://aquapons.info/badges/my-badges/">Mine</a></li> -->
</ul>
</div>
</li>
<li class="community <?php if($section=='community') echo 'selected'; ?>">
<a href="http://aquapons.info/community/">Community</a>
<!--
<div class="sub-nav">
<ul>
<li><a href="http://aquapons.info/community/institutions/">Groups/Institutions</a></li>
</ul>
</div>
-->
</li>
<li class="resources <?php if($section=='resources') echo 'selected'; ?>">
<a href="http://aquapons.info/resources/">Resources</a>
<div class="sub-nav">
<ul>
<li><a href="/tutorials/">Tutorials</a></li>
<li><a href="/forum/">Forum</a></li>
<li><a href="/library/">Library</a></li>
<li><a href="/jobs/">Jobs</a></li>
</ul>
</div>
</li>
<li class="about <?php if($section=='about') echo 'selected'; ?>">
<a href="http://aquapons.info/about/">About</a>
</li>
</ul>
<ul id="profile">
<?php if ( is_user_logged_in() ) { ?>
<?php
global $user_level, $wpdb;
if($current_user->roles[0]=='instructor'){
$all_students = $wpdb->get_results("SELECT aq_student_id FROM aq_class_roster WHERE aq_instructor='".$current_user->ID."'");
//print_r($all_students);
$studentArray = array();
foreach($all_students as $student)
if(!in_array($student->aq_student_id, $studentArray))
array_push($studentArray, $student->aq_student_id);
$ids = join(',',$studentArray);
$pending_reviews = $wpdb->get_var( "SELECT COUNT(*) FROM aq_badge_submissions WHERE current_status = 'reviewing' AND user_id IN ($ids)" );
//$pending_reviews = $wpdb->query("SELECT id FROM aq_badge_submissions WHERE current_status = 'reviewing' ORDER BY submission_timestamp");
?>
<li class="submissions <?php if($section=='submissions') echo 'selected'; ?>">
<a href="http://aquapons.info/review/">
Submissions
<?php if($pending_reviews) { ?>
<span class="submission_count"><?php echo $pending_reviews ?></span>
<?php } ?>
</a>
</li>
<li class="class"><a href="http://aquapons.info/class?new">Your Classes</a></li>
<?php }elseif($user_level > 8 ) {
$pending_reviews = $wpdb->query("SELECT id FROM aq_badge_submissions WHERE current_status = 'reviewing' ORDER BY submission_timestamp");
?>
<li class="submissions <?php if($section=='submissions') echo 'selected'; ?>">
<a href="http://aquapons.info/review/">
Submissions
<?php if($pending_reviews) { ?>
<span class="submission_count"><?php echo $pending_reviews ?></span>
<?php } ?>
</a>
</li>
<li class="class"><a href="http://aquapons.info/class?new">Your Classes</a></li>
<?php } ?>
<li><a href="/profile/">My Profile</a></li>
<li>or</li>
<li><a href="<?php echo wp_logout_url( home_url() ); ?>">Log Out</a></li>
<?php } else { ?>
<li><a href="/sign-in/?theme=<?php if($_GET['theme']) echo $_GET['theme']; else echo 'dev'; ?>">Sign In</a></li>
<li>or</li>
<li><a href="/sign-up/">Sign Up</a></li>
<?php } ?>
</ul>
</div><!--#main-nav-->
<?php
if($view!=null) $headerPath = "/templates/".$section."-".$view."-header.php";
else if($section) $headerPath = "/templates/".$section."-header.php";
else $headerPath = "/templates/default-header.php";
include(get_template_directory() . $headerPath);
?>
</header><!--header-->