Example #1
0
$INV = array();
//relationship term inverse
$WGN = array();
//work group name
$UGN = array();
//User name
$TL = array();
//term lookup
$TLV = array();
//term lookup by value
// record type labels
$query = 'SELECT rty_ID, rty_Name FROM defRecTypes';
$res = mysql_query($query);
while ($row = mysql_fetch_assoc($res)) {
    $RTN[$row['rty_ID']] = $row['rty_Name'];
    foreach (getRectypeFields($row['rty_ID']) as $rst_DetailTypeID => $rdr) {
        // type-specific names for detail types
        $RQS[$row['rty_ID']][$rst_DetailTypeID] = @$rdr[0];
    }
}
/*****DEBUG****/
//error_log(print_r($RQS,true));
// base names, varieties for detail types
$query = 'SELECT dty_ID, dty_Name, dty_Type FROM defDetailTypes';
$res = mysql_query($query);
while ($row = mysql_fetch_assoc($res)) {
    $DTN[$row['dty_ID']] = $row['dty_Name'];
    $DTT[$row['dty_ID']] = $row['dty_Type'];
}
$INV = mysql__select_assoc('defTerms', 'trm_ID', 'trm_InverseTermID', '1');
// lookup detail type enum values
/**
 * get a recType structure consisting of recType commonFields and recType fields
 * @param     int [$rtID] recType ID
 * @return    object containing recType commonFields and dtFields (fields index by detailType)
 * @uses      getRectypeDef()
 * @uses      getRectypeFields()
 */
function getRectypeStructure($rtID)
{
    $rectypesStructure = array();
    $rectypesStructure['commonFields'] = getRectypeDef($rtID);
    $rectypesStructure['dtFields'] = getRectypeFields($rtID);
    return $rectypesStructure;
}
//12-rst_PtrFilteredIDs
//13-rst_TermIDTreeNonSelectableIDs
//14-rst_CalcFunctionID
//15-rst_Status
//16-rst_OrderForThumbnailGeneration
//17-dty_TermIDTreeNonSelectableIDs
//18-dty_FieldSetRectypeID
//19-rst_NonOwnerVisibility]....]
//rst_DisplayName, rst_DisplayHelpText, rst_DisplayExtendedDescription,
// rst_DefaultValue, rst_RequirementType, rst_MaxValues, rst_MinValues, rst_DisplayWidth, rst_RecordMatchOrder,
// rst_DisplayOrder, rst_DisplayDetailTypeGroupID, rst_FilteredJsonTermIDTree, rst_PtrFilteredIDs,
// rst_TermIDTreeNonSelectableIDs, rst_CalcFunctionID, rst_Status, rst_OrderForThumbnailGeneration,
// dty_TermIDTreeNonSelectableIDs, dty_FieldSetRectypeID, rst_NonOwnerVisibility] ...]
$rstC2I = getColumnNameToIndex(getRectypeStructureFieldColNames());
foreach ($rec_types as $rec_type) {
    foreach (getRectypeFields($rec_type) as $dtyID => $rdr) {
        // saw TODO need to represent the trm ids  and rectype pointer ids that are valid for this rectype.detailtype.
        array_push($detailRequirements, array($rec_type, $dtyID, $rstC2I['rst_RequirementType'] ? $rdr[$rstC2I['rst_RequirementType']] : null, $rstC2I['rst_MaxValues'] && $rdr[$rstC2I['rst_MaxValues']] ? intval($rdr[$rstC2I['rst_MaxValues']]) : null, array_key_exists('rst_DisplayName', $rstC2I) ? $rdr[$rstC2I['rst_DisplayName']] : null, $rstC2I['rst_DisplayHelpText'] ? $rdr[$rstC2I['rst_DisplayHelpText']] : null, $rstC2I['rst_RecordMatchOrder'] ? intval($rdr[$rstC2I['rst_RecordMatchOrder']]) : 0, $rstC2I['rst_DisplayWidth'] ? intval($rdr[$rstC2I['rst_DisplayWidth']]) : 0, $rstC2I['rst_DisplayOrder'] ? intval($rdr[$rstC2I['rst_DisplayOrder']]) : 0, $rstC2I['rst_DisplayExtendedDescription'] ? $rdr[$rstC2I['rst_DisplayExtendedDescription']] : null, $rstC2I['rst_DefaultValue'] ? $rdr[$rstC2I['rst_DefaultValue']] : null, $rstC2I['rst_MinValues'] ? intval($rdr[$rstC2I['rst_MinValues']]) : 0, $rstC2I['rst_DisplayDetailTypeGroupID'] ? $rdr[$rstC2I['rst_DisplayDetailTypeGroupID']] : null, $rstC2I['rst_FilteredJsonTermIDTree'] ? $rdr[$rstC2I['rst_FilteredJsonTermIDTree']] : null, $rstC2I['rst_TermIDTreeNonSelectableIDs'] ? $rdr[$rstC2I['rst_TermIDTreeNonSelectableIDs']] : null, $rstC2I['dty_TermIDTreeNonSelectableIDs'] ? $rdr[$rstC2I['dty_TermIDTreeNonSelectableIDs']] : null, $rstC2I['rst_PtrFilteredIDs'] ? $rdr[$rstC2I['rst_PtrFilteredIDs']] : null, $rstC2I['rst_CalcFunctionID'] ? $rdr[$rstC2I['rst_CalcFunctionID']] : null, $rstC2I['rst_OrderForThumbnailGeneration'] ? $rdr[$rstC2I['rst_OrderForThumbnailGeneration']] : null, $rstC2I['rst_Status'] ? $rdr[$rstC2I['rst_Status']] : null, $rstC2I['rst_NonOwnerVisibility'] ? $rdr[$rstC2I['rst_NonOwnerVisibility']] : null));
        //20-Non-Owner Visibility
    }
}
$commonData = array("users" => $users, "workgroups" => $workgroups, "ratings" => array("0" => "not rated", "1" => "*", "2" => "**", "3" => "***", "4" => "****", "5" => "*****"), "recordTypes" => $recordTypes, "detailTypes" => $detailTypes, "detailRequirements" => $detailRequirements, 'max_post_size' => _get_config_bytes(ini_get('post_max_size')), 'max_file_size' => _get_config_bytes(ini_get('upload_max_filesize')));
if (!@$_REQUEST["json"]) {
    print "var HAPI_commonData = ";
}
print json_encode($commonData);
if (!@$_REQUEST["json"]) {
    print ";\n";
}
function _fix_integer_overflow($size)
{