<?php
session_start();

include "../phpconfig/config.php";
include "../phpconfig/valida_login.php";
include "../includes/topo.php"; 

$id = $_GET['id'];

$sql = mysql_query("SELECT * FROM servicos WHERE id='$id'");
$lin = mysql_fetch_assoc($sql);

?>


        <ul class="breadcrumb">
          <li><a href="<?php echo sti('adm');  ?>">Home</a></li>
          <li class="active">Editar Serviços</li>
        </ul>

<form class="form-horizontal" method="post" action="edita.php"    enctype="multipart/form-data">
        <fieldset>
          <?php if (strlen($lin['imagem'])>5): ?>
                      
          <div class="control-group">
            <label class="control-label" for="input01">Imagem</label>
            <div class="controls">
              <img width='300' src='<?php echo sti('down').$lin['imagem'];  ?>'  />
               <a class="btn btn-large" title="Deletar imagem" href="delImagem.php?p=<?php echo $id; ?>"><span class="glyphicon glyphicon-remove"></span></a>

            </div>
          </div>
           <?php endif ?>  

          <div class="control-group">

          <div class="control-group">
            <label class="control-label" >Título</label>
            <div class="controls">
              <input type="hidden"name='id' value='<?php echo $lin['id'];  ?>' >
              <input type="text" class="input-xxlarge" name='titulo' value='<?php echo $lin['titulo'];  ?>' >
            </div>
          </div>



          <div class="control-group">
            <label class="control-label" >Slug</label>
            <div class="controls">
              <input type="text" class="input-xxlarge" name='slug' value='<?php echo $lin['slug'];  ?>' >
            </div>
          </div>

          <div class="control-group">
            <label class="control-label" for="textarea">Conteúdo</label>
            <div class="controls">
              <textarea class="input-xxlarge" id="myArea2" name="conteudo" rows="30"><?php echo $lin['conteudo'];  ?></textarea>
            </div>
          </div>

         
        <div class="control-group">
            <label class="control-label" for="imagem">Imagem</label>
            <div class="controls">
              <input id="imagem" name='imagem' accept="image/*" type="file">
            </div>
          </div>

          <div class="form-actions">
            <button type="submit" class="btn btn-primary">Salvar</button>
            <a class="btn btn-warning pull-right" href="index.php">Voltar</a>
          </div>
        </fieldset>
      </form>
      <script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
    <script type="text/javascript">
      //<![CDATA[
      var area1;

      function toggleArea1() {
      
            area1 = new nicEditor({fullPanel : true}).panelInstance('myArea2',{hasPanel : true});

      }


      bkLib.onDomLoaded(function() { 
      
          new nicEditor({buttonList : ['fontFormat','bold','italic','underline','strikeThrough','subscript','superscript','html','image','link','ul']}).panelInstance('myArea2');
      
      toggleArea1(); });

      //]]>
      </script>

<?php include "../includes/rodape.php"; ?>
