示例#1
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Item is new, it will return
  * an empty collection; or if this Item has previously
  * been saved, it will retrieve related Documentos 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 Item.
  */
 public function getDocumentosJoinEmpresa($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(ItemPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collDocumentos === null) {
         if ($this->isNew()) {
             $this->collDocumentos = array();
         } else {
             $criteria->add(DocumentoPeer::ID_ITEM, $this->id_item);
             $this->collDocumentos = DocumentoPeer::doSelectJoinEmpresa($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(DocumentoPeer::ID_ITEM, $this->id_item);
         if (!isset($this->lastDocumentoCriteria) || !$this->lastDocumentoCriteria->equals($criteria)) {
             $this->collDocumentos = DocumentoPeer::doSelectJoinEmpresa($criteria, $con, $join_behavior);
         }
     }
     $this->lastDocumentoCriteria = $criteria;
     return $this->collDocumentos;
 }
 protected function addSortCriteria($c)
 {
     if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/documento/sort')) {
         if ($sort_column == 'tipo') {
             if ($this->getUser()->getAttribute('type', null, 'sf_admin/documento/sort') == 'asc') {
                 $c->addAscendingOrderByColumn(DocumentoPeer::ID_REUNION);
                 $c->addDescendingOrderByColumn(DocumentoPeer::ID_ENTREGABLE);
             } else {
                 $c->addAscendingOrderByColumn(DocumentoPeer::ID_ENTREGABLE);
                 $c->addDescendingOrderByColumn(DocumentoPeer::ID_REUNION);
             }
         } elseif ($sort_column == 'ntipo') {
             if ($this->getUser()->getAttribute('type', null, 'sf_admin/documento/sort') == 'asc') {
                 $c->addJoin(DocumentoPeer::ID_ENTREGABLE, EntregablePeer::ID_ENTREGABLE, Criteria::LEFT_JOIN);
                 $c->addAscendingOrderByColumn(EntregablePeer::NOMBRE);
                 $c->addJoin(DocumentoPeer::ID_REUNION, ReunionPeer::ID_REUNION, Criteria::LEFT_JOIN);
                 $c->addDescendingOrderByColumn(ReunionPeer::NOMBRE);
             } else {
                 $c->addJoin(DocumentoPeer::ID_REUNION, ReunionPeer::ID_REUNION, Criteria::LEFT_JOIN);
                 $c->addAscendingOrderByColumn(ReunionPeer::NOMBRE);
                 $c->addJoin(DocumentoPeer::ID_ENTREGABLE, EntregablePeer::ID_ENTREGABLE, Criteria::LEFT_JOIN);
                 $c->addDescendingOrderByColumn(EntregablePeer::NOMBRE);
             }
         } elseif ($sort_column == 'categoria') {
             if ($this->getUser()->getAttribute('type', null, 'sf_admin/documento/sort') == 'asc') {
                 $c->addJoin(DocumentoPeer::ID_CATEGORIA, ParametroPeer::ID_PARAMETRO, Criteria::LEFT_JOIN);
                 $c->addAscendingOrderByColumn(ParametroPeer::NOMBRE);
             } else {
                 $c->addJoin(DocumentoPeer::ID_CATEGORIA, ParametroPeer::ID_PARAMETRO, Criteria::LEFT_JOIN);
                 $c->addDescendingOrderByColumn(ParametroPeer::NOMBRE);
             }
         } else {
             $sort_column = DocumentoPeer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
             if ($this->getUser()->getAttribute('type', null, 'sf_admin/documento/sort') == 'asc') {
                 $c->addAscendingOrderByColumn($sort_column);
             } else {
                 $c->addDescendingOrderByColumn($sort_column);
             }
         }
     }
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(DocumentoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(DocumentoPeer::DATABASE_NAME);
         $criteria->add(DocumentoPeer::ID_DOCUMENTO, $pks, Criteria::IN);
         $objs = DocumentoPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Selects a collection of HistoricoDocumento objects pre-filled with all related objects except Usuario.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of HistoricoDocumento objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUsuario(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     HistoricoDocumentoPeer::addSelectColumns($c);
     $startcol2 = HistoricoDocumentoPeer::NUM_COLUMNS - HistoricoDocumentoPeer::NUM_LAZY_LOAD_COLUMNS;
     EmpresaPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (EmpresaPeer::NUM_COLUMNS - EmpresaPeer::NUM_LAZY_LOAD_COLUMNS);
     DocumentoPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (DocumentoPeer::NUM_COLUMNS - DocumentoPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(HistoricoDocumentoPeer::ID_EMPRESA), array(EmpresaPeer::ID_EMPRESA), $join_behavior);
     $c->addJoin(array(HistoricoDocumentoPeer::ID_DOCUMENTO), array(DocumentoPeer::ID_DOCUMENTO), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = HistoricoDocumentoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = HistoricoDocumentoPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = HistoricoDocumentoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             HistoricoDocumentoPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Empresa rows
         $key2 = EmpresaPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = EmpresaPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = EmpresaPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 EmpresaPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (HistoricoDocumento) to the collection in $obj2 (Empresa)
             $obj2->addHistoricoDocumento($obj1);
         }
         // if joined row is not null
         // Add objects for joined Documento rows
         $key3 = DocumentoPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = DocumentoPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = DocumentoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 DocumentoPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (HistoricoDocumento) to the collection in $obj3 (Documento)
             $obj3->addHistoricoDocumento($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 protected function getDocumentoOr404($iddocumento = 'id_documento')
 {
     if (!$this->getRequestParameter($iddocumento)) {
         $this->forward404();
     } else {
         $documento = DocumentoPeer::retrieveByPk($this->getRequestParameter($iddocumento));
         $this->forward404Unless($documento);
     }
     return $documento;
 }
 /**
  * Get the associated Documento object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Documento The associated Documento object.
  * @throws     PropelException
  */
 public function getDocumento(PropelPDO $con = null)
 {
     if ($this->aDocumento === null && $this->id_documento !== null) {
         $c = new Criteria(DocumentoPeer::DATABASE_NAME);
         $c->add(DocumentoPeer::ID_DOCUMENTO, $this->id_documento);
         $this->aDocumento = DocumentoPeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aDocumento->addHistoricoDocumentos($this);
         		 */
     }
     return $this->aDocumento;
 }
示例#7
0
  <?php 
echo form_tag('historico_documentos/list', array('method' => 'get'));
?>
  <fieldset>
    <h2><?php 
echo __('Filtros');
?>
</h2>
    <div class="form-row">
      <label for="filters_id_documento"><?php 
echo __('Documento:');
?>
</label>
      <div class="content"><?php 
/*Ana: 04-11-09. El listado de documentos debe estar filtrado por el trabajador actual*/
$lista_documentos = DocumentoPeer::getAllDocumentosByTrabajadorActual();
$value = select_tag('filters[id_documento]', objects_for_select($lista_documentos, 'getPrimaryKey', '__toString', isset($filters['id_documento']) ? $filters['id_documento'] : null, array('include_blank' => true)));
echo $value ? $value : '&nbsp';
?>
  
      </div>
    </div>

    <div class="form-row">
      <label for="fecha"><?php 
echo __('Fecha Subida:');
?>
</label>
      <div class="content">
        <?php 
echo input_date_range_tag('filters[fecha]', isset($filters['fecha']) ? $filters['fecha'] : null, array('rich' => true, 'calendar_button_img' => '/sf/sf_admin/images/date.png'));
 /**
  * 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 = DocumentoPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdDocumento($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdEmpresa($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setNombre($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setIdItem($arr[$keys[3]]);
     }
 }