/** * This function builds the main structure in HTML. * * @access public * @author kalmer:piiskop <*****@*****.**> * @param string $parameters['address'] * the address * @param string $parameters['blogDate'] * the date of the blog * @param string $parameters['blogEntry'] * the blog entry * @param Human $parameters['designer'] * the designer * @param string $parameters['menu'] * the body * @param string $parameters['phoneNumber'] * the phone number * @param string $parameters['title'] * the title * @param string $parameters['twitter'] * the Twitter-time * @return string the parsed HTML-structure * @uses BEGINNING_OF_URL for links * @uses \pstk\ErrorView for displaying error messages * @uses MENU_COMMON for the common menu * @uses MENU_SIDE for the menu in sidebar */ public static function buildView($parameters) { require_once 'HTML/Template/IT.php'; require_once dirname(__FILE__) . '/../php/ErrorView.php'; \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new \pstk\ErrorView(), 'raiseError')); $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'html'); $tpl->loadTemplatefile('particle-template.html'); if (isset($parameters['menus'])) { if (isset($parameters['menus'][MENU_COMMON])) { $tpl->setCurrentBlock('common-menu'); $tpl->setVariable(array('COMMON-MENU' => $parameters['menus'][MENU_COMMON])); $tpl->parse('common-menu'); } if (isset($parameters['menus'][MENU_SIDE])) { $tpl->setCurrentBlock('menu-in-sidebar'); $tpl->setVariable(array('MENU-IN-SIDEBAR' => $parameters['menus'][MENU_SIDE])); $tpl->parse('menu-in-sidebar'); } } if (isset($parameters['posts'])) { $tpl->setCurrentBlock('posts'); $tpl->setVariable(array('POSTS' => $parameters['posts'])); $tpl->parse('posts'); } require_once dirname(__FILE__) . '/Model.php'; $model = new Model(); $model->setComplete(); require_once dirname(__FILE__) . '/../php/CssView.php'; $tpl->setCurrentBlock('html'); $tpl->setVariable(array('ACTION' => '', 'BEGINNING-OF-URL' => BEGINNING_OF_URL, 'FOLLOW-ME' => $model->translate(array('property' => 'followMe')), 'HEADING' => $parameters['title'], 'OLDER-POSTS' => $model->translate(array('property' => 'olderPosts')), 'NEWER-POSTS' => $model->translate(array('property' => 'newerPosts')), 'SEARCH' => \pstk\String::translate('search'), 'SUBSCRIBE' => $model->translate(array('property' => 'subscribe')), 'STYLE' => \pstk\CssView::buildCss(array('fileName' => 'particle-template')), 'TITLE' => mb_strtoupper($parameters['title'], 'UTF-8'))); $tpl->parse('html'); return $tpl->get('html'); }
/** * This function builds the main structure in HTML. * * @access public * @author kalmer:piiskop <*****@*****.**> * @param string $parameters['address'] * the address * @param string $parameters['blogDate'] * the date of the blog * @param string $parameters['blogEntry'] * the blog entry * @param Human $parameters['designer'] * the designer * @param string[int] $parameters['logos'] * the logos * @param string[int] $parameters['menus'] * the menus * @param string $parameters['phoneNumber'] * the phone number * @param string[int] $parameters['services'] * the services * @param string $parameters['title'] * the title * @param string $parameters['twitter'] * the Twitter-time * @return string the parsed HTML-structure * @uses BEGINNING_OF_URL for links * @uses \pstk\ErrorView for building the error message * @uses MENU_COMMON for the common menu * @uses MENU_OUTER for the menu of outer links * @uses MENU_INNER for the menu of inner links */ public static function buildView($parameters) { require_once 'HTML/Template/IT.php'; require_once dirname(__FILE__) . '/../php/ErrorView.php'; \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new \pstk\ErrorView(), 'raiseError')); $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'html'); $tpl->loadTemplatefile('from-design-to-web-template.html'); if (isset($parameters['logos'])) { $tpl->setCurrentBlock('logos'); $tpl->setVariable(array('LOGO' => $parameters['logos'])); $tpl->parse('logos'); } if (isset($parameters['menus'])) { if (isset($parameters['menus'][MENU_COMMON])) { $tpl->setCurrentBlock('menu-items'); $tpl->setVariable(array('MENU-ITEMS' => $parameters['menus'][MENU_COMMON])); $tpl->parse('menu-items'); // echo ' 190: ', $tpl->get('menu-items'); } if (isset($parameters['menus'][MENU_OUTER])) { $tpl->setCurrentBlock('outer-links'); $tpl->setVariable(array('OTHER' => \pstk\String::translate('other'), 'LINKS' => \pstk\String::translate('links'), 'OUTER-LINKS' => $parameters['menus'][MENU_OUTER])); $tpl->parse('outer-links'); } if (isset($parameters['menus'][MENU_INNER])) { $tpl->setCurrentBlock('inner-links'); $tpl->setVariable(array('INNER-LINK' => $parameters['menus'][MENU_INNER])); $tpl->parse('inner-links'); } } if (isset($parameters['services'])) { $tpl->setCurrentBlock('services'); $tpl->setVariable(array('SERVICES' => $parameters['services'])); $tpl->parse('services'); } require_once dirname(__FILE__) . '/../php/CssView.php'; $tpl->setCurrentBlock('html'); $tpl->setVariable(array('ACTION' => '', 'ADDRESS' => $parameters['address'], 'BEGINNING-OF-URL' => BEGINNING_OF_URL, 'BLOG-DATE' => date('m.d.Y', strtotime($parameters['blogDate'])), 'BLOG-ENTRY' => $parameters['blogEntry'], 'LATEST' => \pstk\String::translate('latest'), 'BLOG' => \pstk\String::translate('blog'), 'HREF-OF-BLOG' => BLOG, 'CALL-US' => \pstk\String::translate('callUs'), 'NOW' => \pstk\String::translate('now'), 'EMAIL-OF-DESIGNER' => $parameters['designer']->getEmail(), 'HREF-OF-DESIGNER' => $parameters['designer']->getHref(), 'LABEL-OF-DESIGNER' => $parameters['designer']->getLabel(), 'NAME-OF-DESIGNER' => \str_replace(' ', ' ', $parameters['designer']->getName()), 'HREF-OF-VIDEOS' => VIDEOS, 'PHONE-NUMBER' => $parameters['phoneNumber'], 'QUICK' => \pstk\String::translate('quick'), 'VIDEOS' => \pstk\String::translate('videos'), 'HEADING-TO-VIDEOS' => \pstk\String::translate('headingToVideos'), 'SEARCH' => \pstk\String::translate('search'), 'STYLE' => \pstk\CssView::buildCss(array('fileName' => 'from-design-to-web-template')), 'TIME' => \tuts\View::findDifference(array('timestampInPast' => $parameters['twitter'])), 'TITLE' => $parameters['title'], 'TWITTER' => \pstk\String::translate('twitter'), 'FEED' => \pstk\String::translate('feed'), 'LIKE' => \pstk\String::translate('like'), 'OUR' => \pstk\String::translate('our'), 'LOCATION' => \pstk\String::translate('location'), 'DESIGNED-BY' => \pstk\String::translate('designedBy'))); $tpl->parse('html'); return $tpl->get('html'); }