Example #1
0
            $searchForbiddenChar = array("%", '_', '[', ']', '^', '!', '<', '>', '¡', '=', '|', '?', '¿', 'ñ', '@', '#');
            $query = trim(str_replace($searchForbiddenChar, "", $_POST['url']));
            $items['url'] = $query;
            $items['slug'] = $project->cleanString($items['name'][1]);
        }
        $items['user'] = $_user->id;
        $items['type'] = "basic";
        $items['added'] = time();
        $items['started'] = date('Y-m-d H:i:s', time());
        $items['active'] = 1;
        $items['cancelled'] = 0;
    } else {
        $error = true;
    }
    if (!$error) {
        $project->setItem($items);
        if ($project->save()) {
            $this->addTwigVars("validation_ok", true);
        } else {
            $this->addTwigVars("validation_ok", false);
        }
    } else {
        $this->addTwigVars("validation_ok", false);
    }
}
//Load projects
$obj_p = new Project();
// Today projects
$today = date('Y-m-d', time());
$todayProjects = $obj_p->getLastProjects($today);
$this->addTwigVars('todayProjects', $todayProjects);