Ejemplo n.º 1
0
        foreach ($def_rts[$rtyID]['dtFields'] as $ftId => $def_field) {
            if ($def_field[$idx_type] == "enum" || $def_field[$idx_type] == "relationtype") {
                //change terms ids for enum and reltypes
                $def_field[$idx_terms_tree] = "";
                //replaceTermIds(@$def_field[$idx_terms_tree], $def_field[$idx_type] );
                $def_field[$idx_terms_disabled] = "";
                //replaceTermIds(@$def_field[$idx_terms_disabled], $def_field[$idx_type]);
            } else {
                if ($def_field[$idx_type] == "resource" || $def_field[$idx_type] == "relmarker") {
                    //change record ids for pointers
                    $def_field[$idx_constraints] = replaceRecIds(@$def_field[$idx_constraints]);
                }
            }
            $fields[$fields_correspondence[$ftId]] = $def_field;
        }
        $ret = updateRecStructure($dtFieldNames, $rectypes_correspondence[$rtyID], array("dtFields" => $fields));
        if (is_array($ret)) {
            foreach ($ret as $id => $res2) {
                foreach ($res2 as $dtid => $res) {
                    if (!is_numeric($res)) {
                        error_exit("Can't update record type structure rectype#" . $id . ". " . $res);
                    }
                }
            }
        } else {
            error_exit("Can't update record type structure rectype#" . $rectypes_correspondence[$rtyID] . ". " . $ret);
        }
    }
}
// ------------------------------------------------------------------------------------------------
// VII. Update titlemasks with new ids
Ejemplo n.º 2
0
         }
     }
     $rv['rectypes'] = getAllRectypeStructures(false);
     break;
 case 'saveRTS':
     // Record type structure
     if (!array_key_exists('rectype', $data) || !array_key_exists('colNames', $data['rectype']) || !array_key_exists('defs', $data['rectype'])) {
         error_exit("Invalid data structure sent with updateRecStructure method call to saveStructure.php");
     }
     //$commonNames = $rtData['rectype']['colNames']['common'];
     $dtFieldNames = $data['rectype']['colNames']['dtFields'];
     $rv['result'] = array();
     //result
     //actually client sends the definition only for one record type
     foreach ($data['rectype']['defs'] as $rtyID => $rt) {
         array_push($rv['result'], updateRecStructure($dtFieldNames, $rtyID, $rt));
     }
     $rv['rectypes'] = getAllRectypeStructures();
     $rv['detailTypes'] = getAllDetailTypeStructures();
     break;
 case 'deleteRTS':
     $rtyID = @$_REQUEST['rtyID'];
     $dtyID = @$_REQUEST['dtyID'];
     if (!$rtyID || !$dtyID) {
         $rv['error'] = "Error: No IDs or invalid IDs sent with deleteRecStructure method call to saveStructure.php";
     } else {
         $rv = deleteRecStructure($rtyID, $dtyID);
         if (!array_key_exists('error', $rv)) {
             $rv['rectypes'] = getAllRectypeStructures();
             $rv['detailTypes'] = getAllDetailTypeStructures();
         }
Ejemplo n.º 3
0
function addDefaultFieldForNewRecordType($rtyID)
{
    $dt = getAllDetailTypeStructures();
    $dt = $dt['typedefs'];
    $rv = getAllRectypeStructures();
    $dtFieldNames = $rv['typedefs']['dtFieldNames'];
    $di = $dt['fieldNamesToIndex'];
    $ri = $rv['typedefs']['dtFieldNamesToIndex'];
    $data = array();
    $data['dtFields'] = array(DT_NAME => getInitRty($ri, $di, $dt, DT_NAME, array('required', 1, 40)), DT_SHORT_SUMMARY => getInitRty($ri, $di, $dt, DT_SHORT_SUMMARY, array('recommended', 1, 60)));
    updateRecStructure($dtFieldNames, $rtyID, $data);
}