当前位置: 首页>>代码示例>>PHP>>正文


PHP VTWS_PreserveGlobal::preserveGlobal方法代码示例

本文整理汇总了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;
}
开发者ID:kikojover,项目名称:corebos,代码行数:81,代码来源:CustomerPortalWS.php

示例2: vtws_preserveGlobal

function vtws_preserveGlobal($name, $value)
{
    return VTWS_PreserveGlobal::preserveGlobal($name, $value);
}
开发者ID:kduqi,项目名称:corebos,代码行数:4,代码来源:Utils.php

示例3: getGlobal

 static function getGlobal($name)
 {
     global ${$name};
     return VTWS_PreserveGlobal::preserveGlobal($name, ${$name});
 }
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:5,代码来源:PreserveGlobal.php


注:本文中的VTWS_PreserveGlobal::preserveGlobal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。