public static function sortableFunction($argument) { $k = \Ammonio\Core\Kernel::get_instance(); $params = $k->getRequest()->params; if ($params['sort'] == 'ASC') { $sort = 'DESC'; $sort_span = '<span class="glyphicon glyphicon-sort-by-attributes"></span>'; } else { $sort = 'ASC'; $sort_span = '<span class="glyphicon glyphicon-sort-by-attributes-alt"></span>'; } $href = '<a href="'; $href .= "/" . $params['controller'] . "?order=" . $argument . "&sort=" . $sort; if (isset($params['q'])) { $href .= '&q=' . $params['q']; } if (isset($params['pag'])) { $href .= '&pag=' . $params['pag']; } $href .= '">' . strtoupper($argument); if ($params['order'] == $argument) { $href .= $sort_span; } $href .= '</a>'; return $href; }
public static function preRenderHook() { $k = \Ammonio\Core\Kernel::get_instance(); $conf = \Ammonio\Core\ConfigHolder::get_instance(); $mobile_device = array('iphone', 'ipad', 'ipod', 'blackberry', 'android'); // $mobile_device = array('mozilla', 'chrome', 'safari'); return array('credential' => $k->credential, 'conf' => $conf, 'request' => $k->getRequest(), 'ua' => $k->getRequest()->getHeader('User-Agent'), 'mobile_device' => $mobile_device); }
function logout($params) { $authenticator = new \Ammonio\Authentication\PlainAuthenticator(); $authenticator->logout(); $k = \Ammonio\Core\Kernel::get_instance(); $k->sessionHandler->invalidate(); // return $this->redirectToAction('auth', 'index', array('txt' => 'Logout effettuato')); $this->redirectToURI('/'); }
/** @Cacheable */ function sitemap() { $k = \Ammonio\Core\Kernel::get_instance(); $k->content_type = 'text/xml'; $url = array(array('loc' => 'http://www.sandbox.it', 'lastmod' => '2013-04-02', 'changefreq' => 'weekly', 'priority' => '1.0')); $url[] = array('loc' => 'http://www.sandbox.it/it/example'); print '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; print '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n"; foreach ($url as $u) { print '<url>' . "\n"; print '<loc>' . $u['loc'] . '</loc>' . "\n"; if ($u['lastmod'] != null) { print '<lastmod>' . $u['lastmod'] . '</lastmod>'; } if ($u['changefreq'] != null) { print '<changefreq>' . $u['changefreq'] . '</changefreq>'; } if ($u['priority'] != null) { print '<priority>' . $u['priority'] . '</priority>'; } print "</url>\n"; } print '</urlset>'; }
function handleUploads($params) { $k = \Ammonio\Core\Kernel::get_instance(); $r = $k->UploadService->uploadFile($params); print json($r); }