本文整理汇总了PHP中VTWS_PreserveGlobal::preserveGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP VTWS_PreserveGlobal::preserveGlobal方法的具体用法?PHP VTWS_PreserveGlobal::preserveGlobal怎么用?PHP VTWS_PreserveGlobal::preserveGlobal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTWS_PreserveGlobal
的用法示例。
在下文中一共展示了VTWS_PreserveGlobal::preserveGlobal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldAutocomplete
/**
* @param String $term: search term
* @param String $filter: operator to use: eq, neq, startswith, endswith, contains
* @param String $searchinmodule: valid module to search in
* @param String $fields: comma separated list of fields to search in
* @param String $returnfields: comma separated list of fields to return as result, if empty $fields will be returned
* @param Number $limit: maximum number of values to return
* @param Users $user
* @return Array values found: crmid => array($returnfields)
*/
function getFieldAutocomplete($term, $filter, $searchinmodule, $fields, $returnfields, $limit, $user)
{
global $current_user, $log, $adb, $default_charset;
$respuesta = array();
if (empty($searchinmodule) or empty($fields)) {
return $respuesta;
}
if (!(vtlib_isModuleActive($searchinmodule) and isPermitted($searchinmodule, 'DetailView'))) {
return $respuesta;
}
if (empty($returnfields)) {
$returnfields = $fields;
}
if (empty($limit)) {
$limit = 30;
}
// hard coded default
if (empty($term)) {
$term = '%';
$op = 'like';
} else {
switch ($filter) {
case 'eq':
$op = 'e';
break;
case 'neq':
$op = 'n';
break;
case 'startswith':
$op = 's';
break;
case 'endswith':
$op = 'ew';
break;
case 'contains':
$op = 'c';
break;
default:
$op = 'e';
break;
}
}
$current_user = VTWS_PreserveGlobal::preserveGlobal('current_user', $user);
$smod = new $searchinmodule();
$sindex = $smod->table_index;
$queryGenerator = new QueryGenerator($searchinmodule, $current_user);
$sfields = explode(',', $fields);
$rfields = explode(',', $returnfields);
$flds = array_unique(array_merge($rfields, $sfields, array('id')));
$queryGenerator->setFields($flds);
foreach ($sfields as $sfld) {
$queryGenerator->addCondition($sfld, $term, $op);
}
$query = $queryGenerator->getQuery();
$rsemp = $adb->query($query);
global $log;
$log->fatal($rsemp);
$wsid = vtyiicpng_getWSEntityId($searchinmodule);
while ($emp = $adb->fetch_array($rsemp)) {
$rsp = array();
foreach ($rfields as $rf) {
$rsp[$rf] = html_entity_decode($emp[$rf], ENT_QUOTES, $default_charset);
}
$respuesta[] = array('crmid' => $wsid . $emp[$sindex], 'crmfields' => $rsp);
if (count($respuesta) >= $limit) {
break;
}
}
VTWS_PreserveGlobal::flush();
return $respuesta;
}
示例2: vtws_preserveGlobal
function vtws_preserveGlobal($name, $value)
{
return VTWS_PreserveGlobal::preserveGlobal($name, $value);
}
示例3: getGlobal
static function getGlobal($name)
{
global ${$name};
return VTWS_PreserveGlobal::preserveGlobal($name, ${$name});
}