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); } } } }
/** * Sets a field from the object by name passed in as a string. * * @param string $name peer name * @param mixed $value field value * @param string $type The type of fieldname the $name is of: * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM * @return void */ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = DocumentoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); }