diff --git a/include/class-PageHome.php b/include/class-PageHome.php index a51c9c1..2735209 100644 --- a/include/class-PageHome.php +++ b/include/class-PageHome.php @@ -1,61 +1,68 @@ . /** * Homepage of my website */ class PageHome extends Page { - /** - * User requested by ID - */ - public $requestedUser = false; - /** * Do something at startup * * @override */ protected function prepare() { + // must be logged-in + require_permission( 'backend' ); + // read the ID from the query string or zero $id = $_GET['id'] ?? 0; // make sure that it's an integer $id = (int) $id; // if it's non-zero if( $id ) { // query the User with that ID (or get NULL) $this->requestedUser = ( new QueryUser() ) ->whereUserID( $id ) ->queryRow(); } } /** - * Get the requested User (if any!) + * Get a generator of my apps * - * @return User|null + * @generator */ - public function getRequestedUser() { - return $this->requestedUser; + public function myAppsGenerator() { + + return ( new QueryAppUser() ) + ->select( [ + 'app.app_ID', + 'app_name', + ] ) + ->whereUserIsMe() + ->joinApp() + ->queryGenerator(); + } } diff --git a/www/index.php b/www/index.php index 1e1b3b0..a2a3e9a 100644 --- a/www/index.php +++ b/www/index.php @@ -1,35 +1,33 @@ . // load everything require '../load.php'; // this is the homepage (the business logic of this page it's in this class) -$page = new PageHome( [ - 'title' => __( "Welcome!" ), -] ); +$page = new PageHome(); // I want this stylesheet enqueue_js( 'my-style'); // print site header $page->printHeader(); ?> printFooter();