Example #1
0
        $_POST["withtemplate"] = $_GET["withtemplate"];
    }
    // Set default value...
    $values = array('name' => '', 'firstname' => '', 'comment' => '', 'locations_id' => 0, 'users_id' => 0, 'plugin_resources_departments_id' => 0, 'date_begin' => 'NULL', 'date_end' => 'NULL', 'quota' => 1.0, 'plugin_resources_resourcesituations_id' => 0, 'plugin_resources_contractnatures_id' => 0, 'plugin_resources_ranks_id' => 0, 'plugin_resources_resourcespecialities_id' => 0, 'plugin_resources_leavingreasons_id' => 0);
    // Clean text fields
    $values['name'] = stripslashes($values['name']);
    $values['comment'] = Html::cleanPostForTextArea($values['comment']);
    $values['target'] = Toolbox::getItemTypeFormURL('PluginResourcesWizard');
    $values['withtemplate'] = $_POST["withtemplate"];
    $values['new'] = 1;
    $resource->wizardSecondForm($_POST["template"], $values);
} else {
    if (isset($_POST["undo_first_step"])) {
        //if ($resource->getfromDB($_POST["id"]))
        //$resource->deleteByCriteria(array('id' => $_POST["id"]));
        $resource->wizardFirstForm($_SERVER['HTTP_REFERER']);
    } else {
        if (isset($_POST["second_step"]) || isset($_POST["second_step_update"])) {
            $required = $resource->checkRequiredFields($_POST);
            if (count($required) > 0) {
                // Set default value...
                $values = array('name' => $_POST["name"], 'firstname' => $_POST["firstname"], 'comment' => $_POST["comment"], 'locations_id' => $_POST["locations_id"], 'users_id' => $_POST["users_id"], 'plugin_resources_departments_id' => $_POST["plugin_resources_departments_id"], 'date_begin' => $_POST["date_begin"], 'date_end' => $_POST["date_end"], 'quota' => $_POST["quota"], 'plugin_resources_resourcesituations_id' => $_POST["plugin_resources_resourcesituations_id"], 'plugin_resources_contractnatures_id' => $_POST["plugin_resources_contractnatures_id"], 'plugin_resources_ranks_id' => $_POST["plugin_resources_ranks_id"], 'plugin_resources_resourcespecialities_id' => $_POST["plugin_resources_resourcespecialities_id"], 'plugin_resources_leavingreasons_id' => $_POST["plugin_resources_leavingreasons_id"]);
                // Clean text fields
                $values['name'] = stripslashes($values['name']);
                $values['comment'] = Html::cleanPostForTextArea($values['comment']);
                $values['target'] = Toolbox::getItemTypeFormURL('PluginResourcesWizard');
                $values['withtemplate'] = $_POST["withtemplate"];
                if (isset($_POST["second_step"])) {
                    $values['new'] = 1;
                } else {
                    if (isset($_POST["second_step_update"])) {