Example #1
0
     Html::back();
 } else {
     if (isset($_POST["purge"])) {
         if (isset($_POST['id'])) {
             $item->check($_POST['id'], PURGE);
             if ($item->delete($_POST, 1)) {
                 Event::log($_POST["id"], "slas", 4, "setup", sprintf(__('%s purges a sla level'), $_SESSION["glpiname"]));
             }
             $item->redirectToList();
         }
         Html::back();
     } else {
         if (isset($_POST["add_action"])) {
             $item->check($_POST['slalevels_id'], UPDATE);
             $action = new SlaLevelAction();
             $action->add($_POST);
             Html::back();
         } else {
             if (isset($_POST["add_criteria"])) {
                 $item->check($_POST['slalevels_id'], UPDATE);
                 $criteria = new SlaLevelCriteria();
                 $criteria->add($_POST);
                 Html::back();
             } else {
                 if (isset($_GET["id"]) && $_GET["id"] > 0) {
                     //print computer information
                     Html::header(SlaLevel::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "config", "sla", "slalevel");
                     //show computer form to add
                     $item->display(array('id' => $_GET["id"]));
                     Html::footer();
                 }
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

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';
$criteria = new SlaLevelAction();
if (isset($_POST["add"])) {
    $criteria->check(-1, CREATE, $_POST);
    $criteria->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $criteria->check($_POST['id'], UPDATE);
        $criteria->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["purge"])) {
            $criteria->check($_POST['id'], PURGE);
            $criteria->delete($_POST, 1);
            Html::back();
        }
    }
}