Ejemplo n.º 1
0
<?php

include '_header.php';
$update = getUpdate($_GET['file']);
$teaserblocks = $update['page']->keyExists('teaserblocks') ? $update['page']->fetch('teaserblocks') : null;
if ($_POST) {
    $file = buildFile();
    $newFileName = getFileName($_POST['date'], $_POST['title']);
    // delete current Markdown file
    unlink($updates_dir . $_GET['file']);
    // write new Markdown file
    file_put_contents($updates_dir . $newFileName, $file);
    chmod($updates_dir . $newFileName, 0777);
    //echo "<textarea style='width: 100%; height: 500px;'>";
    //echo $file;
    //echo "</textarea>";
    echo "<script>location.href = location.pathname + '?file=" . $newFileName . "';</script>";
}
?>

<form action="" method="post">
	<fieldset>
		<legend>Metadata</legend>
		<div>
			<label for="published">Published</label>
			<div>
				<input type="radio" name="published" value="true" <?php 
if ($update['page']->fetch('published')) {
    echo "checked";
}
?>
Ejemplo n.º 2
0
/**
 * 
 * @param unknown $tableName
 */
function getAllColumns($tableName)
{
    $pdo = DbUtil::connect();
    $sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'numeracy' AND TABLE_NAME = '" . $tableName . "'";
    //$sql ="DESCRIBE   numeracy.m01_user";
    $values = $pdo->query($sql);
    $count = 1;
    $result = "";
    $colnameArray = array();
    if (is_array($values) || is_object($values)) {
        foreach ($values as $row) {
            $colnameArray[] = $row['COLUMN_NAME'];
        }
    }
    $tableName = strtoupper($tableName);
    $idField = findIdField($tableName, $colnameArray);
    print '<br/>';
    print 'private static $insertSQL = "INSERT INTO ' . $tableName . ' (' . getInsert1($tableName, $colnameArray) . ')  VALUES (' . getInsert2($tableName, $colnameArray) . ')";</br>';
    print '<br/>';
    if ($idField != '') {
        print 'private static $selectSQL = "SELECT ' . getSelect($colnameArray) . ' FROM ' . $tableName . ' ORDER BY ' . $idField . ' DESC "; </br>';
    } else {
        print 'private static $selectSQL = "SELECT ' . getSelect($colnameArray) . ' FROM ' . $tableName . ' "; </br>';
    }
    print '<br/>';
    if ($idField != '') {
        print 'private static $updateSQL = "UPDATE ' . $tableName . ' SET ' . getUpdate($tableName, $colnameArray) . ' WHERE ' . $idField . ' = ? ";</br>';
    } else {
        //('private static $updateSQL = "UPDATE '.$tableName.' SET '.getUpdate($tableName, $colnameArray).' ";</br>');
        print 'private static $updateSQL = "UPDATE ' . $tableName . ' SET ' . getUpdate($tableName, $colnameArray) . ' WHERE CONDITIONFIELD = ? ";</br>';
    }
    print '<br/>';
    print 'private static $deleteSQL = "DELETE FROM ' . $tableName . ' WHERE ' . $idField . ' = ? ";</br>';
    print '<br/>';
    print 'private static $selectByIdSQL = "SELECT * FROM ' . $tableName . ' WHERE ' . $idField . ' = ? ";</br>';
    printCreateFunction($tableName, $colnameArray);
    printGetAllFunction($tableName, $colnameArray);
    printUpdateFunction($tableName, $colnameArray);
    printDeleteFunction($tableName, $colnameArray);
    printGetByIdFunction($tableName, $colnameArray, $idField);
    DbUtil::disconnect();
    //return $$colnameArray;
}