示例#1
0
/**
 * Questa funzione esegue una ricerca sul formato 'Respondent' con il valore passato
 * attraverso $respondent_id e restituisce il primo record corrispondente, altrimenti restituisce zero.
 */
function getRespondentRecordFromRespondentID($respondent_id)
{
    global $fm;
    //Specificare il formato
    $find = $fm->newFindCommand('Respondent');
    //Specificare il campo e il valore da confrontare. In questo caso, 'Respondent ID' è il campo
    // e $respondent_id è il valore.
    $find->addFindCriterion('Respondent ID', $respondent_id);
    //Eseguire la ricerca
    $results = $find->execute();
    //Verificare che non vi siano errori
    if (!FileMaker::isError($results)) {
        //Nessun errore, restituire il primo risultato corrispondente
        $records = $results->getRecords();
        return $records[0];
    } else {
        //Errore, restituire zero (ossia nessuna corrispondenza trovata)
        return null;
    }
}
示例#2
0
/**
 * Die Fkt. führt eine Suche im Layout 'Respondent' mit dem über $respondent_id
 * übergeb. Wert durch. Wenn vorh., wird 1. entspr. Datens. zurückg., sonst null.
 */
function getRespondentRecordFromRespondentID($respondent_id)
{
    global $fm;
    //Layout angeben
    $find = $fm->newFindCommand('Respondent');
    //Geben Sie das Feld und den Wert für den Abgleich an. In diesem Fall ist 'Respondent ID' das Feld
    // und $respondent_id der Wert.
    $find->addFindCriterion('Respondent ID', $respondent_id);
    //Suche durchführen
    $results = $find->execute();
    //Auf Fehler überprüfen
    if (!FileMaker::isError($results)) {
        //Keine Fehler, erstes entsprechendes Ergebnis zurückgeben
        $records = $results->getRecords();
        return $records[0];
    } else {
        //Fehler aufgetreten, null zurückgeben (d. h. keine Datensätze gefunden)
        return null;
    }
}
示例#3
0
 function setFieldFromTimestamp($V972bf3f0, $Vd7e6d55b, $V6d786dc7 = 0)
 {
     $Vc6140495 = $this->_fm->getLayout($this->_layout);
     if (FileMaker::isError($Vc6140495)) {
         return $Vc6140495;
     }
     $V06e3d36f = $Vc6140495->getField($V972bf3f0);
     if (FileMaker::isError($V06e3d36f)) {
         return $V06e3d36f;
     }
     switch ($V06e3d36f->getResult()) {
         case 'date':
             return $this->setField($V972bf3f0, date('m/d/Y', $Vd7e6d55b), $V6d786dc7);
         case 'time':
             return $this->setField($V972bf3f0, date('H:i:s', $Vd7e6d55b), $V6d786dc7);
         case 'timestamp':
             return $this->setField($V972bf3f0, date('m/d/Y H:i:s', $Vd7e6d55b), $V6d786dc7);
     }
     return new FileMaker_Error($this->_fm, 'Only time, date, and timestamp fields can be set to the value of a timestamp.');
 }
示例#4
0
/**
 * La fonction effectue une recherche sur le modèle 'Respondent' avec valeur récup.
 * via $respondent_id. Si des enregistr. correspondent, le 1er s'affiche. Dans le cas contraire, rien ne s'affiche.
 */
function getRespondentRecordFromRespondentID($respondent_id)
{
    global $fm;
    //Spécifiez le modèle
    $find = $fm->newFindCommand('Respondent');
    //Indiquez la rubrique et la valeur à rechercher. Dans ce cas, 'Respondent ID' correspond à la rubrique
    // et $respondent_id représente la valeur.
    $find->addFindCriterion('Respondent ID', $respondent_id);
    //Exécutez la recherche
    $results = $find->execute();
    //Vérifiez les erreurs
    if (!FileMaker::isError($results)) {
        //S'il n'y a pas d'erreur, affichez le premier résultat correspondant
        $records = $results->getRecords();
        return $records[0];
    } else {
        //En cas d'erreur, n'affichez aucun résultat (aucune valeur trouvée)
        return null;
    }
}
示例#5
0
/**
 * This function performs a Find on the 'Respondent' layout using the value passed in
 * via $respondent_id. If found, it returns the first matching record. Otherwise, it returns null.
 */
