-
Notifications
You must be signed in to change notification settings - Fork 4
/
AP-IndividualProject.php
123 lines (93 loc) · 4.99 KB
/
AP-IndividualProject.php
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
<?php /* Template Name: Individual Project */ ?>
<? get_header(); ?>
<div id="main-content" class="main-content">
<?php
if (is_front_page() && twentyfourteen_has_featured_posts()) {
// Include the featured content template.
get_template_part('featured-content');
}
// Get Project from URL
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$passed_project = array_slice(explode('/', $url), -2)[0];
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<article id="post-1" class="post-1 post type-post status-publish format-standard hentry category-uncategorized">
<?php
// Get Projects
$query = new AirpressQuery("Projects", $GLOBALS['config_name']);
$query->filterByFormula("{Slug}='$passed_project'");
$projects = new AirpressCollection($query);
// Get this project
$this_project = $projects[0];
// Get project name
$project_name = $this_project["Project Name"];
if (!empty($this_project["Confluence Link"])) {
$project_confluence = "<a target='_blank' href='" . $this_project["Confluence Link"] . "'>Confluence</a>";
} else {
$project_confluence = "No Confluence link";
}
if (!empty($this_project["Figma Workspace"])) {
$project_figma = "<a target='_blank' href='" . $this_project["Figma Workspace"] . "'>Figma Workspace</a>";
} else {
$project_figma = "No Figma workspace";
}
$links_area = $project_confluence . " | "
. $project_figma;
$portfolio_card = return_project_card("yes", $GLOBALS['projects_base_folder'], "", $project_name, " ", " ", " ", " ", $links_area, "", "", "", "");
?>
<header class="entry-header">
<?php
echo $portfolio_card;
?>
<!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<?php
// Get all the epics within project
$query = new AirpressQuery("Epics", $GLOBALS['config_name']);
$query->filterByFormula("{Associated Projects}='$project_name'");
$query->sort("Epic Name", "asc");
$epics = new AirpressCollection($query);
// Create epics display
if (!is_airpress_empty($epics)) {
$num_templates = count($epics);
$epics_display = "<h2>" . $num_templates . " Epic(s) In Project</h2>";
foreach ($epics as $template) {
$view_link = $GLOBALS['epics_base_folder'] . $template["Slug"];
$T_Name = $template["Epic Name"];
$epics_display .= "<li><h4><a href='" . $view_link . "'>" . $T_Name . "</a></h4></li>";
}
} else {
echo "<p>There are no epics associated with this project</p>";
}
// Get all the templates used by project
$query = new AirpressQuery("Templates", $GLOBALS['config_name']);
$query->filterByFormula("{Associated Projects}='$project_name'");
$templates = new AirpressCollection($query);
$templates->populateRelatedField("Associated Epics", "Epics");
// Create templates display
if (!is_airpress_empty($templates)) {
$num_templates = count($templates);
$templates_display = "<h2>" . $num_templates . " Template(s) Used</h2>";
foreach ($templates as $template) {
$view_link = $GLOBALS['templates_base_folder'] . $template["Slug"];
$T_Name = $template["Template Name"];
$T_Epic = $template["Associated Epics"][0]["Epic Name"];
$templates_display .= "<li><h4><a href='" . $view_link . "'>" . $T_Name . "</a></h4></li><p>" . $T_Epic . "</p>";
}
} else {
echo "<p>There are no templates associated with this project</p>";
}
//// BUILD PAGE
echo "<ul>" . $epics_display . "</ul><p> </p><ol>$templates_display</ol>";
?>
</div>
</article>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar('content'); ?>
</div><!-- #main-content -->
<?php
get_sidebar();
get_footer();