Exemple #1
0
?>
      <?php 
if ($form['doc']->getValue()) {
    ?>
        <p><?php 
    echo __('Documento');
    ?>
: <a class="document"  href="<?php 
    echo S3Voota::getImagesUrl() . '/docs/' . $form['doc']->getValue();
    ?>
"><?php 
    echo $form['doc']->getValue();
    ?>
</a> (<?php 
    $s = new S3Voota();
    echo ByteSize($s->getSize('docs/' . $form['doc']->getValue()));
    ?>
)</p><?php 
    // TODO: Sustituir por enlace a fichero y tamaño de fichero correcto
    ?>
      <?php 
}
?>
    </div>
    
    <div id="sidebar">
      <div id="external-links">
      	<?php 
if ($form['enlace_n1']['url']->getValue() || $form['enlace_n2']['url']->getValue() || $form['enlace_n3']['url']->getValue() || $form['enlace_n4']['url']->getValue() || $form['enlace_n5']['url']->getValue()) {
    ?>
          <h3><?php 
Exemple #2
0
 public function executeNew(sfWebRequest $request)
 {
     $this->redirectUnless($this->getUser()->isAuthenticated(), "@sf_guard_signin");
     $op = $request->getParameter("op", "n");
     $this->title = sfContext::getInstance()->getI18N()->__('Añadir una nueva propuesta - Voota ', array());
     $this->response->setTitle($this->title);
     if ($op == 'c') {
         $this->form = new PreviewPropuestaForm();
     } else {
         $this->form = new NuevaPropuestaForm();
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('propuesta'), $request->getFiles('propuesta'));
         if ($this->form->isValid()) {
             if ($op == 'r') {
                 $imagen = $this->form->getValue('imagen');
                 if ($imagen) {
                     $arr = array_reverse(explode(".", $imagen->getOriginalName()));
                     $ext = strtolower($arr[0]);
                     if (!$ext || $ext == "") {
                         $ext = "png";
                     }
                     $imageName = SfVoUtil::fixVanityChars($arr[1]);
                     $imageName .= "-" . sprintf("%04d", rand(0, 999));
                     $imageName .= ".{$ext}";
                     $imagen->save(sfConfig::get('sf_upload_dir') . '/propuestas/' . $imageName);
                     $this->form->getObject()->setImagen($imageName);
                 }
                 $doc = $this->form->getValue('doc');
                 if ($doc) {
                     $arr = array_reverse(explode(".", $doc->getOriginalName()));
                     $ext = strtolower($arr[0]);
                     if (!$ext || $ext == "") {
                         $ext = "png";
                     }
                     $docName = SfVoUtil::fixVanityChars($arr[1]);
                     $docName .= "-" . sprintf("%04d", rand(0, 999));
                     $docName .= ".{$ext}";
                     $doc->save(sfConfig::get('sf_upload_dir') . '/docs/' . $docName);
                     $this->form->getObject()->setDoc($docName);
                 }
                 $this->form = new PreviewPropuestaForm();
                 $this->form->bind($request->getParameter('propuesta'), array(), isset($imageName) ? $imageName : false, isset($docName) ? $docName : false);
                 return 'Preview';
             } elseif ($op == 'c') {
                 $this->form->save();
                 $this->propuesta = $this->form->getObject();
                 if ($this->propuesta->getDoc()) {
                     $s = new S3Voota();
                     $this->propuesta->setDocSize($s->getSize('docs/' . $this->propuesta->getDoc()));
                     $this->propuesta->save();
                 }
                 $this->redirect("propuesta/show?id=" . $this->propuesta->getVanity());
             }
         }
     }
 }