New Task

To Do

hkhkändern22.09.2018 15:48

Done

<?php
$SET_VERBOSE 
0;
include_once(
'../../../quibui/quibui_1.4.php');

$data_id QB_HTTPVARS2ARRAY('id') ? QB_HTTPVARS2ARRAY('id') : '-1';
if (
$data_id) {
    
$qb_formcontent QB_TABLE2ARRAY('qb_tasks', array('id'=>$data_id), '1');
} else {
    
$qb_formcontent QB_HTTPVARS2ARRAY();
}

    
// erstellt/ändert datensätze
    
$meldungen QB_FORM2TABLE(
        
'qb_tasks'
        
,array('id'=>$qb_formcontent['id'])
        ,array(
'done')
        ,array(
'title'=>QB_HTTPVARS2ARRAY('title'),
               
'done'=>QB_HTTPVARS2ARRAY('done'),
               
'created'=>QB_TIMEDATE2DATETIME('NOW')
        )
        ,array(
'save'=>QB_HTTPVARS2ARRAY('Speichern'),
               
'delete'=>QB_HTTPVARS2ARRAY('Delete')
        )
        ,array(
'title'=>array(_QB_CHECK_PATTERN_EMPTY=>'Bitte Aufgabe eingeben!')
        )
        ,array(
'change'=>'tasks2.php'
              
,'delete'=>'tasks2.php'
        
)
    );

    
// erstellt/ändert datensätze
    
$meldungen2 QB_FORM2TABLE(
        
'qb_tasks'
        
,array('id'=>$qb_formcontent['id'])
        ,array(
'done')
        ,array(
'done'=>QB_HTTPVARS2ARRAY('done'),
               
'modified'=>QB_TIMEDATE2DATETIME('NOW')
        )
        ,array(
'save'=>QB_HTTPVARS2ARRAY('MarkDone'))
        ,array()
        ,array(
'change'=>'tasks2.php')
        );
?>
<html>
<head></head>
<body>
<center>
<h3>New Task</h3>
<?php
    
if ($meldungen) {
       foreach (
$meldungen as $meldung) {
        echo 
$meldung "<br>";
      }
    }
?>
<form method="POST" action="tasks2.php">
<input type="text" name="title" id="title" value="<?php echo QB_SECUREPRINT($qb_formcontent['title']); ?>">
<input type="hidden" name="id" value="<?php echo QB_SECUREPRINT($qb_formcontent['id']); ?>">
<input type="submit" name="Speichern" value="Aufgabe hinzufügen">
</form>

<h3>To Do</h3>
<table cellpadding="4" border="1">
<?php
    
foreach (QB_TABLE2ARRAY('qb_tasks'"done != 1 ORDER BY created") as $task) {
        echo 
"<tr><td><input type=\"checkbox\" onclick=\"document.location.href='?id=" $task['id'] .
             
"&MarkDone=true&done=1'\"></td><td>" .  QB_SECUREPRINT($task['title']) . "</td><td>" .
             
"<a href=\"javascript:void(0)\" onClick=\"document.location.href='?id=" .
             
$task['id'] . "'\">ändern</a></td><td>" .
             
QB_DATETIME2ARRAY($task['created'], 'DD.MM.YYYY hh:mm') . "</td></tr>";
    }
?>
</table>
<br>
<h3>Done</h3>
<table cellpadding="4" border="1">
<?php
    
foreach (QB_TABLE2ARRAY('qb_tasks'"done = 1 ORDER BY modified") as $task) {
        echo 
"<tr><td>" QB_SECUREPRINT($task['title']) .
             
"</td><td><a href=\"javascript:void(0)\" onClick=\"document.location.href='?id=" .
             
$task['id'] . "&Delete=true'\">löschen</a></td><td>" .
             
QB_DATETIME2ARRAY($task['modified'], 'DD.MM.YYYY hh:mm') . "</td></tr>";
    }
?>
</table>
</center>
<?php
    show_source
("tasks2.php");
?>
</body>
</html>