Exemplo n.º 1
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Usuario is new, it will return
  * an empty collection; or if this Usuario has previously
  * been saved, it will retrieve related HistoricoDocumentos from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Usuario.
  */
 public function getHistoricoDocumentosJoinDocumento($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(UsuarioPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collHistoricoDocumentos === null) {
         if ($this->isNew()) {
             $this->collHistoricoDocumentos = array();
         } else {
             $criteria->add(HistoricoDocumentoPeer::ID_USUARIO, $this->id_usuario);
             $this->collHistoricoDocumentos = HistoricoDocumentoPeer::doSelectJoinDocumento($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(HistoricoDocumentoPeer::ID_USUARIO, $this->id_usuario);
         if (!isset($this->lastHistoricoDocumentoCriteria) || !$this->lastHistoricoDocumentoCriteria->equals($criteria)) {
             $this->collHistoricoDocumentos = HistoricoDocumentoPeer::doSelectJoinDocumento($criteria, $con, $join_behavior);
         }
     }
     $this->lastHistoricoDocumentoCriteria = $criteria;
     return $this->collHistoricoDocumentos;
 }
Exemplo n.º 2
0
 protected function renombrarDocumento($historico, $id_proyecto = 0, $id_fase = 0)
 {
     //inicialmente se guarda con el nombre real. Despues hay que cambiarselo
     // añadiendo el id_proyecyo y la version.
     $directorio = HistoricoDocumentoPeer::getUploadsDirectory($id_proyecto, $id_fase);
     $nombre_anterior = $directorio;
     $nombre_anterior .= $historico->getNombreFich();
     $nombre_nuevo = $directorio;
     $nombre_base_nuevo = HistoricoDocumentoPeer::getNombreArchivo($this->documento->getIdDocumento(), $historico->getVersion(), $historico->getNombreFich());
     @rename($nombre_anterior, $nombre_nuevo . $nombre_base_nuevo);
     @chmod($nombre_nuevo . $nombre_base_nuevo, 0777);
     return $nombre_base_nuevo;
 }
 /**
 * Retrieve object using using composite pkey values.
 * @param      int $id_documento
   @param      string $version
   
 * @param      PropelPDO $con
 * @return     HistoricoDocumento
 */
 public static function retrieveByPK($id_documento, $version, PropelPDO $con = null)
 {
     $key = serialize(array((string) $id_documento, (string) $version));
     if (null !== ($obj = HistoricoDocumentoPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(HistoricoDocumentoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(HistoricoDocumentoPeer::DATABASE_NAME);
     $criteria->add(HistoricoDocumentoPeer::ID_DOCUMENTO, $id_documento);
     $criteria->add(HistoricoDocumentoPeer::VERSION, $version);
     $v = HistoricoDocumentoPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Exemplo n.º 4
0
 protected function addSortCriteria($c)
 {
     if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/historico_documento/sort')) {
         if ($sort_column == 'usuario') {
             $c->addJoin(HistoricoDocumentoPeer::ID_USUARIO, UsuarioPeer::ID_USUARIO, Criteria::LEFT_JOIN);
             if ($this->getUser()->getAttribute('type', null, 'sf_admin/historico_documento/sort') == 'asc') {
                 $c->addAscendingOrderByColumn(UsuarioPeer::NOMBRE);
             } else {
                 $c->addDescendingOrderByColumn(UsuarioPeer::NOMBRE);
             }
         } else {
             $sort_column = HistoricoDocumentoPeer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
             if ($this->getUser()->getAttribute('type', null, 'sf_admin/historico_documento/sort') == 'asc') {
                 $c->addAscendingOrderByColumn($sort_column);
             } else {
                 $c->addDescendingOrderByColumn($sort_column);
             }
         }
     }
 }
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = HistoricoDocumentoPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdDocumento($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setVersion($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setIdEmpresa($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setIdUsuario($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setNombreFich($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setTamano($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setFecha($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setMime($arr[$keys[7]]);
     }
 }
<td align="right">
<ul class="sf_admin_td_actions">
  <?php 
$ultima_version = HistoricoDocumentoPeer::getUltimaVersionReal($documento->getPrimaryKey());
?>
  <?php 
if ($ultima_version != 0) {
    ?>
    <li><?php 
    echo link_to(image_tag('/images/icons/bullet_down.png', array('alt' => __('Descargar'), 'title' => __('Descargar'))), 'historico_documentos/descargar?id_documento=' . $documento->getPrimaryKey() . '&version=' . $ultima_version);
    ?>
</li>
  <?php 
}
?>
 
  <li><?php 
echo link_to(image_tag('/images/icons/filter.png', array('alt' => __('ver'), 'title' => __('ver'))), 'documentos/show?id_documento=' . $documento->getPrimaryKey());
?>
</li>
  <li><?php 
echo link_to(image_tag('/images/icons/edit_icon.png', array('alt' => __('editar'), 'title' => __('editar'))), 'documentos/edit?id_documento=' . $documento->getPrimaryKey());
?>
</li>
  <li><?php 
echo link_to(image_tag('/images/icons/delete_icon.png', array('alt' => __('borrar'), 'title' => __('borrar'))), 'documentos/delete?id_documento=' . $documento->getPrimaryKey(), array('post' => true, 'confirm' => __('¿Estás seguro?')));
?>
</li>
</ul>
</td>