ProfileController.php (1021B)
1 <?php 2 3 class ProfileController extends Controller 4 { 5 /** 6 * Construct this object by extending the basic Controller class 7 */ 8 public function __construct() 9 { 10 parent::__construct(); 11 } 12 13 /** 14 * This method controls what happens when you move to /overview/index in your app. 15 * Shows a list of all users. 16 */ 17 public function index() 18 { 19 $this->View->render('profile/index', array( 20 'users' => UserModel::getPublicProfilesOfAllUsers()) 21 ); 22 } 23 24 /** 25 * This method controls what happens when you move to /overview/showProfile in your app. 26 * Shows the (public) details of the selected user. 27 * @param $user_id int id the the user 28 */ 29 public function showProfile($user_id) 30 { 31 if (isset($user_id)) { 32 $this->View->render('profile/showProfile', array( 33 'user' => UserModel::getPublicProfileOfUser($user_id)) 34 ); 35 } else { 36 Redirect::home(); 37 } 38 } 39 }