Esempio n. 1
0
            print "<br/>Is Tmestamp\n";
        }
        if ($colval->type == 11) {
            print "<br/>Is Time\n";
        }
        if ($colval->type == 13) {
            print "<br/>Is Year\n";
        }
        printf("<br/>length: %d\n", $colval->length);
        printf("<br/>def: %d\n", $colval->def);
        //printf("<br/>charsetnr: %d\n", $val->charsetnr);
        printf("<br/>decimals: %d\n", $colval->decimals);
        //printf("<br/>Flags:    %d\n", $val->flags);
        printf("<br/>Type:     %d\n\n", $colval->type);
        $FieldDataType = getFieldDataType($colval->type);
        echo "<b>" . getFieldType($colval->type) . "</b>";
        echo "<br />Select field: <input type='checkbox' name='" . $colval->name . "' value='" . $colval->name . "|" . $FieldDataType . "' />";
        echo "<br><br>";
        $FieldDataType = empty($FieldDataType);
    }
    mysqli_free_result($rsCol);
}
/* close connection */
mysqli_close($link);
?>


<input type="submit" value="Submit" name="Submit">
</form>

</body>
Esempio n. 2
0
function field_cache()
{
    global $iCMS;
    $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__field`");
    $_count = count($rs);
    for ($i = 0; $i < $_count; $i++) {
        $rs[$i]['rules'] = unserialize($rs[$i]['rules']);
        if ($rs[$i]['rules']['choices']) {
            $rs[$i]['rules'] = getFieldChoices($rs[$i]['rules']['choices']);
        }
        $rs[$i]['typeText'] = getFieldType($rs[$i]['type']);
        $rs[$i]['validateText'] = getFieldvalidate($rs[$i]['validate']);
        $res[$rs[$i]['field']][$rs[$i]['mid']] = $rs[$i];
        $mres[$rs[$i]['mid']][$rs[$i]['field']] = $rs[$i];
    }
    $iCMS->setCache('system/model.field', $mres, 0)->setCache('system/field.model', $res, 0)->setCache('system/field.cache', $rs, 0);
}
Esempio n. 3
0
        ?>
" />
                 <?php 
        echo $i + 1;
        ?>
</td>
              <td><?php 
        echo $fRs[$i]['name'];
        ?>
</td>
              <td><?php 
        echo $fRs[$i]['field'];
        ?>
</td>
              <td><?php 
        echo getFieldType($fRs[$i]['type']);
        ?>
</td>
              <td><?php 
        echo $fRs[$i]['mid'] == "0" ? '通用模型' : $model[$fRs[$i]['mid']]['name'];
        ?>
</td>
              <td><?php 
        echo getFieldvalidate($fRs[$i]['validate']);
        ?>
</td>
            </tr>
            <?php 
    }
}
?>
Esempio n. 4
0
function displayRowsAsXml($rows, $viewModel, $page, $total_pages, $count)
{
    // we should set the appropriate header information. Do not forget this.
    header("Content-type: text/xml;charset=utf-8");
    $s = "<?xml version='1.0' encoding='utf-8'?>";
    $s .= "<rows>";
    $s .= "<page>" . $page . "</page>";
    $s .= "<total>" . $total_pages . "</total>";
    $s .= "<records>" . $count . "</records>";
    foreach ($rows as $row) {
        // be sure to put text data in CDATA
        $s .= "<row id='" . $row->ID . "'>";
        foreach ($viewModel["fields"] as $fieldName => $fieldInfos) {
            $s .= "<cell>";
            if (getFieldType($viewModel, $fieldName) == "string") {
                //            $s .= "<![CDATA[".utf8_decode($row->$fieldName)."]]>";//"<![CDATA[".$row->$fieldName."]]>";
                $s .= "<![CDATA[" . $row->{$fieldName} . "]]>";
                //"<![CDATA[".$row->$fieldName."]]>";
            } else {
                $s .= $row->{$fieldName};
            }
            $s .= "</cell>";
        }
        $s .= "</row>";
    }
    $s .= "</rows>";
    echo $s;
}
Esempio n. 5
0
function field_cache()
{
    global $iCMS;
    $rs = $iCMS->db->getArray("SELECT * FROM `#iCMS@__field` order by id DESC");
    $_count = count($rs);
    for ($i = 0; $i < $_count; $i++) {
        $rs[$i]['rules'] = unserialize($rs[$i]['rules']);
        if ($rs[$i]['rules']['choices']) {
            $rs[$i]['rules'] = getFieldChoices($rs[$i]['rules']['choices']);
        }
        $rs[$i]['typeText'] = getFieldType($rs[$i]['type']);
        $rs[$i]['validateText'] = getFieldvalidate($rs[$i]['validate']);
        $res[$rs[$i]['field']][$rs[$i]['mid']] = $rs[$i];
        $mres[$rs[$i]['mid']][$rs[$i]['field']] = $rs[$i];
    }
    $iCMS->cache(false, 'include/syscache', 0, true, false);
    $iCMS->addcache('model.field', $mres, 0);
    $iCMS->addcache('field.model', $res, 0);
    $iCMS->addcache('field.cache', $rs, 0);
}
function selectRecordsForJQGrid($db, $modelName, $params, $roles)
{
    $format = "xml";
    if (isset($params["format"])) {
        $format = $params["format"];
    }
    if ($modelName == 'contestant' && $format == 'csv') {
        $modelName = 'contestantCSV';
    }
    $model = getViewModel($modelName);
    $request = array("modelName" => $modelName, "model" => $model, "filters" => array());
    foreach ($model["fields"] as $fieldName => $field) {
        $request["fields"][] = $fieldName;
    }
    if (!$_SESSION["isAdmin"]) {
        if ($modelName == "school") {
            $params["accessUserID"] = $_SESSION["userID"];
        } else {
            if ($modelName === "group") {
                $params["checkAccessUserID"] = $_SESSION["userID"];
                $params["checkSchoolUserID"] = $_SESSION["userID"];
            } else {
                $params["userID"] = $_SESSION["userID"];
            }
        }
    }
    $filters = array();
    foreach ($params as $name => $value) {
        if ((isset($model["filters"][$name]) || isset($model["fields"][$name])) && $value !== "_NOF_") {
            if (isset($model["fields"][$name])) {
                if (getFieldType($model, $name) == "string") {
                    $value = "%" . $value . "%";
                }
            }
            $filters[$name] = $value;
        }
    }
    $request["filters"] = $filters;
    if ($modelName == 'award1' || $modelName == 'award2') {
        $request['filters']['awarded'] = true;
        $request['orders'] = $model['orders'];
    }
    if (isset($params["sidx"]) && $params["sidx"] != "") {
        $order = array("field" => $params["sidx"], "dir" => $params["sord"]);
        $request["orders"] = array($order);
    }
    $request["page"] = $params["page"];
    $request["rowsPerPage"] = $params["rows"];
    if ($format == 'csv' && $modelName !== 'contestantCSV') {
        explicitCSVRequest($request);
    }
    $result = selectRows($db, $request);
    $limits = $result["limits"];
    if ($format === "xml") {
        displayRowsAsXml($result["items"], $model, $limits["page"], $limits["nbPages"], $result["nbTotalItems"]);
    } else {
        displayRowsAsCsv($modelName, $result["items"], $request['model']);
    }
}
Esempio n. 7
0
 for ($j = 0; $j < count($fieldIdxArray); $j++) {
     $fieldNum = (int) $fieldIdxArray[$j];
     //sections
     if ($fieldNum > 9000) {
         if ($fieldNum == 9001) {
             $includesArray['orderBy'] = true;
         } else {
             $includesArray['groups'] = true;
         }
         continue;
     }
     $filterCounter++;
     //number of filter fields
     $field = $xmlFile->table[$i]->field[$fieldNum];
     echo "<br><span class='spacer'></span>'" . $field->caption->__toString() . "' field : ";
     getFieldType($fileContent, $field, $filterIdxArray[$fieldNum], $filterCounter, $xmlFile->table[$i]->name);
     $fileContent .= '
         <!-- ########################################################## -->
         ';
     echo "OK";
 }
 //includes
 includeNeededParts($fileContent, $includesArray);
 //Default filter page requirments
 includeDefaultParts($fileContent, $xmlFile->table[$i]->allowSavingFilters);
 $tableName = $xmlFile->table[$i]->name;
 $fileName = $xmlFile->table[$i]->name . "_filter.php";
 if (file_put_contents("{$path}/hooks/{$fileName}", $fileContent)) {
     echo "<br><span class='spacer'></span><span class='text-success'><b>'{$fileName}' added to the hooks folder Successfully.</b></span><br>\n        <p class='spacer'><span class='glyphicon glyphicon-chevron-right'></span> To install, open the <span class='text-info'>hooks/{$tableName}.php</span> file and add this code (if it's not already there) to the <span class='text-info'>{$tableName}" . "_init()</span> hook before the return statement:\n        <br><code class='text-info'>\$options->FilterPage =\"hooks/{$fileName}\";</code>\n        </p>";
 } else {
     echo "<br><span class='spacer'></span><span class='text-danger'><b>Error: Couldn't save 'hooks/{$fileName}': Check the permissions.</b></span>";