private static function showEditPhotoReportageForm($post, $error, $new = false) { $name = "Edit"; $caption = "Modifica"; if ($new) { $post = new Post($post); $name = "New"; $caption = "Nuovo"; } ?> <div class="title"><?php echo $caption; ?> Photoreportage</div> <?php if (is_array($error)) { ?> <div class="error"><?php foreach ($error as $err) { ?> <p><?php echo $err; ?> </p> <?php } ?> </div> <?php } if (!isset($_GET["phase"]) || count($error) != 0) { ?> <form name="<?php echo $name; ?> Post" action="?type=photoreportage&phase=2" method="post" enctype="multipart/form-data"> <!--<p class="post_headline"><label>Occhiello:</label><br /> <input class="post_headline" name="headline" value="<?php echo Filter::decodeFilteredText($post->getHeadline()); ?> "/></p>--> <p class="title"><label>Titolo:</label><br/> <input class="post_title" name="title" value="<?php echo Filter::decodeFilteredText($post->getTitle()); ?> "/></p> <p class="post_subtitle"><label>Sottotilolo:</label><br /> <input class="post_subtitle" name="subtitle" value="<?php echo Filter::decodeFilteredText($post->getSubtitle()); ?> "/></p> <p class="content"> <label>Contenuto:</label><br/> <fieldset><legend>upload immagini</legend> <?php for ($i = 0; $i < 10; $i++) { echo "<input type=\"file\"name=\"upfile{$i}\"></br>"; } ?> </fieldset> </p> <p class="tags"><label>Tags:</label> <input class="tags" id="post_tags_input" name="tags" value="<?php echo Filter::decodeFilteredText($post->getTags()); ?> "/></p> <p class="categories"><label>Categorie:</label><br/><?php $cat = array(); if (trim($post->getCategories()) != "") { $cat = explode(", ", Filter::decodeFilteredText($post->getCategories())); } self::showCategoryTree($cat); ?> </p> <p class="<?php echo trim($post->getPlace()) == "" ? "hidden" : ""; ?> "><label id="place_label">Posizione: <?php echo $post->getPlace(); ?> </label></p> <input id="post_place" name="place" type="hidden" value="<?php echo $post->getPlace(); ?> " /> <input name="visible" type="hidden" value="true" /> <input name="type" type="hidden" value="photoreportage" /> <p class="submit"><input type="submit" value="Prosegui" /> <input type="button" onclick="javascript:save();" value="Salva come bozza"/></p> <script type="text/javascript"> function save() { document.<?php echo $name; ?> Post.visible.value = "no"; document.<?php echo $name; ?> Post.submit(); } </script> <?php require_once 'manager/MapManager.php'; MapManager::setCenterToMap($post->getPlace(), "map_canvas"); ?> </form> <?php } else { if (count($error) == 0) { ?> <fieldset><legend>Inserisci le descrizioni alle tue foto! </legend> <form name="<?php echo $name; ?> Post" action="?type=photoreportage&phase=3" method="post" enctype="multipart/form-data"> <?php for ($i = 0; $i < count($post->getContent()); $i++) { $rs_array = $post->getContent(); $resource = ResourceManager::loadResource($rs_array[$i]); $path = FileManager::appendToRootPath($resource->getPath()); $index = $resource->getID(); ?> <img src="<?php echo $path; ?> " width="200" height="100"/> <textarea name="<?php echo $index; ?> " rows="5" cols="40"></textarea> <!--textarea name is the ID of the corresponding resource--> <input type="hidden" name="<?php echo 'resourceID' . $i; ?> " value="<?php echo $index; ?> "> <?php } ?> <input type="hidden" name="numResources" value="<?php echo count($post->getContent()); ?> "/> <input type="submit" value="Prosegui" /> </form> </fieldset> <?php } } }