function getRespondentRecordFromRespondentID($respondent_id)
{
    global $fm;
    //Specify the layout
    $find = $fm->newFindCommand('Respondent');
    //Specify the field and value to match against. In this case, 'Respondent ID' is the field
    // and $respondent_id is the value.
    $find->addFindCriterion('Respondent ID', $respondent_id);
    //Perform the find
    $results = $find->execute();
    //Check for errors
    if (!FileMaker::isError($results)) {
        //No errors, return first matching result
        $records = $results->getRecords();
        return $records[0];
    } else {
        //There was an error, return null (i.e. no matches found)
        return null;
    }
}
示例#6
0
function getRequest($pkId)
{
    global $fmOrderDB, $request, $site_prefix, $port, $log;
    $log->debug("Get request using PK: " . $pkId);
    $pageUrl = urlencode($port . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
    /* Open the database and add ID to find command **/
    $requestFind = $fmOrderDB->newFindCommand('[WEB] Project Request');
    $requestFind->addFindCriterion('__pk_ID', '==' . $pkId);
    $requestFinds = $requestFind->execute();
    /** Check for errors and if so send to error processing and report to user */
    if (FileMaker::isError($requestFinds)) {
        $errorTitle = "FileMaker Error";
        $log->error($requestFinds->getMessage(), $requestFinds->getErrorString(), $pageUrl, $pkId, $site_prefix);
        processError($requestFinds->getMessage(), $requestFinds->getErrorString(), $pageUrl, $pkId, $errorTitle);
        exit;
    }
    /** Now pull all records of find command for Requests (Parent of Meta data) and pull the first record of the array */
    $requests = $requestFinds->getRecords();
    $request = $requests[0];
    $log->debug("Finished now have record with PK: " . $pkId);
}
示例#7
0
function fmPutContainer($connection = null, $layout_name = null, $container_field_name = null, $record_object = null, $uploaded_file_handle = null)
{
    // Move the file from PHP's temp folder to the uploads folder.
    move_uploaded_file($uploaded_file_handle['tmp_name'], UPLOAD_PATH . '/' . $uploaded_file_handle['name']);
    // Set the URL to the uploaded file.
    $file_url = UPLOAD_URL . '/' . $uploaded_file_handle['name'];
    // Setup the request as an "edit" command.
    $fm_request = $connection->newEditCommand($layout_name, $record_object->getRecordId());
    $fm_request->setField($container_field_name, '');
    $fm_request->setScript('FMWebFrame', 'Upload' . "\n" . $container_field_name . "\n" . $file_url);
    $fm_result = $fm_request->execute();
    if (FileMaker::isError($fm_result)) {
        $errors = '<h1>fmPutContainer: An unexpected error has occurred.</h1>';
        echo "Error Code: " . $fm_result->code . "<br>";
        echo "Error Message: " . $fm_result->getMessage() . "<br>";
        die;
    }
    // Delete the temp file.
    unlink(UPLOAD_PATH . '/' . $uploaded_file_handle['name']);
    // Get the record that the file was uploaded to.
    $records = $fm_result->getRecords();
    $record = $records[0];
    return $record;
}
示例#8
0
 * by implication, by FileMaker.
 * 
 * Example PHP script to illustrate how to list databases on the server.
 * 
 * Requirements:
 *   1. Working FileMaker Server installation
 *   2. 'FMPHP_Sample' database hosted in FileMaker Server
 *
 */
// Include FileMaker API
require_once 'FileMaker.php';
// Create a new connection to server without specifying database or hostspec.
$fm = new FileMaker();
// Set 'hostspec' property using setProperty()
$fm->setProperty('hostspec', 'http://localhost');
$databases = $fm->listDatabases();
// If an error is found, return a message and exit.
if (FileMaker::isError($databases)) {
    printf("Error %s: %s\n", $databases->getCode());
    "<br>";
    printf($databases->getMessage());
    exit;
}
// Print out layout names
foreach ($databases as $db) {
    echo "{$db}<br>";
}
?>
</body>
</html>
示例#9
0
$dataset_budget['highlightFill'] = "rgba(220,220,220,0.75)";
$dataset_budget['highlightStroke'] = "rgba(220,220,220,1)";
$dataset_budget['data'] = $data_budget;
$dataset[] = $dataset_budget;
foreach ($periods as $dt) {
    $dt_end = clone $dt;
    $start = $dt->modify('first day of this month');
    $end = $dt_end->modify('last day of this month');
    $d = '{' . $start->format('d') . '...' . $end->format('d') . '}';
    $m = $start->format('m');
    $y = $start->format('Y');
    $events = new Events();
    $search = array('date' => "{$m}/{$d}/{$y}", 'client_id' => $client_id, 'service_id' => $service_id);
    $parameter = Events::getAsParameter($search, Events::getFields());
    $parameter = json_encode($parameter);
    $foundEvents = $events->find($parameter, $inclusionFirst);
    error_log("{$m}/{$d}/{$y}");
    if (!FileMaker::isError($foundEvents)) {
        $data_scheduled[] = FM_Table::summarize($foundEvents, 'duration_unix') / 60 / 60;
    } else {
        $data_scheduled[] = 0;
    }
}
$dataset_scheduled['fillColor'] = "rgba(151,187,205,0.5)";
$dataset_scheduled['strokeColor'] = "rgba(151,187,205,0.8)";
$dataset_scheduled['highlightFill'] = "rgba(151,187,205,0.75)";
$dataset_scheduled['highlightStroke'] = "rgba(151,187,205,1)";
$dataset_scheduled['data'] = $data_scheduled;
$dataset[] = $dataset_scheduled;
$data['datasets'] = $dataset;
echo json_encode($data);
示例#10
0
             foreach ($relatedSet as $relatedRow) {
                 $possible_answer = $relatedRow->getField('question_answers::answer');
                 echo '<option value="' . $possible_answer . '">' . $possible_answer . '</option>';
             }
             //print the end tag for a HTML pulldown menu
             echo '</select>';
         } else {
             if ($question_type == "checkbox") {
                 /*
                  * If the question_type calls for checkboxes, we need to retrieve a
                  * list of acceptable responses to this question.
                  */
                 //Get the portal 'question_answers'
                 $relatedSet = $question->getRelatedSet('question_answers');
                 //check for an error
                 if (FileMaker::isError($relatedSet)) {
                     echo "<p>Error: " . $relatedSet->getMessage() . "</p>";
                     exit;
                 }
                 //display each of the possible answers as a HTML checkbox
                 foreach ($relatedSet as $relatedRow) {
                     $possible_answer = $relatedRow->getField('question_answers::answer');
                     echo '<input type= "checkbox" name="cbanswer[]" value= "' . $possible_answer . '"/ >' . $possible_answer . '<br/>';
                 }
             } else {
                 //If $question_type is undefined or unrecognized, default to a HTML text input
                 echo '<input type="text" name="text_answer" size="60" value=""/>';
             }
         }
     }
 }
