hasRole(AdminModel::ADMIN_TYPE_BANNER)){ GUIHandler::redirect("admin/listBanner.php"); } MenuGenerator::generateMenu(); HTMLHelper::generateAdminHead(); try{ $error = ""; $bannerId = PostHandler::get("id"); $banner = null; if (!is_null($bannerId) && strcmp("",$bannerId)!=0){ $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId)); } if (is_null($banner)){ GUIHandler::redirect("admin/listBanner.php"); } if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "save")==0){ $banner->customer = PostHandler::get("customer"); $banner->link = PostHandler::get("link"); $banner->start = new Mongodate(strtotime(PostHandler::get("dateStart"))); $banner->end = new Mongodate(strtotime(PostHandler::get("dateEnd"))); if (strcmp("",PostHandler::get("position"))==0){ throw new GUIException("Selezionare una posizione per il banner"); } $banner->position = PostHandler::get("position"); GlobalVariables::get("dao")->save($banner); GUIHandler::redirectPost("admin/homeBanner.php",array("id"=>$banner->id)); } }catch(GUIException $ex){ $error = $ex->getMessage(); }catch (Exception $exec){ $msg = LogModel::fromException($exec); GlobalVariables::get("dao")->save($msg); $error = "Si รจ verificato un errore inatteso durante l'esecuzione della pagina. Contattare il supporto tecnico comunicando il seguente codice di erore '".$msg->getCode()."'"; } ?>