-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aa2f617
Showing
24 changed files
with
9,751 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php require_once("libmydb.php"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
class HtmlElement | ||
{ | ||
private $_attributes, | ||
$_content; | ||
public $_tohtml, | ||
$_toBody = 0, | ||
$_tag; | ||
|
||
public function setTag($tag) | ||
{ | ||
if (isset($tag)) | ||
$this->_tag = $tag; | ||
} | ||
|
||
public function getTag() | ||
{ | ||
return ($this->_tag); | ||
} | ||
|
||
public function addAttribute($key, $value) | ||
{ | ||
if (isset($key) && isset($value)) | ||
{ | ||
$this->_attributes[$key] = $value; | ||
} | ||
} | ||
|
||
public function addContent($string) | ||
{ | ||
$this->_content = $string; | ||
} | ||
|
||
public function prepareTag() | ||
{ | ||
if ($this->_tag) | ||
$tag = $this->_tag; | ||
else | ||
$tag = ""; | ||
|
||
return ($tag); | ||
} | ||
|
||
public function prepareAttributes() | ||
{ | ||
if ($this->_attributes) | ||
{ | ||
$count_attributes = count($this->_attributes); | ||
$i = 0; | ||
$attributes = ""; | ||
|
||
foreach ($this->_attributes as $key => $value) | ||
{ | ||
if ($i == $count_attributes - 1) | ||
$attributes .= ' '.$key.'="'.$value.'"'; | ||
else | ||
$attributes .= ' '.$key.'="'.$value.'"'; | ||
$i++; | ||
} | ||
} | ||
else | ||
$attributes = ""; | ||
|
||
return ($attributes); | ||
} | ||
|
||
public function prepareContent() | ||
{ | ||
if ($this->_content) | ||
$content = $this->_content; | ||
else | ||
$content = ""; | ||
|
||
return ($content); | ||
} | ||
|
||
public function toHtml() | ||
{ | ||
$tag = $this->prepareTag(); | ||
$attributes = $this->prepareAttributes(); | ||
$content = $this->prepareContent(); | ||
|
||
if ($tag != "") | ||
{ | ||
$this->_tohtml = "<".$tag.$attributes.">".$content."</".$tag.">"; | ||
|
||
if ($tag == "meta" || $tag == "link") | ||
$this->_tohtml = "<".$tag.$attributes." />"; | ||
} | ||
else | ||
$this->_tohtml = $content; | ||
|
||
return ("\t\t".$this->_tohtml."\n"); | ||
} | ||
|
||
public function toBody() | ||
{ | ||
$this->_toBody = 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
class HtmlLink extends HtmlElement | ||
{ | ||
public function toHtml() | ||
{ | ||
parent::toHtml(); | ||
|
||
$attributes = $this->prepareAttributes(); | ||
$content = $this->prepareContent(); | ||
|
||
$this->_tohtml = "<a".$attributes.">".$content."</a>"; | ||
|
||
return ($this->_tohtml); | ||
} | ||
|
||
public function getLinkUrl() | ||
{ | ||
return ($this->toHtml()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
class HtmlList extends HtmlElement | ||
{ | ||
private $_content; | ||
|
||
public function toHtml() | ||
{ | ||
parent::prepareAttributes(); | ||
$attributes = $this->prepareAttributes(); | ||
$content = $this->prepareContent(); | ||
|
||
$this->_tohtml = "\n\t\t<ul".$attributes.">".$content."\t\t</ul>"; | ||
|
||
return ($this->_tohtml); | ||
} | ||
|
||
public function addItem(HtmlListItem $item) | ||
{ | ||
$this->_content[] = "\n\t".$item->toHtml(); | ||
} | ||
|
||
public function prepareContent() | ||
{ | ||
$content = ""; | ||
|
||
if ($this->_content) | ||
{ | ||
foreach ($this->_content as $value) | ||
$content .= $value; | ||
} | ||
|
||
return ($content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class HtmlListItem extends HtmlElement | ||
{ | ||
public $_tohtml; | ||
|
||
public function SetContent($string) | ||
{ | ||
$this->addContent($string); | ||
|
||
return ($this->toHtml()); | ||
} | ||
|
||
public function prepareTag() | ||
{ | ||
if ($this->_tag) | ||
$tag = $this->_tag; | ||
else | ||
$tag = "li"; | ||
|
||
return ($tag); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
class HtmlParagraph extends HtmlElement | ||
{ | ||
public function toHtml() | ||
{ | ||
parent::toHtml(); | ||
|
||
$attributes = $this->prepareAttributes(); | ||
$content = $this->prepareContent(); | ||
|
||
$this->_tohtml = "<p".$attributes.">".$content."</p>"; | ||
|
||
return ($this->_tohtml); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
class HtmlTable extends HtmlElement | ||
{ | ||
private $_content, | ||
$_caption; | ||
public $_tag; | ||
|
||
public function toHtml() | ||
{ | ||
parent::prepareAttributes(); | ||
$attributes = $this->prepareAttributes(); | ||
$content = $this->prepareContent(); | ||
|
||
$this->_tohtml = "\n\t\t<table".$attributes.">\n\t\t\t".$this->_caption.$content."\t\t</table>\n"; | ||
|
||
return ($this->_tohtml); | ||
} | ||
|
||
public function addItem(HtmlTableRow $row) | ||
{ | ||
$this->_content[] = $row->toHtml(); | ||
} | ||
|
||
public function prepareContent() | ||
{ | ||
$content = ""; | ||
|
||
if ($this->_content) | ||
{ | ||
foreach ($this->_content as $value) | ||
$content .= $value; | ||
} | ||
$this->_content = $content; | ||
|
||
return ($this->_content); | ||
} | ||
|
||
public function setCaption($caption) | ||
{ | ||
if (isset($caption)) | ||
$this->_caption = '<caption>'.$caption."</caption>\n"; | ||
} | ||
|
||
public function getTableNumRows() | ||
{ | ||
if ($this->_content) | ||
{ | ||
return (count($this->_content)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class HtmlTableCell extends HtmlElement | ||
{ | ||
public $_tohtml; | ||
|
||
public function SetContent($string) | ||
{ | ||
$this->addContent($string); | ||
|
||
return ($this->toHtml()); | ||
} | ||
|
||
public function prepareTag() | ||
{ | ||
if ($this->_tag) | ||
$tag = $this->_tag; | ||
else | ||
$tag = "td"; | ||
|
||
return ($tag); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
class HtmlTableRow extends HtmlElement | ||
{ | ||
private $_content; | ||
|
||
public function toHtml() | ||
{ | ||
parent::prepareAttributes(); | ||
$attributes = $this->prepareAttributes(); | ||
$content = $this->prepareContent(); | ||
|
||
$this->_tohtml = "\t\t\t<tr".$attributes.">\n".$content."\t\t\t</tr>\n"; | ||
|
||
return ($this->_tohtml); | ||
} | ||
|
||
public function addItem(HtmlTableCell $cell) | ||
{ | ||
$this->_content[] = "\t\t".$cell->toHtml(); | ||
} | ||
|
||
public function prepareContent() | ||
{ | ||
$content = ""; | ||
|
||
if ($this->_content) | ||
{ | ||
foreach ($this->_content as $value) | ||
$content .= $value; | ||
} | ||
|
||
return ($content); | ||
} | ||
} |
Oops, something went wrong.