예제 #1
0
 /**
  * Class constructor.
  *
  * @param array $queryParams
  *   Array of parameters for query.
  * @param \const|int $action - action of search basic or advanced.
  * @param string $activityClause
  *   If the caller wants to further restrict the search (used in activities).
  * @param bool $single
  *   Are we dealing only with one contact?.
  * @param int $limit
  *   How many activities do we want returned.
  *
  * @param string $context
  * @param null $compContext
  *
  * @return \CRM_Activity_Selector_Search
  */
 public function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $activityClause = NULL, $single = FALSE, $limit = NULL, $context = 'search', $compContext = NULL)
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_compContext = $compContext;
     $this->_activityClause = $activityClause;
     // CRM-12675
     $components = CRM_Core_Component::getNames();
     $componentClause = array();
     foreach ($components as $componentID => $componentName) {
         if (!CRM_Core_Permission::check("access {$componentName}")) {
             $componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) ";
         }
     }
     if (!empty($componentClause)) {
         $componentRestriction = implode(' AND ', $componentClause);
         if (empty($this->_activityClause)) {
             $this->_activityClause = $componentRestriction;
         } else {
             $this->_activityClause .= ' AND ' . $componentRestriction;
         }
     }
     // type of selector
     $this->_action = $action;
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, CRM_Activity_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_ACTIVITY, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_ACTIVITY);
     $this->_query->_distinctComponentClause = '( civicrm_activity.id )';
     $this->_query->_groupByComponentClause = " GROUP BY civicrm_activity.id ";
 }
예제 #2
0
 /**
  * Class constructor.
  *
  * @param array $queryParams
  *   Array of parameters for query.
  * @param \const|int $action - action of search basic or advanced.
  * @param string $activityClause
  *   If the caller wants to further restrict the search (used in activities).
  * @param bool $single
  *   Are we dealing only with one contact?.
  * @param int $limit
  *   How many activities do we want returned.
  *
  * @param string $context
  * @param null $compContext
  *
  * @return \CRM_Activity_Selector_Search
  */
 public function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $activityClause = NULL, $single = FALSE, $limit = NULL, $context = 'search', $compContext = NULL)
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_compContext = $compContext;
     $this->_activityClause = $activityClause;
     // CRM-12675
     $components = CRM_Core_Component::getNames();
     $componentClause = array();
     foreach ($components as $componentID => $componentName) {
         // CRM-19201: Add support for searching CiviCampaign and CiviCase
         // activities. For CiviCase, "access all cases and activities" is
         // required here rather than "access my cases and activities" to
         // prevent those with only the later permission from seeing a list
         // of all cases which might present a privacy issue.
         if (!CRM_Core_Permission::access($componentName, TRUE, TRUE)) {
             $componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) ";
         }
     }
     if (!empty($componentClause)) {
         $componentRestriction = implode(' AND ', $componentClause);
         if (empty($this->_activityClause)) {
             $this->_activityClause = $componentRestriction;
         } else {
             $this->_activityClause .= ' AND ' . $componentRestriction;
         }
     }
     // type of selector
     $this->_action = $action;
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, CRM_Activity_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_ACTIVITY, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_ACTIVITY);
     $this->_query->_distinctComponentClause = '( civicrm_activity.id )';
     $this->_query->_groupByComponentClause = " GROUP BY civicrm_activity.id ";
 }
예제 #3
0
 /**
  * default set of return properties
  *
  * @return void
  * @access public
  */
 static function &defaultReturnProperties($mode = 1)
 {
     if (!isset(self::$_defaultReturnProperties)) {
         self::$_defaultReturnProperties = array();
     }
     if (!isset(self::$_defaultReturnProperties[$mode])) {
         // add activity return properties
         if ($mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
             self::$_defaultReturnProperties[$mode] = CRM_Activity_BAO_Query::defaultReturnProperties($mode, FALSE);
         } else {
             self::$_defaultReturnProperties[$mode] = CRM_Core_Component::defaultReturnProperties($mode, FALSE);
         }
         if (empty(self::$_defaultReturnProperties[$mode])) {
             self::$_defaultReturnProperties[$mode] = array('home_URL' => 1, 'image_URL' => 1, 'legal_identifier' => 1, 'external_identifier' => 1, 'contact_type' => 1, 'contact_sub_type' => 1, 'sort_name' => 1, 'display_name' => 1, 'preferred_mail_format' => 1, 'nick_name' => 1, 'first_name' => 1, 'middle_name' => 1, 'last_name' => 1, 'individual_prefix' => 1, 'individual_suffix' => 1, 'birth_date' => 1, 'gender' => 1, 'street_address' => 1, 'supplemental_address_1' => 1, 'supplemental_address_2' => 1, 'city' => 1, 'postal_code' => 1, 'postal_code_suffix' => 1, 'state_province' => 1, 'country' => 1, 'world_region' => 1, 'geo_code_1' => 1, 'geo_code_2' => 1, 'email' => 1, 'on_hold' => 1, 'phone' => 1, 'im' => 1, 'household_name' => 1, 'organization_name' => 1, 'deceased_date' => 1, 'is_deceased' => 1, 'job_title' => 1, 'legal_name' => 1, 'sic_code' => 1, 'current_employer' => 1, 'do_not_email' => 1, 'do_not_mail' => 1, 'do_not_sms' => 1, 'do_not_phone' => 1, 'do_not_trade' => 1, 'is_opt_out' => 1, 'contact_is_deleted' => 1);
         }
     }
     return self::$_defaultReturnProperties[$mode];
 }
예제 #4
0
 /**
  * Class constructor
  *
  * @param array   $queryParams array of parameters for query
  * @param int     $action - action of search basic or advanced.
  * @param string  $activityClause if the caller wants to further restrict the search (used in activities)
  * @param boolean $single are we dealing only with one contact?
  * @param int     $limit  how many activities do we want returned
  *
  * @return CRM_Contact_Selector
  * @access public
  */
 function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $activityClause = NULL, $single = FALSE, $limit = NULL, $context = 'search', $compContext = NULL)
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_compContext = $compContext;
     $this->_activityClause = $activityClause;
     // type of selector
     $this->_action = $action;
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, CRM_Activity_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_ACTIVITY, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_ACTIVITY);
     $this->_query->_distinctComponentClause = '( civicrm_activity.id )';
     $this->_query->_groupByComponentClause = " GROUP BY civicrm_activity.id ";
     //CRM_Core_Error::debug( $this->_query ); exit();
 }