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
|
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initDoctype() {
$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
}
protected function _initMenu() {
$this->bootstrap('view');
$view = $this->getResource('view');
$view->placeholder('menu')
->setPrefix("<div id=\"menu\">")
->setPostfix("</div>");
}
protected function _initfFooter() {
$this->bootstrap('view');
$view = $this->getResource('view');
$view->placeholder('footer')
->setPrefix("<div id=\"footbox\"><div id=\"foot\">")
->setPostfix("<div class=\"cleaner\"></div></div></div>");
}
public function toText($array) {
foreach ($array as $object) {
if ($object->getText_cz() == 1) {
return "Ano";
} else
return "Ne";
}
}
}
class General {
public static function getPerex($text) {
if (strlen($text) > 200) {
$firstPor = substr($text, 0, 200);
$space = strrpos($firstPor, " ");
return substr($firstPor, 0, $space) . " ...";
} return $text;
}
public static function toText($value) {
if ($value == 1) {
return "Ano";
} else
return "Ne";
}
public static function addToCookie($id) {
$session = new Zend_Session_Namespace('favorites');
$session->setExpirationSeconds(2592000);
if (is_numeric($id)) {
//check if id is not in already
for ($i = 0; $i < count($session->favorites); $i++) {
if ($session->favorites[$i] == $id) {
return;
}
}
$session->favorites[] = $id;
} return;
}
public static function isInFavorites($id) {
if (is_numeric($id) && $id != null) {
$session = new Zend_Session_Namespace('favorites');
for ($i = 0; $i < count($session->favorites); $i++) {
if ($session->favorites[$i] == $id) {
return true;
}
}
}
return false;
}
public static function removeFromCookie($id) {
if (General::isInFavorites($id)) {
$temp = array();
$session = new Zend_Session_Namespace('favorites');
for ($i = 0; $i < count($session->favorites); $i++) {
if ($session->favorites[$i] != $id) {
$temp[] = $session->favorites[$i];
}
}
$session->favorites = $temp;
}
}
}
|