*/
require_once 'CRM/Contact/Form/Search/Interface.php';
+
+/**
+ * Class org_civicrm_search_activityimplementsCRM_Contact_Form_Search_Interface
+ */
class org_civicrm_search_activityimplementsCRM_Contact_Form_Search_Interface {
protected $_formValues;
+ /**
+ * @param $formValues
+ */
function __construct(&$formValues) {
$this->_formValues = $formValues;
//end custom fields
}
+ /**
+ * @param CRM_Core_Form $form
+ */
function buildForm(&$form) {
/**
// Alters the date display in the Activity Date Column. We do this after we already have
// the result so that sorting on the date column stays pertinent to the numeric date value
+ /**
+ * @param $row
+ */
function alterRow(&$row) {
$row['activity_date'] = CRM_Utils_Date::customFormat($row['activity_date'], '%B %E%f, %Y %l:%M %P');
}
// Regular JOIN statements here to limit results to contacts who have activities.
+ /**
+ * @return string
+ */
function from() {
return "
civicrm_contact contact_a
- JOIN civicrm_activity activity
+ JOIN civicrm_activity activity
ON contact_a.id = activity.source_contact_id
- JOIN civicrm_option_value ov1
+ JOIN civicrm_option_value ov1
ON activity.activity_type_id = ov1.value AND ov1.option_group_id = 2
- JOIN civicrm_option_value ov2
+ JOIN civicrm_option_value ov2
ON activity.status_id = ov2.value AND ov2.option_group_id = {$this->_groupId}
- JOIN civicrm_contact contact_b
+ JOIN civicrm_contact contact_b
ON activity.source_contact_id = contact_b.id
- LEFT JOIN civicrm_case_activity cca
+ LEFT JOIN civicrm_case_activity cca
ON activity.id = cca.activity_id
- LEFT JOIN civicrm_activity_assignment assignment
+ LEFT JOIN civicrm_activity_assignment assignment
ON activity.id = assignment.activity_id
- LEFT JOIN civicrm_contact contact_c
+ LEFT JOIN civicrm_contact contact_c
ON assignment.assignee_contact_id = contact_c.id ";
}
- /*
- * WHERE clause is an array built from any required JOINS plus conditional filters based on search criteria field values
- *
- */
+ /**
+ * WHERE clause is an array built from any required JOINS plus conditional filters based on search criteria field values
+ *
+ * @param bool $includeContactIDs
+ *
+ * @return string
+ */
function where($includeContactIDs = FALSE) {
$clauses = array();
if (!empty($contactname)) {
$dao = new CRM_Core_DAO();
$contactname = $dao->escape($contactname);
- $clauses[] = "(contact_a.sort_name LIKE '%{$contactname}%' OR
- contact_b.sort_name LIKE '%{$contactname}%' OR
+ $clauses[] = "(contact_a.sort_name LIKE '%{$contactname}%' OR
+ contact_b.sort_name LIKE '%{$contactname}%' OR
contact_c.display_name LIKE '%{$contactname}%')";
}
return implode(' AND ', $clauses);
}
- /*
- * Functions below generally don't need to be modified
- */
+ /*
+ * Functions below generally don't need to be modified
+ */
+
+ /**
+ * @return mixed
+ */
function count() {
$sql = $this->all();
return $dao->N;
}
+ /**
+ * @param int $offset
+ * @param int $rowcount
+ * @param null $sort
+ *
+ * @return string
+ */
function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
+ /**
+ * @return array
+ */
function &columns() {
return $this->_columns;
}
+ /**
+ * @param $title
+ */
function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
}
+ /**
+ * @return null
+ */
function summary() {
return NULL;
}