public function edit($id)
 {
     if (!$id) {
         header("Location: /task");
     } else {
         if (user::accessLevel($_COOKIE['id']) == 1) {
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 task::UPDATE($id, $_POST['name'], $_POST['description'], $_POST['deadlineDate'], $_POST['giver_userID'], $_POST['doer_userID'], $_POST['priorityID'], $_POST['statusID'], $_POST['siteID']);
                 if ($_GET['return-url']) {
                     $redirect = "Location: " . $_GET['return-url'];
                     header($redirect);
                 }
             }
             taskController::loadView('edit', $args = array('id' => $id));
         } else {
             //alert("YOU HAVE NO ACCESS");
             header("Location: /task/view/{$id}");
         }
     }
 }
Esempio n. 2
0
<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    task::UPDATE($url[2], $_POST['date'], $_POST['name'], $_POST['descr']);
}
$current = task::GET($url[2]);
//Kint::dump($current);
echo "<a href='/Calenda/?link=task/view/{$url['2']}'>View</a>";
?>
<form method="post">
    date: <input id="datetimepicker" type="text" name="date">
	<script type="text/javascript">jQuery('#datetimepicker').datetimepicker({
		value:'<?php 
$current->date;
?>
',
		step:30,
        inline: true,
		format:'Y-m-d H:i:s'
	});</script>
    
    name: <input type="text" name="name" value="<?php 
echo $current->name;
?>
">
    
    descr: <input type="text" name="descr" value="<?php 
echo $current->descr;
?>
">