Example #1
0
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.85
*/
include '../inc/includes.php';
if (empty($_GET["id"])) {
    $_GET["id"] = '';
}
Session::checkLoginUser();
$project = new Project();
if (isset($_POST["add"])) {
    $project->check(-1, CREATE, $_POST);
    $newID = $project->add($_POST);
    Event::log($newID, "project", 4, "maintain", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    if ($_SESSION['glpibackcreated']) {
        Html::redirect($project->getFormURL() . "?id=" . $newID);
    } else {
        Html::back();
    }
} else {
    if (isset($_POST["delete"])) {
        $project->check($_POST["id"], DELETE);
        $project->delete($_POST);
        Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $project->redirectToList();
    } else {
        if (isset($_POST["restore"])) {