コード例 #1
0
 /**
  * Return project messages
  *
  * @access public
  * @param void
  * @return array
  */
 function index()
 {
     $this->addHelper('textile');
     $page = (int) array_var($_GET, 'page', 1);
     if ($page < 0) {
         $page = 1;
     }
     $this->canGoOn();
     // Gets desired view 'detail' or 'list'
     // $view_type is from URL, Cookie or set to default: 'list'
     $view_type = array_var($_GET, 'view', Cookie::getValue('messagesViewType', 'list'));
     $expiration = Cookie::getValue('remember' . TOKEN_COOKIE_NAME) ? REMEMBER_LOGIN_LIFETIME : null;
     Cookie::setValue('messagesViewType', $view_type, $expiration);
     $period_type = array_var($_GET, 'period', Cookie::getValue('messagesPeriodType', 'fresh'));
     $expiration = Cookie::getValue('remember' . TOKEN_COOKIE_NAME) ? REMEMBER_LOGIN_LIFETIME : null;
     Cookie::setValue('messagesPeriodType', $period_type, $expiration);
     /* 
     	  
     	extended the time that project pier auto archives  
     */
     $archive_condition = ' AND `updated_on` >= (now() - interval 990 day)';
     if ($period_type == 'archive') {
         $archive_condition = ' AND `updated_on` < (now() - interval 990 day)';
     }
     $conditions = logged_user()->isMemberOfOwnerCompany() ? array('`project_id` = ?' . $archive_condition, active_project()->getId()) : array('`project_id` = ? AND `is_private` = ?' . $archive_condition, active_project()->getId(), 0);
     list($messages, $pagination) = ProjectMessages::paginate(array('conditions' => $conditions, 'order' => '`created_on` DESC'), config_option('messages_per_page', 10), $page);
     // paginate
     tpl_assign('view_type', $view_type);
     tpl_assign('period_type', $period_type);
     tpl_assign('messages', $messages);
     tpl_assign('messages_pagination', $pagination);
     tpl_assign('important_messages', active_project()->getImportantMessages());
     $this->setSidebar(get_template_path('index_sidebar', 'message'));
 }
コード例 #2
0
 /**
  * Return project messages
  *
  * @access public
  * @param void
  * @return array
  */
 function index()
 {
     $this->addHelper('textile');
     $page = (int) array_var($_GET, 'page', 1);
     if ($page < 0) {
         $page = 1;
     }
     $conditions = logged_user()->isMemberOfOwnerCompany() ? array('`project_id` = ?', active_project()->getId()) : array('`project_id` = ? AND `is_private` = ?', active_project()->getId(), 0);
     list($messages, $pagination) = ProjectMessages::paginate(array('conditions' => $conditions, 'order' => '`created_on` DESC'), config_option('messages_per_page', 10), $page);
     // paginate
     tpl_assign('messages', $messages);
     tpl_assign('messages_pagination', $pagination);
     tpl_assign('important_messages', active_project()->getImportantMessages());
     $this->setSidebar(get_template_path('index_sidebar', 'message'));
 }