contributions/usermanagement/controller/base/dashboard.base.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Dashboard base class 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Usermanagement 00007 */ 00008 class DashboardBase implements IDashboard { 00009 /** 00010 * USer 00011 * 00012 * @var DAOUsers 00013 */ 00014 protected $user = null; 00015 00016 public function __construct($user) { 00017 $this->user = $user; 00018 } 00019 00020 /** 00021 * Returns user 00022 * 00023 * @return DAOUsers 00024 */ 00025 protected function get_user() { 00026 return $this->user; 00027 } 00028 00029 /** 00030 * Returns the title of the dashboard 00031 */ 00032 public function get_title() { 00033 return tr('Your links', 'users'); 00034 } 00035 00036 /** 00037 * Returns description of dashboard 00038 */ 00039 public function get_description() { 00040 return ''; 00041 } 00042 00043 /** 00044 * Create a view to render 00045 */ 00046 public function get_content($page_data) { 00047 $view = ViewFactory::create_view(IViewFactory::MESSAGE, $this->get_template_file_name(), $page_data); 00048 $this->prepare_view($view, $page_data); 00049 return trim($view->render()); 00050 } 00051 00052 /** 00053 * Return template file name for dashboard 00054 * 00055 * @return string 00056 */ 00057 protected function get_template_file_name() { 00058 throw new Exception('get_template_file_name() not implemented on ' . get_class($this)); 00059 } 00060 00061 /** 00062 * Allwos subclasses to prepare the view 00063 * 00064 * @param IView $view 00065 * @param PageData $page_data 00066 */ 00067 protected function prepare_view($view, $page_data) { 00068 $view->assign('dashboard', $this); 00069 $view->assign('user', $this->get_user()); 00070 } 00071 00072 /** 00073 * Return array of entries for user menu 00074 */ 00075 public function get_user_menu_entries() { 00076 return array(); 00077 } 00078 }