<?php
include("../public/impOpreation.php");

$do = $_GET['do'];

if (empty($do)) {  
    $usergroup = R::getAll('SELECT usergroup.* FROM `usergroup` WHERE conditions = 0 ');
    $smarty->assign('usergroups', $usergroup);
    $today = date("Y-m-d H:i:s");
    $date = date('Y-m-d');
    $userid = $_SESSION['userid'];
    $id = filter_input(INPUT_POST, 'id');
    $taskssettings = R::load('taskssettings',1);
    $taskssettings->userid = $userid; 
    $taskssettings->today = date("Y-m-d H:i:s");
    if($id){
    $taskssettings->usergroupadd = empty($_POST['usergroupadd']) ? $taskssettings->usergroupadd : 
    implode(',', $_POST['usergroupadd']);
    $taskssettings->usergroupshow = empty($_POST['usergroupshow']) ? $taskssettings->usergroupshow : 
    implode(',', $_POST['usergroupshow']);
    $taskssettings->usergroupupdate = empty($_POST['usergroupupdate']) ? $taskssettings->usergroupupdate : 
    implode(',', $_POST['usergroupupdate']);
    $taskssettings->usergroupdel = empty($_POST['usergroupdel']) ? $taskssettings->usergroupdel : 
    implode(',', $_POST['usergroupdel']);
    }
    R::store($taskssettings);
    $smarty->assign("taskssettings",$taskssettings);
    $smarty->display("header.html");
    $smarty->display("taskssettingsview/edit.html");
    $smarty->display("footer.html");
}


?>