示例#11
0
 function getStyleType()
 {
     $Vb4a88417 = $this->_layout->loadExtendedInfo();
     if (FileMaker::isError($Vb4a88417)) {
         return $Vb4a88417;
     }
     return $this->_styleType;
 }
示例#12
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: Bill
 * Date: 1/8/2015
 * Time: 1:23 PM
 */
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . "request-config.php";
include_once $fmfiles . "order.db.php";
include_once $errors . 'errorProcessing.php';
$typePkId = urldecode($_GET['pkId']);
$newProjectType = $fmOrderDB->newPerformScriptCommand('[WEB] Project Request Types', 'NewProjectRequest(RequestType_pk_ID)', $typePkId);
$newProjectTypeResults = $newProjectType->execute();
if (FileMaker::isError($newProjectTypeResults)) {
    $errorTitle = "FileMaker Error";
    $log->error("Failure to open " . $deliverableView . " " . $newProjectTypeResults->getMessage() . " " . $newProjectTypeResults->getCode());
    processError($newProjectTypeResults->getMessage(), $newProjectTypeResults->getErrorString(), "getNewPackageType.php", $typePkId, $errorTitle);
}
$typeRecord = $newProjectTypeResults->getFirstRecord();
$projectId = $typeRecord->getField('__pk_ID');
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Pragma: no-cache');
header('Location: ' . $site_prefix . 'onrequest/request.php?pkId=' . urlencode($projectId));
?>

