Beispiel #1
0
 function getSuggestedEntries()
 {
     if (!defined('_ADODB_LAYER')) {
         $rs = new KT_Recordset($GLOBALS[$this->config['recordset']]);
     } else {
         $rs =& $GLOBALS[$this->config['recordset']];
     }
     $index = 0;
     $arr = array();
     while (!$rs->EOF && $index < $this->options['numberOfSuggestions']) {
         $arr[] = $rs->Fields($this->config['suggestField']);
         $index++;
         $rs->MoveNext();
     }
     return array('choices' => $arr);
 }
    function WDG_JsRecordset($RecordsetName)
    {
        $rs = $GLOBALS[$RecordsetName];
        if (is_resource($rs)) {
            $recordset = new KT_Recordset($rs);
        } else {
            $recordset =& $rs;
        }
        $nl = "\r\n";
        $this->outputString .= <<<EOD
<script>
top.jsRawData_{$RecordsetName} = [

EOD;
        $fieldCount = $recordset->FieldCount();
        $fieldNames = array();
        for ($i = 0; $i < $fieldCount; $i++) {
            $meta = $recordset->FetchField($i);
            if ($meta) {
                $fieldNames[] = $meta->name;
                $this->outputString .= ($i == 0 ? '[' : ', ') . '"' . $meta->name . '"';
            }
        }
        $this->outputString .= <<<EOD
],
//data

EOD;
        while (!$recordset->EOF) {
            $arr = array();
            foreach ($fieldNames as $field) {
                $arr[] = $recordset->Fields($field);
            }
            $this->outputString .= WDG_phparray2jsarray($arr) . ', ';
            $recordset->MoveNext();
        }
        $this->outputString .= <<<EOD
[]
];
top.{$RecordsetName} = new JSRecordset('{$RecordsetName}');
</script>
EOD;
        //restore old rs position
        $recordset->MoveFirst();
    }
Beispiel #3
0
 /**
  * Creates a fake recordset array from the current $columns
  * This function is called ONLY on error
  * @return array associative array with the current values.
  * @access protected
  */
 function getFakeRsArr()
 {
     tNG_log::log('tNG' . $this->transactionType, "getFakeRsArr");
     $localRs = $this->getLocalRecordset();
     if (is_resource($localRs)) {
         $localRs = new KT_Recordset($localRs);
     }
     $fakeArr = array();
     $tmpArr = $this->columns;
     if (!isset($tmpArr[$this->primaryKey]) && trim($this->primaryKey) != '') {
         $tmpArr[$this->primaryKey] = $this->primaryKeyColumn;
     }
     // Transaction was executed and failed, create the recordset from the submitted values
     foreach ($tmpArr as $colName => $colDetails) {
         if ($colDetails['method'] == "CURRVAL") {
             $value = KT_escapeForSql($localRs->Fields($colName), "STRING_TYPE", true);
         } else {
             $value = KT_escapeForSql($colDetails['value'], "STRING_TYPE", true);
         }
         $fakeArr[$colName] = $value;
     }
     $savedPK = $this->getSavedValue($this->primaryKey);
     if (!is_null($savedPK)) {
         $fakeArr[$this->pkName] = KT_escapeForSql($savedPK, "STRING_TYPE", true);
     } else {
         $fakeArr[$this->pkName] = "";
     }
     return $fakeArr;
 }