*
* @return array
*/
- public static function buildQillForFieldValue($daoName = NULL, $fieldName, $fieldValue, $op, $pseduoExtraParam = array()) {
+ public static function buildQillForFieldValue(
+ $daoName,
+ $fieldName,
+ $fieldValue,
+ $op,
+ $pseudoExtraParam = array(),
+ $type = CRM_Utils_Type::T_STRING
+ ) {
$qillOperators = CRM_Core_SelectValues::getSearchBuilderOperators();
+ // if Operator chosen is NULL/EMPTY then
+ if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
+ return array(CRM_Utils_Array::value($op, $qillOperators, $op), '');
+ }
+
if ($fieldName == 'activity_type_id') {
- $pseduoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
+ $pseudoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
}
+ elseif ($fieldName == 'country_id') {
+ $pseduoOptions = CRM_Core_PseudoConstant::country();
+ }
+ elseif ($fieldName == 'county_id') {
+ $pseduoOptions = CRM_Core_PseudoConstant::county();
+ }
+ elseif ($fieldName == 'world_region') {
+ $pseduoOptions = CRM_Core_PseudoConstant::worldRegion();
+ }
elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') {
- $pseduoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE);
+ $pseudoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE);
}
elseif ($fieldName == 'contribution_product_id') {
- $pseduoOptions = CRM_Contribute_PseudoConstant::products();
+ $pseudoOptions = CRM_Contribute_PseudoConstant::products();
}
elseif ($daoName == 'CRM_Contact_DAO_Group' && $fieldName == 'id') {
- $pseduoOptions = CRM_Core_PseudoConstant::group();
+ $pseudoOptions = CRM_Core_PseudoConstant::group();
}
elseif ($fieldName == 'country_id') {
- $pseduoOptions = CRM_Core_PseudoConstant::country();
+ $pseudoOptions = CRM_Core_PseudoConstant::country();
}
elseif ($daoName) {
- $pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array());
+ $pseudoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseudoExtraParam);
}
//API usually have fieldValue format as array(operator => array(values)),