示例#13
0
 /** Checks Filemaker_Result to make sure it is not an error.
  *  When loud is set to true, this function will throw
  *  an exception if the result is an error.
  *  
  *  When loud is set to false, the function will
  *  only return true or false depending on whether
  *  the result is an error or not.
  *  
  *  Error 401 has been overriden to return BLANK instead of ERROR.
  *  Exceptions are only thrown for critical errors that shouldn't happen.
  *  On the other hand, 401 errors can happen all the time if a search
  *  query doesn't return any results. This is normal behavior and should not throw an exception.
  */
 public function validateResult($result, $loud = true)
 {
     $isError = FileMaker::isError($result);
     if ($isError == true) {
         // 401 is a no record found error, so we don't want to throw a model exception for this.
         if ($result->getCode() == "401") {
             return self::$BLANK;
         } else {
             //only throw an exception if this is a loud validation
             if ($loud) {
                 throw new ModelException("Error retrieving information from database: " . $result->getCode(), $result->getCode());
             }
             return self::$ERROR;
         }
     }
     if ($isError == false) {
         return self::$VALID;
     }
 }
示例#14
0
文件: home.php 项目: rjakes/SimpleFM
$records = $result->getRecords();
//アクティブなアンケートの questionnaire_id を取得して保存
$record = $records[0];
$active_questionnaire_id = $record->getField('questionnaire_id');
/**
 * アクティブなアンケートを取得するには、$active_questionniare_id を使用し、
 * 'questionnaire' レイアウトで別の検索を実行します。
 */
//find コマンドを作成して、レイアウトを指定
$findCommand =& $fm->newFindCommand('questionnaire');
//フィールドおよび一致する値を指定します。
$findCommand->addFindCriterion('Questionnaire ID', $active_questionnaire_id);
//検索の実行
$result = $findCommand->execute();
//エラーをチェック
if (FileMaker::isError($result)) {
    echo "<p>エラー:  " . $result->getMessage() . "</p>";
    exit;
}
//一致するレコードを保存
$records = $result->getRecords();
$record = $records[0];
//レコードから 'Questionnaire Name' フィールドを取得して表示
echo "<p> " . $record->getField('Questionnaire Name') . "</p>";
//レコードから 'Description' フィールドを取得して表示
echo "<p>アンケートについての説明: " . $record->getField('Description') . "</p>";
//ContainerBridge.php を使用して、レコードから 'Graphic' フィールドを取得し、表示してください。
echo '<img src="ContainerBridge.php?path=' . urlencode($record->getField('Graphic')) . '">';
?>
    <form id="questionnaire_form" name="Respondent" align= "right" method="post" action="Respondent.php">
        <input type="hidden" name="active_questionnaire_id" value = "<?php 
示例#15
0
 * User: Bill
 * Date: 8/19/2016
 * Time: 11:06 AM
 */
include_once $_SERVER["DOCUMENT_ROOT"] . "/onweb" . "/onweb-config.php";
include_once $fmfiles . "order.db.php";
$log->debug(" ");
$log->debug("********* Start Marker Testing LDAP Connection With FM ***********");
$letMeIn = "";
$username = "******";
$password = "******";
$loginLayout = "[WEB] Login";
$searchHandle = $fmOrderDB->newFindCommand($loginLayout);
$searchHandle->addFindCriterion("User_Name_ct", "==" . $username);
$searchResults = $searchHandle->execute();
if (FileMaker::isError($searchResults)) {
    $log->error("Failed on search: " . $searchResults->getMessage());
    exit;
}
$userRecord = $searchResults->getFirstRecord();
$baseDn = $userRecord->getField("ONWEB_LDAP_base_dn_ct");
$companyDomain = $userRecord->getField('ONWEB_LDAP_company_domain_ct');
$ldapServer = $userRecord->getField('ONWEB_LDAP_server_ct');
$ldapPort = $userRecord->getField('ONWEB_LDAP_port_ct');
$groupNames = array($userRecord->getField('ONWEB_LDAP_group_name_ct'));
$fieldsToSearch = array($userRecord->getField('ONWEB_LDAP_fieldsToSearch_ct'));
$ldapRawFilter = html_entity_decode($userRecord->getField('ONWEB_LDAP_filter_ct'));
//This was added to work around a single quoted string PHP cannot use variable names inside a single quoted string
$ldapFilter = str_replace('$username', $username, $ldapRawFilter);
//LDAP Definitions to be used in AD login
define("COMPANYDOMAIN", $companyDomain);
示例#16
0
 function loadExtendedInfo($Vd33e904c = null)
 {
     if (!$this->_extended) {
         if ($Vd33e904c != null) {
             $V0f635d0e = $this->_fm->_execute(array('-db' => $this->_fm->getProperty('database'), '-lay' => $this->getName(), '-recid' => $Vd33e904c, '-view' => null), 'FMPXMLLAYOUT');
         } else {
             $V0f635d0e = $this->_fm->_execute(array('-db' => $this->_fm->getProperty('database'), '-lay' => $this->getName(), '-view' => null), 'FMPXMLLAYOUT');
         }
         $V3643b863 = new FileMaker_Parser_FMPXMLLAYOUT($this->_fm);
         $Vb4a88417 = $V3643b863->parse($V0f635d0e);
         if (FileMaker::isError($Vb4a88417)) {
             return $Vb4a88417;
         }
         $V3643b863->setExtendedInfo($this);
         $this->_extended = true;
     }
     return $this->_extended;
 }
