public function pollList($data) { $wdata['page_url'] = $data['page_url']; $item = intval(Input::get('item')); if ($item) { $wdata['poll'] = PollModel::getByID($item); if (!$wdata['poll']) { throw new Exception("Poll not found #{$item}"); } } else { $wdata['poll'] = PollModel::getLast(); if (!$wdata['poll']) { throw new Exception("Polls not found"); } } $wdata['voted'] = PollModel::ivoted($wdata['poll']->id); if ($wdata['voted']) { $wdata['poll'] = PollModel::getWithVotes($wdata['poll']->id); } $wdata['polls'] = PollModel::getList($wdata['poll']->id); if ($wdata['poll']) { Template::setPageTitle($wdata['poll']->title, true); } $data['page']->text .= Template::moduleView($this->module_name, 'views.pollList', $wdata); return PageView::defaultView($data); }
public function unsubscribe($code) { \NewsletterModel::where('hash', $code)->update(array('enabled' => 0)); return (new \PageController())->createPageFrom(function () { Template::setPageTitle('Newsletter'); Template::clearBreadCrumbs(); Template::addBreadCrumb('/', 'Home'); Template::addBreadCrumb('#', 'Newsletter'); return View::make(Newsletter::$view_unsub); }); }