コード例 #1
0
ファイル: commonfunctions.php プロジェクト: aagusti/padl-tng
function GetLookupFieldsIndexes($pSet, $field)
{
    $lookupTable = $pSet->getLookupTable($field);
    $lookupType = $pSet->getLookupType($field);
    $displayFieldName = $pSet->getDisplayField($field);
    $linkFieldName = $pSet->getLinkField($field);
    $linkAndDisplaySame = $linkFieldName == $displayFieldName;
    if ($lookupType == LT_QUERY) {
        $lookupPSet = new ProjectSettings($lookupTable);
        $linkFieldIndex = $lookupPSet->getFieldIndex($linkFieldName) - 1;
        if ($linkAndDisplaySame) {
            $displayFieldIndex = $linkFieldIndex;
        } else {
            if ($pSet->getCustomDisplay($field)) {
                $displayFieldIndex = $lookupPSet->getCustomExpressionIndex($pSet->_table, $field);
            } else {
                $displayFieldIndex = $lookupPSet->getFieldIndex($displayFieldName) - 1;
            }
        }
    } else {
        $linkFieldIndex = 0;
        $displayFieldIndex = $linkAndDisplaySame ? 0 : 1;
    }
    return array("linkFieldIndex" => $linkFieldIndex, "displayFieldIndex" => $displayFieldIndex);
}
コード例 #2
0
ファイル: fulltext.php プロジェクト: sdev1/CloudStockEnquiry
    exit(0);
}
require_once "include/" . $table . "_variables.php";
$pSet = new ProjectSettings(GetTableByShort($table), $pageType);
$cipherer = new RunnerCipherer(GetTableByShort($table), $pSet);
$_connection = $cman->byTable($strTableName);
if (!$pSet->checkFieldPermissions($field)) {
    $returnJSON = array("success" => false, "error" => 'Error: You have not permission for read this text');
    echo printJSON($returnJSON);
    return;
}
if (!$gQuery->HasGroupBy()) {
    // Do not select any fields except current (full text) field.
    // If query has 'group by' clause then other fields are used in it and we may not simply cut 'em off.
    // Just don't do anything in that case.
    $gQuery->RemoveAllFieldsExcept($pSet->getFieldIndex($field));
}
$keysArr = $pSet->getTableKeys();
$keys = array();
foreach ($keysArr as $ind => $k) {
    $keys[$k] = postvalue("key" . ($ind + 1));
}
$where = KeyWhere($keys);
$sql = $gQuery->gSQLWhere($where);
$qResult = $_connection->query($sql);
if (!$qResult || !($data = $cipherer->DecryptFetchedArray($qResult->fetchAssoc()))) {
    $returnJSON = array("success" => false, "error" => 'Error: Wrong SQL query');
    echo printJSON($returnJSON);
    return;
}
$fieldValue = $data[$field];
コード例 #3
0
ファイル: searchsuggest.php プロジェクト: aagusti/padl-tng
    }
}
$controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer);
// proccess fields and create sql
foreach ($allSearchFields as $f) {
    $fType = $pSet->getFieldType($f);
    // filter fields by type
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) {
        continue;
    } else {
    }
    // get suggest for field
    if (($searchField == '' || $searchField == GoodFieldName($f)) && $pSet->checkFieldPermissions($f)) {
        $where = "";
        $having = "";
        if (!$gQuery->IsAggrFuncField($pSet->getFieldIndex($f) - 1)) {
            $where = $searchClauseObj->getSuggestWhere($controls->getControl($f), $suggestAllContent, $searchFor);
        } elseif ($gQuery->IsAggrFuncField($pSet->getFieldIndex($f) - 1)) {
            $having = $searchClauseObj->getSuggestWhere($controls->getControl($f), $suggestAllContent, $searchFor);
        }
        if (!strlen($where) && !strlen($having)) {
            continue;
        }
        // prepare common vals
        $where = whereAdd($where . $masterWhere, $strSecuritySql);
        $distinct = "DISTINCT";
        $sqlHead = "SELECT " . $distinct . " " . GetFullFieldName($f) . " ";
        if ($gQuery->HasGroupBy()) {
            $strSQL = $gQuery->gSQLWhere_having_fromQuery("", $where, $having);
            $strSQL = "SELECT DISTINCT st." . AddFieldWrappers($f) . " from (" . $strSQL . ") st";
        } else {