示例#17
-1
 function &execute()
 {
     $V21ffce5b = $this->_getCommandParams();
     $this->_setSortParams($V21ffce5b);
     $this->_setRangeParams($V21ffce5b);
     $this->_setRelatedSetsFilters($V21ffce5b);
     if (count($this->_findCriteria) || $this->_recordId) {
         $V21ffce5b['-find'] = true;
     } else {
         $V21ffce5b['-findall'] = true;
     }
     if ($this->_recordId) {
         $V21ffce5b['-recid'] = $this->_recordId;
     }
     if ($this->Vf951bdce) {
         $V21ffce5b['-lop'] = $this->Vf951bdce;
     }
     foreach ($this->_findCriteria as $Vd1148ee8 => $Ve9de89b0) {
         $V21ffce5b[$Vd1148ee8] = $Ve9de89b0;
     }
     $V0f635d0e = $this->_fm->_execute($V21ffce5b);
     if (FileMaker::isError($V0f635d0e)) {
         return $V0f635d0e;
     }
     return $this->_getResult($V0f635d0e);
 }
示例#18
-1
function pushDocumentDataToFM($original, $temp, $pkId)
{
    global $fmOrderDB, $log;
    /* TODO need to investigate why getRelatedRecords() Stopped Working */
    $metaFind = $fmOrderDB->newFindCommand('[WEB] Project Meta Fields');
    $metaFind->addFindCriterion('__pk_ID', '==' . $pkId);
    $metaResults = $metaFind->execute();
    if (FileMaker::isError($metaResults)) {
        $errorTitle = "FileMaker Error";
        $log->error("pushDocumentDataToFM - Failure to open " . $metaResults . " " . $metaResults->getMessage() . " " . $metaResults->getCode());
        processError($metaResults->getMessage(), $metaResults->getErrorString(), "deliverableService.php", $pkId, $errorTitle);
        exit;
    }
    $metaRelatedRecords = $metaResults->getRecords();
    $metaRecord = $metaRelatedRecords[0];
    $metaRecord->setField('Upload_Filename_Original_t', $original);
    $metaRecord->setField("Upload_Filename_Temp_t", $temp);
    $result = $metaRecord->commit();
    if (FileMaker::isError($result)) {
        $errorTitle = "FileMaker Error";
        $log->error("pushDocumentDataToFM - Failure to open " . $metaResults . " " . $result->getMessage() . " " . $result->getCode());
        processError($result->getMessage(), $result->getErrorString(), "deliverableService.php", $pkId, $errorTitle);
        exit;
    }
}
示例#19
-1
function fmEvaluate($connection, $expression)
{
    // If the specified database connection isn't valid...
    if (!isset($connection)) {
        $error_message = 'fmEvaluate failed. It looks like the database connection that was specified is invalid.';
        die($error_message);
    }
    // Setup the Find All command against the FMWebFrame Interface layout.
    $fm_request = $connection->newFindAllCommand('FMWebFrame');
    // Create the "newPerformScriptCommand" request.
    $fm_request = $connection->newPerformScriptCommand('FMWebFrame', 'FMWebFrame', "evaluate\n" . $expression);
    // Execute the request.
    $fm_result = $fm_request->execute();
    // If there was an error...
    if (FileMaker::isError($fm_result)) {
        $error_message = 'fmExecuteSQL failed with error ' . $fm_result->code . '.';
        die($error_message);
    } else {
        // Get the result.
        $result_records = $fm_result->getRecords();
        $result_record = $result_records[0];
    }
    // Convert the result into an associative array.
    $result_array = array();
    $result_array['Expression'] = $expression;
    $result_array['Result'] = $result_record->getField('Result_Data');
    return $result_array;
}
function handleDBError($request_object, $s_system_status = '')
{
    if (FileMaker::isError($request_object)) {
        $request_error_code = $request_object->getCode();
        if ($request_error_code != 401) {
            // Errors:
            //      - The requested URL returned error: 404
            //          - Possible reasons: Access via PHP not enabled. Instant Web Publishing not enabled
            //      - The requested URL returned error: 401
            //          - Invalid Username and password
            //
            //echo date("Y-m-d")." Error: " . $request_object->getCode()." - ".$request_object->getMessage() . "\n";
            redirect('/oops/' . $request_error_code);
            //exit;
        } else {
            return $request_error_code;
        }
    } elseif ($s_system_status != '') {
        if (strtolower($s_system_status) != 'live') {
            // System Offline
            unset($_SESSION["user"]);
            redirect('/maintenance.php?status=offline');
            exit;
        }
    }
}
 /**
  * Checks whether there is an error in the resource given.
  *
  * @author  RichardC
  * @since   1.0
  *
  * @version 1.6
  *
  * @param   obj     $request_object
  *
  * @return  int
  */
 public static function isError($request_object)
 {
     if (is_array($request_object) && preg_grep('/^([^*)]*)error([^*)]*)$/', array_keys($request_object))) {
         foreach ($request_object as $key => $val) {
             return (int) $val;
         }
     }
     return FileMaker::isError($request_object) ? (int) $request_object->getCode() : 0;
 }
 function execute()
 {
     $commandParams = $this->_getCommandParams();
     $commandParams['-findany'] = true;
     $result = $this->_fm->_execute($commandParams);
     if (FileMaker::isError($result)) {
         return $result;
     }
     return $this->_getResult($result);
 }
