/**
  * Browse all activities for a particular contact
  *
  * @param boolean $history - true if we want to browse activity history, false otherwise.
  * @return none
  *
  * @access public
  */
 function browse($history)
 {
     $this->assign('totalCountOpenActivity', CRM_Contact_BAO_Contact::getNumOpenActivity($this->_contactId));
     $this->assign('totalCountActivity', CRM_Core_BAO_History::getNumHistory($this->_contactId, 'Activity'));
     require_once 'CRM/Core/Selector/Controller.php';
     if ($history) {
         $this->assign('history', true);
         // create the selector, controller and run - store results in session
         $output = CRM_CORE_SELECTOR_CONTROLLER_SESSION;
         require_once 'CRM/History/Selector/Activity.php';
         $selector =& new CRM_History_Selector_Activity($this->_contactId, $this->_permission);
         $sortID = null;
         if ($this->get(CRM_UTILS_SORT_SORT_ID)) {
             $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_UTILS_SORT_SORT_ID), $this->get(CRM_UTILS_SORT_SORT_DIRECTION));
         }
         $controller =& new CRM_Core_Selector_Controller($selector, $this->get(CRM_UTILS_PAGER_PAGE_ID), $sortID, CRM_CORE_ACTION_VIEW, $this, $output);
         $controller->setEmbedded(true);
         $controller->run();
         $controller->moveFromSessionToTemplate();
     } else {
         $this->assign('history', false);
         // create the selector, controller and run - store results in session
         $output = CRM_CORE_SELECTOR_CONTROLLER_SESSION;
         require_once 'CRM/Contact/Selector/Activity.php';
         $selector =& new CRM_Contact_Selector_Activity($this->_contactId, $this->_permission);
         $sortID = null;
         if ($this->get(CRM_UTILS_SORT_SORT_ID)) {
             $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_UTILS_SORT_SORT_ID), $this->get(CRM_UTILS_SORT_SORT_DIRECTION));
         }
         $controller =& new CRM_Core_Selector_Controller($selector, $this->get(CRM_UTILS_PAGER_PAGE_ID), $sortID, CRM_CORE_ACTION_VIEW, $this, $output);
         $controller->setEmbedded(true);
         $controller->run();
         $controller->moveFromSessionToTemplate();
     }
 }
 /**
  * Returns total number of rows for the query.
  *
  * @param string $action - action being performed
  * @return int Total number of rows 
  * @access public
  */
 function getTotalCount($action)
 {
     return CRM_Core_BAO_History::getNumHistory($this->_entityId, 'Activity');
 }
Beispiel #3
0
 /**
  * Given the list of params in the params array, fetch the object
  * and store the values in the values array
  *
  * @param array $params        input parameters to find object
  * @param array $values        output values of the object
  *
  * @return array (reference)   the values that could be potentially assigned to smarty
  * @access public
  * @static
  */
 function &getValues(&$params, &$values, $type = 'Activity')
 {
     // get top 3 histories
     $values['activity']['data'] =& CRM_Core_BAO_History::getHistory($params, 0, 3, null, $type);
     // get the total number of histories
     $values['activity']['totalCount'] =& CRM_Core_BAO_History::getNumHistory($params['entity_id'], $type);
     return $values;
 }