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


PHP ProjectSettings::isLookupUnique方法代码示例

本文整理汇总了PHP中ProjectSettings::isLookupUnique方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectSettings::isLookupUnique方法的具体用法?PHP ProjectSettings::isLookupUnique怎么用?PHP ProjectSettings::isLookupUnique使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectSettings的用法示例。


在下文中一共展示了ProjectSettings::isLookupUnique方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadSelectContent

function loadSelectContent($pageType, $childFieldName, $parentVal, $doCategoryFilter = true, $childVal = "", $initialLoad = true)
{
    global $conn, $LookupSQL, $strTableName;
    $pSet = new ProjectSettings($strTableName, $pageType);
    $response = array();
    $lookupType = $pSet->getLookupType($childFieldName);
    $isUnique = $pSet->isLookupUnique($childFieldName);
    if ($pSet->useCategory($childFieldName) && $doCategoryFilter) {
        if ($lookupType == LT_QUERY) {
            $lookupTable = $pSet->getLookupTable($childFieldName);
            $cipherer = new RunnerCipherer($lookupTable);
            $tempParentVal = $cipherer->MakeDBValue($pSet->getCategoryControl($childFieldName), $parentVal, "", $lookupTable, true);
        } else {
            $tempParentVal = make_db_value($childFieldName, $parentVal);
        }
        if ($tempParentVal === "null") {
            return $response;
        }
    }
    $LookupSQL = buildLookupSQL($pageType, $childFieldName, $strTableName, $parentVal, $childVal, $doCategoryFilter, $pSet->fastType($childFieldName) && $initialLoad);
    $lookupIndexes = GetLookupFieldsIndexes($pSet, $childFieldName);
    $rs = db_query($LookupSQL, $conn);
    if (!$pSet->fastType($childFieldName)) {
        while ($data = db_fetch_numarray($rs)) {
            if ($lookupType == LT_QUERY && $isUnique) {
                if (!isset($uniqueArray)) {
                    $uniqueArray = array();
                }
                if (in_array($data[$lookupIndexes["displayFieldIndex"]], $uniqueArray)) {
                    continue;
                }
                $uniqueArray[] = $data[$lookupIndexes["displayFieldIndex"]];
            }
            $response[] = $data[$lookupIndexes["linkFieldIndex"]];
            $response[] = $data[$lookupIndexes["displayFieldIndex"]];
        }
    } else {
        $data = db_fetch_numarray($rs);
        //	one record only
        if ($data && (strlen($childVal) || !db_fetch_numarray($rs))) {
            $response[] = $data[$lookupIndexes["linkFieldIndex"]];
            $response[] = $data[$lookupIndexes["displayFieldIndex"]];
        }
    }
    return $response;
}
开发者ID:aagusti,项目名称:padl-tng,代码行数:46,代码来源:commonfunctions.php

示例2: ProjectSettings

 $linkFieldName = $gSettings->getLinkField($f);
 $displayFieldName = $gSettings->getDisplayField($f);
 $linkAndDisplaySame = $displayFieldName == $linkFieldName;
 $lwDisplayField = $gSettings->getLWDisplayField($f);
 if ($LookupType == LT_QUERY) {
     $lookupPSet = new ProjectSettings($lookupTable, $pageType);
     $lookupQueryObj = $lookupPSet->getSQLQuery();
     if ($gSettings->getCustomDisplay($f)) {
         $lookupQueryObj->AddCustomExpression($displayFieldName, $lookupPSet, $strTableName, $f);
     }
     $lookupQueryObj->ReplaceFieldsWithDummies($lookupPSet->getBinaryFieldsIndices());
     $cipherer->strTableName = $lookupTable;
 } else {
     $LookupSQLTable = "SELECT ";
     $lwLinkField = $gSettings->GetLWLinkField($f, true);
     if ($gSettings->isLookupUnique($f)) {
         $LookupSQLTable .= "DISTINCT ";
     }
     $LookupSQLTable .= $cipherer->GetLookupFieldName($lwLinkField, $strTableName, $f, null, true);
     if (!$linkAndDisplaySame) {
         $LookupSQLTable .= "," . ($lwDisplayField == $lwLinkField ? $cipherer->GetFieldName($lwDisplayField, $f, true) : $lwDisplayField);
     }
     $LookupSQLTable .= " FROM " . AddTableWrappers($lookupTable) . " ";
 }
 $strLookupWhere = GetLWWhere($f, $pageType, $strTableName);
 if ($strLookupWhere) {
     $strLookupWhere = " (" . $strLookupWhere . ")  AND ";
 }
 if ($LookupType == LT_QUERY) {
     if ($gSettings->getCustomDisplay($f)) {
         $strLookupWhere .= $displayFieldName;
开发者ID:aagusti,项目名称:padl-tng,代码行数:31,代码来源:lookupsuggest.php


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