<?php
class Home extends Page
{
function setMenu()
$this->menu_text = 'Home';
$this->menu_image = 'far fa-home';
$this->menu_priority = 0;
}
function index()
$u = new User();
$this->set('userdata', $u->getAll());
//return $this->renderPagecontent();
if(!$_SESSION['user'])
$this->set('template', 'home-nouser.html');
return;
else {
$dogs = $_SESSION['user']->data['dogs'];
$doggos = [];
foreach($dogs as $key => $dogid)
$dog = new Dog();
try{
$dog->load($dogid);
catch(Exception $e)
error_log("Dog $dogid not found. Deleting from user");
unset($_SESSION['user']->data['dogs'][$key]);
$_SESSION['user']->save();
continue;
if($dog->data)
$doggos[] = array_merge($dog->data,['id'=>$dogid]);
$this->set('doggos',$doggos);
//var_dump($doggos);
$this->set('template', "home.html");
function maySeeThisPage(){return true;}