Exemplo n.º 1
0
 /**
  * Applies the Action to the target.
  *
  * @param SugarBean $target
  */
 function fire(&$target)
 {
     require_once 'modules/Home/quicksearchQuery.php';
     require_once 'include/QuickSearchDefaults.php';
     $json = getJSONobj();
     $userName = Parser::evaluate($this . expr, $target) . evaluate();
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $data = $qsd->getQSUser();
     $data['modules'] = array("Users");
     $data['conditions'][0]['value'] = $userName;
     $qs = new quicksearchQuery();
     $result = $qs->query($data);
     $resultBean = $json->decodeReal($result);
     print_r($resultBean);
 }
            $user_array = get_user_array(false, "Active", '', false, $args['conditions'][0]['value']);
        }
        $response['totalCount'] = count($user_array);
        $response['fields'] = array();
        $i = 0;
        foreach ($user_array as $id => $name) {
            array_push($response['fields'], array('id' => $id, 'user_name' => $name, 'module' => 'Users'));
            $i++;
        }
        return $json->encode($response);
    }
}
$json = getJSONobj();
$data = $json->decode(html_entity_decode($_REQUEST['data']));
if (isset($_REQUEST['query']) && !empty($_REQUEST['query'])) {
    foreach ($data['conditions'] as $k => $v) {
        $data['conditions'][$k]['value'] = $_REQUEST['query'];
    }
}
$quicksearchQuery = new quicksearchQuery();
switch ($data['method']) {
    case 'query':
        echo $quicksearchQuery->query($data);
        break;
    case 'get_user_array':
        echo $quicksearchQuery->get_user_array($data);
        break;
    case 'get_contact_array':
        echo $quicksearchQuery->get_contacts_array($data);
        break;
}