Commit 81e321f3 authored by Ryan Wade's avatar Ryan Wade

Cleaned and added Comments

No functional changes
parent e545064e
<?php
//Create body of page
class Body
{
private $src = "";
......@@ -6,6 +7,7 @@
{
$this->src = $src;
}
//render src of page
public function render()
{
?>
......
<?php
//Create recursive list of links to current page and all parents until the HOME page (0) is reached
class Breadcrumb
{
private $SQL = null;
private $id = null;
private $title = "";
//$title is needed as special pages cannot be accessed from SQL database.
function Breadcrumb($SQL, $id, $title)
{
$this->SQL = $SQL;
......@@ -12,27 +14,19 @@
}
public function render()
{
/*$t_id = $this->id;
$t_title = $this->title;
$link = "<a class='breadcrumbLink' href='viewpage.php?id=".$t_id."'>".$t_title."</a>";
if($t_id != -1)
{
$t_id = $this->SQL->GET_PAGE($t_id).GET_ATTRIBUTE(1);
while($t_id != -1)
{
$t_title = $this->SQL->GET_PAGE($t_id).GET_ATTRIBUTE(2);//SQL get Title
$link = "<a class='breadcrumbLink' href='viewpage.php?id=".$t_id."'>".$t_title."</a>"." > ".$link;
$t_id = $this->SQL->GET_PAGE($t_id).GET_ATTRIBUTE(1);
}
}*/
//Create Link to current Page
$t_id = $this->id;
$t_title = $this->title;
$link = "<a class='breadcrumbLink' href='viewpage.php?id=".$t_id."'>".$t_title."</a>";
//Get Parent ID
$t_id = $this->SQL->GET_PAGE($t_id)->GET_ATTRIBUTE(1);
//If parent doesn't exist, end generation
while(($t_id !== -1)&&($t_id!==null))
{
//If parent exists, add to breadcrumb
$t_title = $this->SQL->GET_PAGE($t_id)->GET_ATTRIBUTE(2);
$link = "<a class='breadcrumbLink' href='viewpage.php?id=".$t_id."'>".$t_title."</a> > ".$link;
//Get parent id
$t_id = $this->SQL->GET_PAGE($t_id)->GET_ATTRIBUTE(1);
}
?>
......
<?php
//TODO, allow user to update elements of style with css "variables" that can be changed
class CSS
{
public function render()
......
<?php
//create footer
class Footer
{
//render footer
public function render()
{
?>
......
<?php
//Create a header
class Header
{
private $title = "";
......
<?php
//Create a navigation menu
class Nav
{
private $SQL = null;
private $s_id = null;
function Nav($SQL, $s_id)
{
$this->SQL = $SQL;
$this->s_id = $s_id;
}
//recursive function to build menu hierarchy
private function createLevel($level)
{
//Base case: if the level is empty
if(!isset($level))
return "";
//Create an unordered list for the level
$navbar = "\r\n<ul>\r\n";
//populate list with elements
foreach($level as $page)
{
$id=$page->GET_ATTRIBUTE(0);
//Highlight the selected page.
if($id==$this->s_id)
$linkType="NavSelected";
else
$linkType="NavLink";
$title=$page->GET_ATTRIBUTE(2);
//Add to navbar
$navbar .= "<li><a class='".$linkType."' href='viewpage.php?id=".$id."'>".$title."</a>";
if($id != 0)
$navbar .= $this->createLevel($this->SQL->QUERY_PARENT_ID($id));
......@@ -27,6 +37,7 @@
$navbar .= "</ul>\r\n";
return $navbar;
}
//Render navigation menu
public function render()
{
?>
......
<?php
//create sitemap
class Sitemap
{
private $SQL = null;
......@@ -6,15 +7,22 @@
{
$this->SQL = $SQL;
}
//recursive function to build sitemap hierarchy
private function createSitemap($level)
{
//Base case: if the level is empty
if(!isset($level))
return "";
//Create an unordered list for the level
$sitemap = "\r\n<ul>\r\n";
//populate list with elements
foreach($level as $page)
{
$id=$page->GET_ATTRIBUTE(0);
//Highlight the selected page.
$title=$page->GET_ATTRIBUTE(2);
//Add to sitemap
$sitemap .= "<li><a href='viewpage.php?id=".$id."'>".$title."</a>";
if($id != 0)
$sitemap .= $this->createSitemap($this->SQL->QUERY_PARENT_ID($id));
......@@ -23,6 +31,8 @@
$sitemap .= "</ul>\r\n";
return $sitemap;
}
//render sitemap
public function render()
{
?>
......
<?php
//Create page title
class Title
{
private $id = 0;
......@@ -12,8 +13,11 @@
$this->desc = $desc;
$this->img = $img;
}
//render title
function render()
{
{
//Case where title image is defined.
if($this->img != null)
{
?>
......@@ -27,6 +31,7 @@
</div>
<?php
}
//Case where image is not defined.
else
{
?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment