Exemplo n.º 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
*/
include '../inc/includes.php';
if (empty($_GET["id"])) {
    $_GET["id"] = '';
}
Session::checkLoginUser();
$problem = new Problem();
if (isset($_POST["add"])) {
    $problem->check(-1, 'w', $_POST);
    $newID = $problem->add($_POST);
    Event::log($newID, "problem", 4, "maintain", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $problem->check($_POST["id"], 'd');
        $problem->delete($_POST);
        Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $problem->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $problem->check($_POST["id"], 'd');
            $problem->restore($_POST);
            Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $problem->redirectToList();
Exemplo n.º 2
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
*/
include '../inc/includes.php';
if (empty($_GET["id"])) {
    $_GET["id"] = '';
}
Session::checkLoginUser();
$problem = new Problem();
if (isset($_POST["add"])) {
    $problem->check(-1, CREATE, $_POST);
    if ($newID = $problem->add($_POST)) {
        Event::log($newID, "problem", 4, "maintain", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($problem->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $problem->check($_POST["id"], DELETE);
        $problem->delete($_POST);
        Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $problem->redirectToList();
    } else {
        if (isset($_POST["restore"])) {