public function process($parameters) { $userManager = new UserManager(); $articleManager = new ArticleManager(); $parsedURL = $this->parseURL($parameters[0]); //predanie URL do funkcie //zobrazenie uvodnej stranky if (empty($parsedURL[0])) { $frontPageContentManager = new frontPageContentManager(); $this->data['user'] = $userManager->returnUserName(); $this->data['title'] = 'Coding - Programovanie, Novinky, Software, Hardware'; $this->data['key_words'] = 'Programovanie, Novinky, Software, Hardware, Blog, Spravodajstvo'; $this->data['description'] = 'blog, články o programovaní, novinky zo sveta IT, rôzne zaujímavosti'; $this->data['messages'] = $this->returnMessages(); $this->data['topArticles'] = $articleManager->returnTopArticles(); $this->data['topArticlesTiles'] = $frontPageContentManager->returnLastArticles(); $this->view = 'frontPage'; } else { $controllerClass = $this->camelCase(array_shift($parsedURL)) . 'Controller'; //spracovanie URL na parametre, volanie pozadovaneho kontroleru if (file_exists('controllers/' . $controllerClass . '.php')) { //ak existuje kontroler z URL $this->controller = new $controllerClass(); } else { $this->redirect('chyba'); } //ak neexistuje, presmeruj na chybove hlasenie $this->controller->process($parsedURL); //spracovanie ostatnych parametrov vo vnorenom kontroleri //predanie premennych do hlavnej sablony $this->data['user'] = $userManager->returnUserName(); $this->data['loggedUser'] = $userManager->returnUser(); $this->data['title'] = $this->controller->head['title']; $this->data['key_words'] = $this->controller->head['key_words']; $this->data['description'] = $this->controller->head['description']; $this->data['messages'] = $this->returnMessages(); $this->data['topArticles'] = $articleManager->returnTopArticles(); $this->view = 'layout'; //nastavenie hlavnej sablony } }
public function topArticles() { $articleManager = new ArticleManager(); return $articleManager->returnTopArticles(); }