Go live.
[readifood.git] / propel / build / classes / ReadifoodObject.php
1 <?php
2
3   class ReadifoodObject extends BaseObject {
4     function getURL() {
5       $class = get_class($this->getPeer());
6       return sprintf("/%s/%s/%d", urlencode(strtolower($class::OM_CLASS)), urlencode($this->getName()), $this->getId());
7     }
8
9     function getLink($blurb = null, $url = null, $classes = null) {
10       if (is_null($classes)) $classes = array();
11       else if (! is_array($classes)) $classes = array($classes);
12       return sprintf("<a %shref=\"%s\">%s</a>", (count($classes)) ? " class=\"" . join(" ", $classes) . "\"" : "", (isset($url)) ? $url : $this->getURL(), (isset($blurb)) ? htmlspecialchars($blurb) : htmlspecialchars($this->getName()));
13     }
14
15     function getStrongLink($blurb = null, $url = null) {
16       return $this->getLink($blurb, $url, "strong");
17     }
18
19     function getActionLink($action, $blurb, $classes = null) {
20       if (is_null($classes)) $classes = array();
21       else if (! is_array($classes)) $classes = array($classes);
22       return $this->getLink($blurb, sprintf("%s/%s", $this->getURL(), urlencode($action)), array_unique(array_merge($classes, array("small"))));
23     }
24
25     function getDeleteLink() {
26       return $this->getActionLink("delete", "Delete", "delete");
27     }
28   }
29
30 ?>