示例#23
-1
 function execute()
 {
     $V21ffce5b = $this->_getCommandParams();
     $V21ffce5b['-findany'] = true;
     $V0f635d0e = $this->_fm->_execute($V21ffce5b);
     if (FileMaker::isError($V0f635d0e)) {
         return $V0f635d0e;
     }
     return $this->_getResult($V0f635d0e);
 }
function fmDisplaySearchResults($result, $whetherToPaginate)
{
    global $skip, $paginate_number, $max, $page, $querystring;
    // If an error is found, return a message and exit.
    if (FileMaker::isError($result)) {
        echo "Error: " . $result->getMessage() . "<br>";
        //exit;
    } else {
        // Get records from found set
        $records = $result->getRecords();
        $found = $result->getFoundSetCount();
        //Setup sort by type
        $fileType = $records[0]->getField('Source_Type');
        if ($fileType != "Video") {
            $fileType = "Images";
        }
        echo '<div class="recordSeparator">' . $fileType . '</div>';
        foreach ($records as $record) {
            //searchResultDisplay($record,$fileType);
            if ($record->getField('Source_Type') == "Video") {
                displayVideoPreview($record);
            } else {
                if ($fileType != "Images") {
                    echo '<p>&nbsp;</p><div class="recordSeparator">Images</div>';
                }
                displayImgPreview($record);
                $fileType = "Images";
            }
        }
        if ($whetherToPaginate) {
            // adds pagination if specified. Disabled for "recent additions" mode.
            ?>

			<div style="clear: both; padding-top: 20px; text-align: right;"><!--pagination div-->
			<?php 
            //pagination
            $displayed = count($records);
            $pagenum = ceil($skip / $max + 1);
            $pagetotal = ceil($found / $max);
            if ($skip + $max > $found) {
                $next = $skip;
            }
            echo "Displaying <b>{$displayed}</b> of <b>{$found}</b> results<br /><br />";
            paginate($querystring, $page, $pagetotal);
            ?>
			</div>
			<?php 
        }
    }
}
示例#25
-1
function fmSearchResults($searchArray, $searchLayout, $sortArray, $page)
{
    // Grabs variables from outside the function
    global $fm, $max, $querystring, $fmDefaultSortArray;
    // Uses maximum and URL to tell page how many to skip.
    $skip = ($page - 1) * $max;
    // Create FileMaker_Command_CompoundFind object on layout to search
    $compoundFind =& $fm->newCompoundFindCommand($searchLayout);
    $compoundFindNum = 0;
    $findreq =& $fm->newFindRequest($searchLayout);
    // Create find requests on layout
    foreach ($searchArray as $searchName => $searchCriteria) {
        // adds find criteria
        if (strpos($searchName, 'EXACT_') !== false) {
            //If given keywords with "EXACT_" prefix, searches for exact match in field
            $searchNameExact = str_replace("EXACT_", "", $searchName);
            $findreq->addFindCriterion($searchNameExact, "=={$searchCriteria}");
        } elseif ($searchName == "Work_Date_Begin") {
            $findreq->addFindCriterion($searchName, ">{$searchCriteria}");
        } elseif ($searchName == "page") {
        } else {
            $findreq->addFindCriterion($searchName, $searchCriteria);
        }
        $compoundFind->add($compoundFindNum, $findreq);
    }
    // Set Range
    $compoundFind->setRange($skip, $max);
    // Set sort order
    $sorti = 1;
    foreach ($sortArray as $sortName => $sortCriteria) {
        if ($sortCriteria == "descend") {
            $compoundFind->addSortRule($sortName, $sorti, FILEMAKER_SORT_DESCEND);
        } else {
            $compoundFind->addSortRule($sortName, $sorti, FILEMAKER_SORT_ASCEND);
        }
        $sorti++;
    }
    $defaultSortOrder = $fmDefaultSortArray[$searchLayout];
    $compoundFind->addSortRule($defaultSortOrder, $sorti, FILEMAKER_SORT_ASCEND);
    // Execute compound find command
    $result = $compoundFind->execute();
    if (FileMaker::isError($result)) {
        echo "Error: " . $result->getMessage() . "<br>";
        return null;
        //exit;
    } else {
        $records = $result->getRecords();
        return $records;
    }
}
示例#26
-1
 function &execute()
 {
     if (empty($this->_recordId)) {
         $Vcb5e100e = new FileMaker_Error($this->_fm, 'Delete commands require a record id.');
         return $Vcb5e100e;
     }
     $V21ffce5b = $this->_getCommandParams();
     $V21ffce5b['-delete'] = true;
     $V21ffce5b['-recid'] = $this->_recordId;
     $V0f635d0e = $this->_fm->_execute($V21ffce5b);
     if (FileMaker::isError($V0f635d0e)) {
         return $V0f635d0e;
     }
     return $this->_getResult($V0f635d0e);
 }
