function elimina_immagine()
 {
     $image_name = Params::get("image_name");
     $id_prodotto_servizio = Params::get("id_prodotto_servizio");
     $product_image_dir = new Dir(self::PRODUCT_IMAGE_DIR . "/" . $id_prodotto_servizio);
     $product_image_file = $product_image_dir->newFile($image_name);
     ImagePicker::delete_image_thumbnails($product_image_file);
     //elimino la riga associata all'immagine
     $peer = new ImmagineProdottoServizioPeer();
     $peer->id_prodotto_servizio__EQUALS($id_prodotto_servizio);
     $peer->nome_immagine__EQUALS($image_name);
     $elenco_immagini_prodotto_servizio = $peer->find();
     foreach ($elenco_immagini_prodotto_servizio as $img) {
         $peer->delete($img);
     }
     $product_image_file->delete();
     if ($product_image_dir->isEmpty()) {
         $product_image_dir->delete();
     }
     return Redirect::success();
 }
 function invia_commento()
 {
     try {
         $nome = Params::get("nome");
         $subject = Params::get("subject");
         $email = Params::get("email");
         $testo = Params::get("testo");
         //$codice_hidden = Params::get("codice_hidden");
         //$codice = Params::get("codice");
         //if ($codice_hidden!=$codice)
         //    throw new InvalidParameterException("Il codice non e' impostato correttamente!!");
         if ($nome != null && $subject != null && $email != null && $testo != null && isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) {
             $e = new EMail("no_reply@" . Host::current_no_www(), Config::instance()->EMAIL_COMMENT_RECEIVED, "[Nuova commento da : " . $nome . "] - " . Host::current(), EMail::HTML_FORMAT);
             $e->render_and_send("include/messages/mail/alert/" . Lang::current() . "/nuovo_commento.php.inc", array("nome" => $nome, "email" => $email, "subject" => $subject, "testo" => $testo));
             return Redirect::success();
         } else {
             if (!isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) {
                 throw new InvalidDataException("Il parametri di configurazione EMAIL_COMMENT_RECEIVED non e' impostato correttamente!!");
             } else {
                 throw new InvalidDataException("I dati immessi nella form non sono validi!!");
             }
         }
     } catch (Exception $ex) {
         Flash::error($ex->getMessage());
         return Redirect::failure();
     }
 }
 function delete_rotator_image()
 {
     $rotator_name = Params::get("rotator_name");
     $image = Params::get("image");
     $f = new File(self::ROTATOR_GALLERIES_ROOT_PATH . $rotator_name . DS . $image);
     $f->delete();
     return Redirect::success();
 }
 function send()
 {
     $success_message = Params::get("success_message");
     $em = new EMail(Params::get("email"), Params::get("dest_address"), "Nuovo messaggio ricevuto", EMail::HTML_FORMAT);
     $vars = array("first_name" => Params::get("first_name"), "last_name" => Params::get("last_name"), "message" => Params::get("message"));
     $em->render_and_send("include/mail/message.php.inc", $vars);
     Flash::ok(Params::get($success_message));
     return Redirect::success();
 }
 function modify_image()
 {
     $peer = new GalleryImagePeer();
     $do = $peer->updateByParams();
     $peer->save($do);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Redirect::failure();
     }
 }
 function modify_collection()
 {
     $peer = new GalleryCollectionPeer();
     $do = $peer->updateByParams();
     $peer->save($do);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
Example #7
0
 function formatOutputData($result)
 {
     if (Result::is_result($result)) {
         if (Result::is_ok($result)) {
             $result = Redirect::success();
         } else {
             $result = Redirect::failure();
         }
     }
     if ($result instanceof IActionCommand) {
         return $result->execute();
     }
     echo render_result($result);
 }
 function delete()
 {
     $nome_categoria = Params::get("nome_categoria");
     $nome_modulo = Params::get("nome_modulo");
     if ($nome_categoria !== ModuleUtils::FRAMEWORK_CATEGORY_NAME && $nome_modulo !== ModuleUtils::FRAMEWORK_MODULE_NAME) {
         $path = AvailableModules::get_available_module_path($nome_categoria, $nome_modulo);
         $d = new Dir($path);
         $d->delete(true);
         Flash::ok("Modulo " . $nome_categoria . "/" . $nome_modulo . " eliminato con successo!!");
         return Redirect::success();
     } else {
         Flash::error("Impossibile eliminare il modulo " . $nome_categoria . "/" . $nome_modulo);
         return Redirect::failure();
     }
 }
 function delete()
 {
     $peer = new DocumentiPeer();
     $do = $peer->find_by_id(Params::get("id"));
     $final_path = $do->save_folder . $do->hash_name;
     $f = new File($final_path);
     $f->delete();
     $peer->delete($do);
     if (is_html()) {
         Flash::ok("Documento eliminato con successo.");
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
Example #10
0
 function logout()
 {
     Session::remove("/session");
     return Redirect::success();
 }
Example #11
0
 function import()
 {
     $data = Params::get("import_data");
     $peer = new TestiPeer();
     $import_export = DB::newTableDataImportExport();
     $import_export->import_data($data);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
 function set_current_folder()
 {
     $root_dir = new Dir($this->get_user_root());
     $folder = Params::get("folder");
     if (!$root_dir->isParentOf($folder)) {
         throw new InvalidDataException("La cartella specificata non e' valida!!");
     }
     Session::set(self::SESSION_GALLERY_CURRENT_FOLDER, Params::get("folder"));
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
 function __defaultReturn($success_message, $error_messages)
 {
     if (is_html()) {
         if (!$error_messages) {
             Flash::ok($success_message);
             return Redirect::success();
         } else {
             foreach ($error_messages as $error_msg) {
                 Flash::error($error_msg);
             }
             return Redirect::failure();
         }
     } else {
         if (!$error_messages) {
             return Result::ok();
         } else {
             return Result::error($error_messages);
         }
     }
 }
 function elimina_prodotto_servizio_vetrina()
 {
     $peer = new ProdottoServizioVetrinaPeer();
     $do = $peer->find_by_id(Params::get("id_prodotto_servizio_vetrina"));
     $peer->delete($do);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
 function delete()
 {
     $peer = new FolderPeer();
     $result = $peer->find_by_id(Params::get("id"));
     $path = $result["path"];
     $nome = $result["nome"];
     $full_path = $path . $nome . "/";
     $tipo = $result["tipo"];
     $tipo_tokens = explode("_", $tipo);
     $controller_name = $tipo_tokens[1];
     call($controller_name, "delete_by_path", array("path" => $full_path));
     $peer->delete($result);
     if (is_html()) {
         Flash::ok("Cartella eliminata con successo.");
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
 function delete()
 {
     $peer = new FolderPeer();
     $result = $peer->find_by_id(Params::get("id"));
     self::delete_attributes($result);
     $peer->delete($result);
     if (is_html()) {
         Flash::ok("Cartella eliminata con successo.");
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
 function save_banner()
 {
     $peer = new BannerPeer();
     $banner = $peer->updateByParams();
     call("immagini", "modify", Params::all());
     $peer->save($banner);
     return Redirect::success();
 }