/**
  * Mobile Access Homepage
  *
  */
 function index()
 {
     $pinned_project_ids = PinnedProjects::findProjectIdsByUser($this->logged_user);
     if (is_foreachable($pinned_project_ids)) {
         $pinned_projects = Projects::findByIds($pinned_project_ids);
     } else {
         $pinned_projects = null;
     }
     // if
     $this->smarty->assign(array("pinned_projects" => $pinned_projects));
 }
 /**
  * Show dashboard overview
  *
  * @param void
  * @return null
  */
 function index()
 {
     // Welcome message, displayed only to administrators
     if ($this->logged_user->isAdministrator() && ConfigOptions::getValue('show_welcome_message')) {
         $this->wireframe->addPageAction(lang('Hide Welcome Message'), assemble_url('admin_settings_hide_welcome_message'), null, array('method' => 'post', 'confirm' => lang('You are about to hide welcome message. If you wish to bring it back later on you can do it from General settings page in Administration. Hide now?')));
         $this->smarty->assign(array('show_welcome_message' => true, 'available_modules' => Modules::findNotInstalled()));
         //BOF: task 05 | AD
         $this->wireframe->addPageAction(lang('View All'), assemble_url('view_projects_info'));
         //EOF: task 05 | AD
         // Regular dashboard
     } else {
         if (Project::canAdd($this->logged_user)) {
             $this->wireframe->addPageAction(lang('New Project'), assemble_url('projects_add'));
             //BOF: task 05 | AD
             $this->wireframe->addPageAction(lang('View All'), assemble_url('view_projects_info'));
             //EOF: task 05 | AD
         }
         // if
         $this->wireframe->addRssFeed($this->owner_company->getName() . ' - ' . lang('Recent activities'), assemble_url('rss', array('token' => $this->logged_user->getToken(true))), FEED_RSS);
         $pinned_project_ids = PinnedProjects::findProjectIdsByUser($this->logged_user);
         if (is_foreachable($pinned_project_ids)) {
             $pinned_projects = Projects::findByIds($pinned_project_ids);
         } else {
             $pinned_projects = null;
         }
         // if
         $dashboard_sections = new NamedList();
         event_trigger('on_dashboard_sections', array(&$dashboard_sections, &$this->logged_user));
         $important_items = new NamedList();
         event_trigger('on_dashboard_important_section', array(&$important_items, &$this->logged_user));
         $this->smarty->assign(array('show_welcome_message' => false, 'important_items' => $important_items, 'pinned_projects' => $pinned_projects, 'dashboard_sections' => $dashboard_sections, 'online_users' => Users::findWhoIsOnline($this->logged_user), 'grouped_activities' => group_by_date(ActivityLogs::findActiveProjectsActivitiesByUser($this->logged_user, 20), $this->logged_user)));
     }
     // if
     //BOF:mod 20110623
     $tabs = new NamedList();
     $tabs->add('dashboard', array('text' => 'Active Teams', 'url' => assemble_url('dashboard')));
     $tabs->add('home_page', array('text' => 'Home Page', 'url' => assemble_url('goto_home_tab')));
     $tabs->add('assigned_action_request', array('text' => 'Assigned Action Requests', 'url' => assemble_url('assigned_action_request')));
     $tabs->add('owned_tickets', array('text' => 'Owned Tickets', 'url' => assemble_url('my_tickets')));
     $tabs->add('subscribed_tickets', array('text' => 'Subscribed Tickets', 'url' => assemble_url('my_subscribed_tickets')));
     $this->smarty->assign('page_tabs', $tabs);
     $this->smarty->assign('page_tab', 'dashboard');
     //EOF:mod 20110623
 }
 /**
  * Rebuild user cache
  *
  * @param User $user
  * @return array
  */
 function rebuildUserCache($user)
 {
     $value = PinnedProjects::findProjectIdsByUser($user, false);
     if (empty($value)) {
         $value = array();
     }
     // if
     cache_set('user_pinned_projects_' . $user->getId(), $value);
     return $value;
 }
 /**
  * Render jump to projects page
  *
  * @param void
  * @return null
  */
 function jump_to_project()
 {
     $pinned_projects = null;
     $active_projects = Projects::findNamesByUser($this->logged_user, PROJECT_STATUS_ACTIVE);
     if (is_foreachable($active_projects)) {
         $pinned_project_ids = PinnedProjects::findProjectIdsByUser($this->logged_user);
         if (is_foreachable($pinned_project_ids)) {
             $pinned_projects = array();
             foreach ($pinned_project_ids as $id) {
                 if (isset($active_projects[$id])) {
                     $pinned_projects[$id] = $active_projects[$id];
                     unset($active_projects[$id]);
                 }
                 // if
             }
             // if
         }
         // if
     }
     // if
     $this->smarty->assign(array('active_projects' => $active_projects, 'pinned_projects' => $pinned_projects));
 }