示例#27
-1
 function FX_Fuzzy_Debugger(&$fmConnection, &$dataSet = '')
 {
     if ((bool) (is_object($fmConnection) && (strtolower(get_class($fmConnection)) == 'filemaker' || is_subclass_of($fmConnection, 'filemaker')))) {
         require_once 'FileMaker.php';
         $this->connectionType = FILEMAKER_API_CONNECTION;
         $this->currentConnection = clone $fmConnection;
         $this->currentDataSet = $dataSet;
         if (FileMaker::isError($dataSet)) {
             if (!isset($dataSet->code) || strlen(trim($dataSet->code)) < 1) {
                 $currentErrorMessage = "<p>A connection or XML error occured during your FileMaker query.<br />\n";
                 $currentErrorMessage .= "You may be able to get additional information by performing the same query using FX.php,<br />\n";
                 $currentErrorMessage .= "combined with a DEBUG constant and php's print_r() function.<br />\n";
                 $currentErrorMessage .= "Also, check your <strong>FileMaker Server Advanced configuration</strong>, and verify the <strong>server address</strong> used.</p>\n";
                 return $currentErrorMessage;
             } else {
                 $this->currentErrorCode = $dataSet->code;
             }
         } else {
             $this->currentErrorCode = 0;
         }
         $this->currentDatabase = $this->currentConnection->getProperty('database');
         $this->currentLayout = '';
     } elseif ((bool) (is_object($fmConnection) && (strtolower(get_class($fmConnection)) == 'fx' || is_subclass_of($fmConnection, 'fx')))) {
         require_once 'FX.php';
         $this->connectionType = FX_CONNECTION;
         $this->currentConnection = clone $fmConnection;
         if (is_array($dataSet) && isset($dataSet['errorCode'])) {
             $this->currentErrorCode = $dataSet['errorCode'];
         } else {
             $this->currentErrorCode = $fmConnection->lastErrorCode;
         }
         $this->currentDatabase = $this->currentConnection->database;
         $this->currentLayout = $this->currentConnection->layout;
         foreach ($this->currentConnection->lastQueryParams as $tempParam) {
             if (substr($tempParam['name'], 0, 1) != '-') {
                 // as long as the current field name doesn't begin with a '-' (FM reserved), add it to the list of fields
                 $this->currentFieldsArray[] = $tempParam['name'];
             }
         }
     } else {
         $currentErrorMessage = "<p>The FX Fuzzy Debugger does not support the type of connection that was passed in.<br />\n";
         $currentErrorMessage .= "Double check that the first parameter is either an FX object or a FileMaker object.</p>\n";
         $this->fuzzyOut = $currentErrorMessage;
         return;
     }
     $this->fuzzyOut = $this->ProcessErrorCode();
 }
