mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-26 13:01:09 -05:00
git-subtree-dir: TriviaTime git-subtree-mainline: 3551587ecdefc75e34b8b2a87d91a466bdf4c764 git-subtree-split: ae216897cd9c45259853c3f84eae826f344482aa
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
class IndexController extends Controller
|
|
{
|
|
public function indexAction() {
|
|
$container = $this->container;
|
|
$storage = $container->getStorage();
|
|
|
|
$errorsQ = array();
|
|
$resultQ = array();
|
|
try {
|
|
$resultQ = $storage->getRecentAskedQuestions();
|
|
} catch(StorageSchemaException $e) {
|
|
$errorsQ[] = "Error: Database schema is not queryable";
|
|
} catch(StorageConnectionException $e) {
|
|
$errorsQ[] = "Error: Database is not available";
|
|
}
|
|
|
|
$errorsA = array();
|
|
$resultA = array();
|
|
try {
|
|
$resultA = $storage->getRecentActivities();
|
|
} catch(StorageSchemaException $e) {
|
|
$errorsA[] = "Error: Database schema is not queryable";
|
|
} catch(StorageConnectionException $e) {
|
|
$errorsA[] = "Error: Database is not available";
|
|
}
|
|
$storage->close();
|
|
|
|
$values = array();
|
|
|
|
$values['resultQuestions'] = $resultQ;
|
|
$values['errorsQuestions'] = $errorsQ;
|
|
$values['resultActivities'] = $resultA;
|
|
$values['errorsActivities'] = $errorsA;
|
|
|
|
$container->setTitle('Home');
|
|
|
|
$container->render('home.html.php', $values);
|
|
}
|
|
}
|