public function renderDefault() { $this->template->categories_count = mapper::categories()->countAll(); $this->template->manufacturers_count = mapper::manufacturers()->countAll(); $this->template->pages_count = mapper::pages()->countNotRef(); $this->template->products_count = mapper::products()->countAll(); $this->template->pictures_count = mapper::pictures()->countAll(); $this->template->orders_count = mapper::orders()->countAll(); $this->template->orders_initial_count = mapper::orders()->countWithInitialStatus(); }
public function beforeRender() { // curly brackets $this->template->registerFilter('Nette\\Templates\\CurlyBracketsFilter::invoke'); // texy $texy = new Texy(); $this->template->registerHelper('texy', array($texy, 'process')); // side $side = array(); $side['categories'] = mapper::categories()->findMain(); $side['manufacturers'] = mapper::manufacturers()->findAll(); $side['pages'] = mapper::pages()->findNotRef(); $side['cart'] = Environment::getSession(SESSION_ORDER_NS); $side['recent_products'] = Environment::getSession(SESSION_RECENTPRODUCTS_NS)->recent; $this->template->side = (object) $side; }
public function actionDefault($path = '', $page_number = 0, $letter = NULL) { // get nice name $path = explode('/', rtrim($path, '/')); $last = array_pop($path); $rest = implode('/', $path); // what's with rest? if (!empty($rest)) { $this->redirect(301, 'this', $last); $this->terminate(); return; } // default page? if (empty($last)) { $this->setView('default'); $this->template->path = ''; $this->template->page = NULL; return; } $this->template->path = $last; // try to find it in database $page = mapper::pages()->findByNiceName($last); $this->template->page = $page; if ($page === NULL) { $this->setView('notfound'); Environment::getHttpResponse()->setCode(404); } else { if ($page->getRef() === NULL) { $this->setView('page'); } else { $this->setView(get_class($page->getRef())); $this->template->{get_class($page->getRef())} = $page->getRef(); $this->template->letter = $letter; $this->template->have_letter = TRUE; } $this->template->title = $page->getName(); } $this->template->page_number = $page_number; }
public function onPageEditSubmit(Form $form) { if (!$form->isValid()) { return; } mapper::pages()->updateOne($form->getValues()); adminlog::log(__('Updated page "%s"'), $form['nice_name']->getValue()); $this->redirect('pages'); $this->terminate(); }