示例#28
-1
 function execute()
 {
     $V090cbceb = null;
     $V8ac10dab = 0;
     $V31c3c8cf = 0;
     $V40677621 = 1;
     $Ve2942a04 = 1;
     $V21ffce5b = $this->_getCommandParams();
     $this->_setSortParams($V21ffce5b);
     $this->_setRangeParams($V21ffce5b);
     $this->_setRelatedSetsFilters($V21ffce5b);
     ksort($this->Vad2bfd5a);
     $V31c3c8cf = count($this->Vad2bfd5a);
     foreach ($this->Vad2bfd5a as $V70a17ffa => $V9a7aa128) {
         $V15c46c6e = $V9a7aa128->_impl->_findCriteria;
         $V8ac10dab = count($V15c46c6e);
         $V090cbceb = $V090cbceb . '(';
         $V4111477f = 0;
         foreach ($V15c46c6e as $Vd1148ee8 => $Ve9de89b0) {
             $V21ffce5b['-q' . $Ve2942a04] = $Vd1148ee8;
             $V21ffce5b['-q' . $Ve2942a04 . '.' . "value"] = $Ve9de89b0;
             $V090cbceb = $V090cbceb . 'q' . $Ve2942a04;
             $Ve2942a04++;
             $V4111477f++;
             if ($V4111477f < $V8ac10dab) {
                 $V090cbceb = $V090cbceb . ',';
             }
         }
         $V090cbceb = $V090cbceb . ")";
         $V40677621++;
         if ($V40677621 <= $V31c3c8cf) {
             $V4b22ce92 = $this->Vad2bfd5a[$V40677621];
             if ($V4b22ce92->_impl->_omit == true) {
                 $V090cbceb = $V090cbceb . ';!';
             } else {
                 $V090cbceb = $V090cbceb . ';';
             }
         }
     }
     $V21ffce5b['-query'] = $V090cbceb;
     $V21ffce5b['-findquery'] = true;
     $V0f635d0e = $this->_fm->_execute($V21ffce5b);
     if (FileMaker::isError($V0f635d0e)) {
         return $V0f635d0e;
     }
     return $this->_getResult($V0f635d0e);
 }
示例#29
-1
/**
 * この関数は、$respondent_id 経由で渡された値を使用して、'Respondent' レイアウト上で検索を実行します。
 * 見つかった場合には、最初に一致したレコードを返します。その他の場合は、null を返します。
 */
function getRespondentRecordFromRespondentID($respondent_id)
{
    global $fm;
    //レイアウトを指定
    $find = $fm->newFindCommand('Respondent');
    //フィールドおよび一致する値を指定します。 この場合は、'Respondent ID' がフィールドで、
    // $respondent_id が値です。
    $find->addFindCriterion('Respondent ID', $respondent_id);
    //検索の実行
    $results = $find->execute();
    //エラーをチェック
    if (!FileMaker::isError($results)) {
        //エラーなし、最初に一致した結果を返す
        $records = $results->getRecords();
        return $records[0];
    } else {
        //エラーがあった。null を返す (つまり、一致は見つからなかった)
        return null;
    }
}
示例#30
-1
/**
 * Den här funktionen utför en sökning i layouten 'Respondent' med hjälp av det värde som 
 * skickas via $respondent_id. Om det hittas, returneras den första matchande posten. Annars returneras noll. 
 */
function getRespondentRecordFromRespondentID($respondent_id)
{
    global $fm;
    //Ange layout
    $find = $fm->newFindCommand('Respondent');
    //Ange fält och värde för matchning. I det här fallet är fältet 'Respondent ID'
    // och värdet är $respondent_id.
    $find->addFindCriterion('Respondent ID', $respondent_id);
    //Utför sökningen
    $results = $find->execute();
    //Felkontroll
    if (!FileMaker::isError($results)) {
        //Inga fel, returnera första matchande resultat.
        $records = $results->getRecords();
        return $records[0];
    } else {
        //Det fanns fel, returnera noll (dvs inga matchningar hittades)
        return null;
    }
}