function run_alba_list_users($task, $args) { // define constants define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', 'principal'); define('SF_ENVIRONMENT', 'prod'); define('SF_DEBUG', true); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; $databaseManager = new sfDatabaseManager(); $databaseManager->initialize(); $users = UsuarioPeer::doSelect(new Criteria()); foreach ($users as $user) { pake_echo_action($user->getId(), $user->getUsuario() . " [" . $user->getEmail() . "]"); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @return Usuario[] * @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(UsuarioPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(UsuarioPeer::DATABASE_NAME); $criteria->add(UsuarioPeer::ID, $pks, Criteria::IN); $objs = UsuarioPeer::doSelect($criteria, $con); } return $objs; }
/** * Gets an array of Usuario objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Catalogue has previously been saved, it will retrieve * related Usuarios from storage. If this Catalogue is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Usuario[] * @throws PropelException */ public function getUsuarios($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(CataloguePeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collUsuarios === null) { if ($this->isNew()) { $this->collUsuarios = array(); } else { $criteria->add(UsuarioPeer::ID_IDIOMA, $this->cat_id); UsuarioPeer::addSelectColumns($criteria); $this->collUsuarios = UsuarioPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // 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(UsuarioPeer::ID_IDIOMA, $this->cat_id); UsuarioPeer::addSelectColumns($criteria); if (!isset($this->lastUsuarioCriteria) || !$this->lastUsuarioCriteria->equals($criteria)) { $this->collUsuarios = UsuarioPeer::doSelect($criteria, $con); } } } $this->lastUsuarioCriteria = $criteria; return $this->collUsuarios; }
$valor_sino = false; } else { $valor_sino = $valor->getSiNo(); } $value .= " " . __("Configurar alarma") . ": " . checkbox_tag($campo_name . '[tiene_alarma]', '', $valor_sino, array('control_name' => $campo_name . '[tiene_alarma]', 'onclick' => 'if (this.checked) document.getElementById(\'capa_campo_' . $campo->getIdCampo() . '\').style.display = \'block\'; else document.getElementById(\'capa_campo_' . $campo->getIdCampo() . '\').style.display = \'none\';')); if (!$valor_sino) { $txt_vis = "style=\"display:none;\""; } else { $txt_vis = ""; } $valores = explode("##", $valor ? $valor->getTextoCorto() : ""); //for ($i = 1; $i <= 5 ; $i++){ // $var_temp = "selected".$i; // $$var_temp = in_array("1",$valores) ? "SELECTED" : ""; //} $value .= "\n\n <div id=\"capa_campo_" . $campo->getIdCampo() . "\" " . $txt_vis . ">\n " . __("Avisar a") . ":\n " . select_tag($campo_name . '[usuario_avisar]', objects_for_select(UsuarioPeer::doSelect(UsuarioPeer::getCriteriaUsuariosAccesibles()), 'getPrimaryKey', '__toString', $valor ? $valor->getNumero() : "0", array("include_blank" => true)), array('control_name' => $campo_name . '[usuario_avisar]')) . "\n " . __('Cuando?: ') . "\n <select id=\"" . $campo_name . "_cuando_alarma\" name=\"" . $campo_name . "[cuando_alarma][]\" size=\"5\" multiple>\n <option value=\"1\" " . (in_array("1", $valores) ? "SELECTED" : "") . ">" . __('1 mes antes') . "</option>\n <option value=\"2\" " . (in_array("2", $valores) ? "SELECTED" : "") . ">" . __('2 semanas antes') . "</option>\n <option value=\"3\" " . (in_array("3", $valores) ? "SELECTED" : "") . ">" . __('1 semana antes') . "</option>\n <option value=\"4\" " . (in_array("4", $valores) ? "SELECTED" : "") . ">" . __('1 día antes') . "</option>\n <option value=\"5\" " . (in_array("5", $valores) ? "SELECTED" : "") . ">" . __('el día') . "</option>\n </select>\n </div>\n "; } } elseif ($campo->esTipoNumero()) { if ($campo->getTamano() != null && $campo->getTamano() != "") { $tamano = $campo->getTamano(); } else { $tamano = '5'; } $value .= input_tag($control_name, $valor ? $valor->getNumero() : $campo->getDefecto(), array('control_name' => $control_name, 'size' => $tamano)); } elseif ($campo->esTipoDocumento()) { if ($valor && $valor->getTextoCorto() != "") { $fname = explode("_", basename($valor->getTextoCorto())); if (sizeof($fname) > 1) { $fname = substr(basename($valor->getTextoCorto()), strlen($fname[0]) + 1); } else { $fname = $fname[0];
public function getUsuarios($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(EstablecimientoPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collUsuarios === null) { if ($this->isNew()) { $this->collUsuarios = array(); } else { $criteria->add(UsuarioPeer::FK_ESTABLECIMIENTO_ID, $this->id); UsuarioPeer::addSelectColumns($criteria); $this->collUsuarios = UsuarioPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(UsuarioPeer::FK_ESTABLECIMIENTO_ID, $this->id); UsuarioPeer::addSelectColumns($criteria); if (!isset($this->lastUsuarioCriteria) || !$this->lastUsuarioCriteria->equals($criteria)) { $this->collUsuarios = UsuarioPeer::doSelect($criteria, $con); } } } $this->lastUsuarioCriteria = $criteria; return $this->collUsuarios; }
public function getUsuariosAccesibles() { $c_usuarios = UsuarioPeer::getCriteriaUsuariosAccesibles(); $usuarios = UsuarioPeer::doSelect($c_usuarios); return $usuarios; }