コード例 #1
0
 public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 {
     // we may modify criteria, so copy it first
     $criteria = clone $criteria;
     // We need to set the primary table name, since in the case that there are no WHERE columns
     // it will be impossible for the BasePeer::createSelectSql() method to determine which
     // tables go into the FROM clause.
     $criteria->setPrimaryTableName(FormularioPeer::TABLE_NAME);
     if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
         $criteria->setDistinct();
     }
     if (!$criteria->hasSelectClause()) {
         FormularioPeer::addSelectColumns($criteria);
     }
     $criteria->clearOrderByColumns();
     // ORDER BY won't ever affect the count
     $criteria->setDbName(self::DATABASE_NAME);
     // Set the correct dbName
     if ($con === null) {
         $con = Propel::getConnection(FormularioPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     foreach (sfMixer::getCallables('BaseFormularioPeer:doCount:doCount') as $callable) {
         call_user_func($callable, 'BaseFormularioPeer', $criteria, $con);
     }
     $criteria = self::kriterio($criteria);
     // BasePeer returns a PDOStatement
     $stmt = BasePeer::doCount($criteria, $con);
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $count = (int) $row[0];
     } else {
         $count = 0;
         // no rows returned; we infer that means 0 matches.
     }
     $stmt->closeCursor();
     return $count;
 }
コード例 #2
0
        <div style="clear: both; height: 6px;"></div>

        <div style="width: 100%; background-color: black; color: white; height: 20px; font-weight: bold; font-size: 12px; text-align: right; padding-top: 10px;">
        &nbsp;&nbsp;
        </div>
        
        <ul style="PADDING-RIGHT: 0px; PADDING-LEFT: 4px; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 15px 0px; WIDTH: 100%; PADDING-TOP: 0px; LIST-STYLE-TYPE: none;">
          <?php 
/*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
$ruta = UsuarioPeer::getRuta();
$i = 1;
foreach ($tablas as $tabla) {
    $c = new Criteria();
    $c->addAnd(FormularioPeer::ID_TABLA, $tabla->getIdTabla(), Criteria::EQUAL);
    $c->addDescendingOrderByColumn(FormularioPeer::FECHA);
    $formularios = FormularioPeer::doSelect($c);
    if (sizeof($formularios) > 0) {
        $ult_mod = format_date($formularios[0]->getFecha(), "d");
    } else {
        $ult_mod = "-";
    }
    if ($i % 2 == 0) {
        $textalign = "right";
    } else {
        $textalign = "left";
    }
    echo '<li style=\'PADDING-RIGHT: 4px; DISPLAY: inline; PADDING-LEFT: 4px; FLOAT: left; PADDING-BOTTOM: 4px; WIDTH: 48%; PADDING-TOP: 4px; text-align:' . $textalign . '\'>';
    echo '<a href="' . $ruta . '/formularios/create/?id_tabla=' . $tabla->getIdTabla() . '" style=\'text-decoration: none; font-weight: bold; font-size: 12px\'><!--class="clientes" ' . __('Añadir registro a ') . '-->' . strtoupper($tabla->getNombre()) . '</a>';
    echo '<br /><a href="' . $ruta . '/formularios/list/?filters[id_empresa]=' . $id_empresa_sel . '&filters[id_tabla]=' . $tabla->getIdTabla() . '&filter=filter" style=\'text-decoration: none; \' >' . (sizeof($formularios) . __(' registros')) . '</a> <br /> Ult. Mod: ' . $ult_mod;
    echo '</li>';
    $i++;
コード例 #3
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 FormulariosRelatedByIdUsuarioCreador 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 getFormulariosRelatedByIdUsuarioCreadorJoinTabla($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->collFormulariosRelatedByIdUsuarioCreador === null) {
         if ($this->isNew()) {
             $this->collFormulariosRelatedByIdUsuarioCreador = array();
         } else {
             $criteria->add(FormularioPeer::ID_USUARIO_CREADOR, $this->id_usuario);
             $this->collFormulariosRelatedByIdUsuarioCreador = FormularioPeer::doSelectJoinTabla($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(FormularioPeer::ID_USUARIO_CREADOR, $this->id_usuario);
         if (!isset($this->lastFormularioRelatedByIdUsuarioCreadorCriteria) || !$this->lastFormularioRelatedByIdUsuarioCreadorCriteria->equals($criteria)) {
             $this->collFormulariosRelatedByIdUsuarioCreador = FormularioPeer::doSelectJoinTabla($criteria, $con, $join_behavior);
         }
     }
     $this->lastFormularioRelatedByIdUsuarioCreadorCriteria = $criteria;
     return $this->collFormulariosRelatedByIdUsuarioCreador;
 }
コード例 #4
0
echo $value ? $value : "-";
?>
    </div>
    Att: Si ponemos usuario que no sea el nuestro ya no veremos este evento. 
</div>
</fieldset>

<fieldset id="sf_fieldset_tarea" class="">
<h2><?php 
echo __('Datos');
?>
</h2>

<?php 
if ($tarea->getIdFormulario() != 0) {
    $form = FormularioPeer::retrieveByPK($tarea->getIdFormulario());
    if ($form instanceof Formulario && $form->getTabla() instanceof Tabla) {
        ?>
    <div class="form-row">
      <?php 
        echo label_for('tarea[objeto_relacionado]', __($labels['tarea{objeto_relacionado}']) . ":", '');
        ?>
      <div class="content">
      <?php 
        echo link_to($form->getTabla()->__toString() . " - " . $form->__toString(), "formularios/edit?id_formulario=" . $tarea->getIdFormulario());
        ?>
      </div>
    </div>
<?php 
    }
}
コード例 #5
0
ファイル: Item.php プロジェクト: Esleelkartea/legedia-ESLE
 public function __toString($to_file = false)
 {
     include_once SF_ROOT_DIR . "/lib/symfony/helper/DateHelper.php";
     if (!$this->getPrimaryKey()) {
         return null;
     }
     $campo = $this->getItemBase()->getCampo();
     $value = null;
     if (!$campo->esTipoLista()) {
         if ($campo->esTipoTextoLargo()) {
             $value = $this->getTextoLargo();
         } elseif ($campo->esTipoTextoCorto()) {
             $value = $this->getTextoCorto();
         } elseif ($campo->esTipoDocumento()) {
             if ($this->getTextoCorto() != "") {
                 $fname = explode("_", basename($this->getTextoCorto()));
                 if (sizeof($fname) > 1) {
                     $fname = substr(basename($this->getTextoCorto()), strlen($fname[0]) + 1);
                 } else {
                     $fname = $fname[0];
                 }
                 if ($to_file) {
                     $value = $fname;
                 } else {
                     $value = "<a href=\"" . dirname(UsuarioPeer::getRuta()) . "/index.php/formularios/download/?id_item=" . $this->getIdItem() . "&id_formulario=" . $this->getIdFormulario() . "\" target=\"_NEW\">" . $fname . "<a>";
                 }
             } else {
                 $value = "";
             }
         } elseif ($campo->esTipoNumero()) {
             $value = $this->getNumero();
         } elseif ($campo->esTipoFecha()) {
             $value = format_date($this->getFecha(), "D");
         } elseif ($campo->esTipoBooleano()) {
             if ($this->getSiNo()) {
                 $value = sfContext::getInstance()->getI18N()->__("SI");
             } else {
                 $value = sfContext::getInstance()->getI18N()->__("NO");
             }
         } elseif ($campo->esTipoSelectPeriodo()) {
             $value = nombre_periodo($campo->getTipoPeriodo(), $this->getNumero(), $this->getAnio());
         } elseif ($campo->esTipoTabla()) {
             $form = FormularioPeer::retrieveByPk($this->getIdTabla());
             if ($form != null) {
                 $value = $form->__toString();
             } else {
                 $value = "--";
             }
         } elseif ($campo->esTipoObjeto()) {
             eval("\$value = " . $campo->getValorObjeto() . "Peer::retrieveByPk(\$this->getIdObjeto());");
             if ($value != null) {
                 $value = $value->__toString();
             } else {
                 $value = "--";
             }
         }
     } else {
         //Obtener los items del mismo formulario cuyo campo id_campo coincida con el de nuestro id_item_base
         $c = new Criteria();
         $c->addAnd(ItemPeer::ID_FORMULARIO, $this->getIdFormulario(), Criteria::EQUAL);
         $c->addAnd(ItemPeer::SI_NO, 1, Criteria::EQUAL);
         $c->addJoin(ItemPeer::ID_ITEM_BASE, ItemBasePeer::ID_ITEM_BASE, Criteria::JOIN);
         $c->addAnd(ItemBasePeer::ID_CAMPO, $this->getItemBase()->getIdCampo(), Criteria::EQUAL);
         $items_base_seleccionados = ItemBasePeer::doSelect($c);
         if (sizeof($items_base_seleccionados)) {
             $value .= !$to_file ? "<ul class=\"sf_admin_checklist\">\n" : "";
             foreach ($items_base_seleccionados as $ibs) {
                 $value .= !$to_file ? "<li>" : "";
                 /****/
                 if ($campo->esListaTipoRangos()) {
                     //lista de rangos
                     $desde = null;
                     $hasta = null;
                     $unidad = CampoPeer::getHtmlTipoUnidad($campo->getUnidadRangos());
                     $unidad = $unidad ? "&nbsp;" . $unidad : '';
                     if ($ibs->getNumeroInferior() && $ibs->getNumeroInferior() != '') {
                         $desde = format_number($ibs->getNumeroInferior()) . $unidad;
                     }
                     if ($ibs->getNumeroSuperior() && $ibs->getNumeroSuperior() != '') {
                         $hasta = format_number($ibs->getNumeroSuperior()) . $unidad;
                     }
                     if ($desde && $hasta) {
                         $value .= __('desde %1% hasta %2%', array('%1%' => $desde, '%2%' => $hasta));
                     } else {
                         if ($desde) {
                             $value .= __('más de %1%', array('%1%' => $desde));
                         } elseif ($hasta) {
                             $value .= __('menos de %2%', array('%2%' => $hasta));
                         } else {
                             $value .= null;
                         }
                     }
                 } else {
                     $value .= $ibs->getTexto();
                 }
                 /****/
                 if ($ibs->getTextoAuxiliar()) {
                     $texto_auxiliar = $this->getTextoAuxiliar() ? $this->getTextoAuxiliar() : null;
                     $value .= isset($texto_auxiliar) ? "&nbsp;(" . $texto_auxiliar . ")" : '';
                 }
                 $value .= !$to_file ? "</li>" : " - ";
             }
             $value .= !$to_file ? "</ul>\n" : "";
             if (!$to_file) {
                 $value = substr($value, 0, strlen($value) - 3);
             }
         }
     }
     return $value;
 }
コード例 #6
0
 /**
  * Get the associated Formulario object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Formulario The associated Formulario object.
  * @throws     PropelException
  */
 public function getFormulario(PropelPDO $con = null)
 {
     if ($this->aFormulario === null && $this->id_formulario !== null) {
         $c = new Criteria(FormularioPeer::DATABASE_NAME);
         $c->add(FormularioPeer::ID_FORMULARIO, $this->id_formulario);
         $this->aFormulario = FormularioPeer::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->aFormulario->addItems($this);
         		 */
     }
     return $this->aFormulario;
 }
コード例 #7
0
 /**
  * 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(FormularioPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(FormularioPeer::DATABASE_NAME);
         $criteria->add(FormularioPeer::ID_FORMULARIO, $pks, Criteria::IN);
         $objs = FormularioPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #8
0
        ?>
    <?php 
        echo form_error('campo{valor_defecto}', array('class' => 'form-error-msg'));
        ?>
  <?php 
    }
    ?>
  <?php 
    //Obtener el campo de la tabla que es el nombre
    $mitabla = TablaPeer::retrieveByPk($campo->getValorTabla());
    if ($mitabla != null) {
        //$formularios = $mitabla->getFormularios(FormularioPeer::getCriterioAlcance());
        //$value = select_tag("campo[defecto_tabla]" , objects_for_select($formularios , 'getPrimaryKey' , '__toString' , $campo->getDefecto(), array('include_blank' => true)) ,
        //array('control_name' => "campo[defecto_tabla]"));
        if ($campo->getDefecto() != 0) {
            $formulario_t = FormularioPeer::retrieveByPk($campo->getDefecto());
        } else {
            $formulario_t = new Formulario();
        }
        $value = popUp("campo[defecto_tabla]", $formulario_t, $mitabla->getIdEmpresa(), $campo->getValorTabla());
    }
    echo $value ? $value : '&nbsp;';
    ?>
  <div class="sf_edit_help"><?php 
    echo __('Indique el valor por defecto del campo');
    ?>
</div>
  </div>
  <?php 
}
?>
コード例 #9
0
         $value .= "<a href=\"" . dirname(UsuarioPeer::getRuta()) . "/index.php/formularios/download/?id_item=" . $valor->getIdItem() . "&id_formulario=" . $valor->getIdFormulario() . "\" target=\"_NEW\">" . $fname . "<a><br />";
     }
     $value .= input_file_tag($campo_name);
     $value .= input_hidden_tag($control_name, "1");
 } elseif ($campo->esTipoTabla()) {
     if ($id_tabla_proviene != null && ($id_tabla_proviene = $campo->getValorTabla())) {
         $fproviene = FormularioPeer::retrieveByPk($id_formulario_proviene);
         $value .= "<b>" . $fproviene->__toString() . "</b>";
         $value .= input_hidden_tag($control_name, $id_formulario_proviene);
     } else {
         //Obtener el campo de la tabla que es el nombre
         $mitabla = TablaPeer::retrieveByPk($campo->getValorTabla());
         //$formularios = $mitabla->getFormularios(FormularioPeer::getCriterioAlcance());
         //$value .= select_tag($control_name , objects_for_select($formularios , 'getPrimaryKey' , '__toString' , ($valor ? $valor->getIdTabla() : $campo->getDefecto()), array("include_blank"=>true)) ,
         //          array('control_name' => $control_name));
         $formulario_t = FormularioPeer::retrieveByPk($valor ? $valor->getIdTabla() : $campo->getDefecto());
         if ($formulario_t == null) {
             $formulario_t = new Formulario();
         }
         $value .= popUp($control_name, $formulario_t, $mitabla->getIdEmpresa(), $campo->getValorTabla());
         $value .= "&nbsp;&nbsp;o&nbsp;&nbsp;" . link_to(image_tag("icons/add.png"), "formularios/create?id_tabla=" . $campo->getValorTabla() . "&id_tabla_proviene=" . $tabla->getIdTabla() . "&id_formulario_proviene=" . $formulario->getIdFormulario());
     }
 } elseif ($campo->esTipoObjeto()) {
     eval("if (in_array('getCriterioAlcance',get_class_methods('" . $campo->getValorObjeto() . "Peer'))) {\$c = " . $campo->getValorObjeto() . "Peer::getCriterioAlcance();} else {\$c = new Criteria();}");
     eval("\$valores = " . $campo->getValorObjeto() . "Peer::doSelect(\$c);");
     $value .= select_tag($control_name, objects_for_select($valores, 'getPrimaryKey', '__toString', $valor ? $valor->getIdObjeto() : $campo->getDefecto(), array("include_blank" => true)), array('control_name' => $control_name));
     $modulo = strtolower($campo->getValorObjeto());
     if (substr($modulo, -1) == "a" || substr($modulo, -1) == "e" || substr($modulo, -1) == "i" || substr($modulo, -1) == "o" || substr($modulo, -1) == "u") {
         $modulo = $modulo . "s";
     } else {
         $modulo = $modulo . "es";
コード例 #10
0
 /**
  * Selects a collection of Item objects pre-filled with all related objects except ItemBase.
  *
  * @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 Item objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptItemBase(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseItemPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) {
         call_user_func($callable, 'BaseItemPeer', $c, $con);
     }
     $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);
     }
     ItemPeer::addSelectColumns($c);
     $startcol2 = ItemPeer::NUM_COLUMNS - ItemPeer::NUM_LAZY_LOAD_COLUMNS;
     FormularioPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (FormularioPeer::NUM_COLUMNS - FormularioPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(ItemPeer::ID_FORMULARIO), array(FormularioPeer::ID_FORMULARIO), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = ItemPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = ItemPeer::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 = ItemPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             ItemPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Formulario rows
         $key2 = FormularioPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = FormularioPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = FormularioPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 FormularioPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Item) to the collection in $obj2 (Formulario)
             $obj2->addItem($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
コード例 #11
0
 public function executeEnviar_alarmas()
 {
     set_time_limit(0);
     $fecha = new Date();
     $fecha_uno = $fecha->toString(FMT_DATEMYSQL);
     $c1 = new Criteria();
     $crit0 = $c1->getNewCriterion(TareaPeer::FECHA_INICIO, $fecha_uno . " 00:00:00", Criteria::GREATER_EQUAL);
     $crit1 = $c1->getNewCriterion(TareaPeer::FECHA_INICIO, $fecha_uno . " 23:59:59", Criteria::LESS_EQUAL);
     $crit4 = $c1->getNewCriterion(TareaPeer::AVISAR_EMAIL, true, Criteria::EQUAL);
     $crit0->addAnd($crit1);
     $crit0->addAnd($crit4);
     $crit2 = $c1->getNewCriterion(TareaPeer::FECHA_VENCIMIENTO, $fecha_uno . " 00:00:00", Criteria::GREATER_EQUAL);
     $crit3 = $c1->getNewCriterion(TareaPeer::FECHA_VENCIMIENTO, $fecha_uno . " 23:59:59", Criteria::LESS_EQUAL);
     $crit5 = $c1->getNewCriterion(TareaPeer::AVISAR_EMAIL_FIN, true, Criteria::EQUAL);
     $crit2->addAnd($crit3);
     $crit2->addAnd($crit5);
     $crit0->addOr($crit2);
     $c1->add($crit0);
     $c1->setDistinct();
     $tareas_hoy = TareaPeer::doSelect($c1);
     foreach ($tareas_hoy as $tarea) {
         $asunto = $tarea->getResumen();
         $fecha_uno = $tarea->getFechaInicio('d/m/Y');
         $fecha_dos = $tarea->getFechaVencimiento('d/m/Y');
         if ($fecha_uno != $fecha_dos && $fecha_uno == date('d/m/Y')) {
             $cuerpo .= "<strong>Legedia</strong> - Inicio de ";
             $cuerpo .= $tarea->getEsEvento() ? "evento: " : "tarea: ";
         } elseif ($fecha_uno != $fecha_dos && $fecha_dos == date('d/m/Y')) {
             $cuerpo = "<strong>Legedia</strong> - Vencimiento de ";
             $cuerpo .= $tarea->getEsEvento() ? "evento: " : "tarea: ";
         } else {
             $cuerpo = "<strong>Legedia</strong> - " . $tarea->getEsEvento() ? "Evento:" : "Tarea: ";
         }
         $cuerpo .= $tarea->getResumen() . "<br />";
         $cuerpo .= "Inicio: " . $fecha_uno . "<br />";
         $cuerpo .= "Fin: " . $fecha_dos . "<br />";
         $cuerpo .= $tarea->getDescripcion();
         if ($tarea->getIdFormulario() != 0) {
             $form = FormularioPeer::retrieveByPK($tarea->getIdFormulario());
             if ($form instanceof Formulario) {
                 $cuerpo .= "Objeto relacionado: <a href=\"" . UsuarioPeer::getRuta() . "formularios/edit?id_formulario=" . $tarea->getIdFormulario() . "\">" . $form->__toString() . "</a>";
             }
         }
         $cuerpo .= "<br /><br />Muchas gracias<br /><br />Un Saludo<br />Administrador <strong>LEGEDIA</strong>\n";
         $mens = new Mensaje();
         $mens->setAsunto($asunto);
         $mens->setCuerpo($cuerpo);
         $mens->setEmail(true);
         $mens->setFecha(time());
         $mens->save();
         $c = new Criteria();
         $c->addAnd(MensajeDestinoPeer::ID_MENSAJE, $mens->getPrimaryKey());
         MensajeDestinoPeer::doDelete($c);
         $mensajeDestino = new MensajeDestino();
         $mensajeDestino->setIdMensaje($mens->getPrimaryKey());
         $mensajeDestino->setIdUsuario($tarea->getUsuario()->getIdUsuario());
         $mensajeDestino->save();
         echo $tarea->getUsuario()->getEmail() . "::" . $asunto . "<br />" . $cuerpo . "<br /><br />";
         if (trim($tarea->getUsuario()->getEmail()) != "") {
             $enviado = MensajePeer::enviarEmailDefault($tarea->getIdEmpresa(), $asunto, $cuerpo, array($tarea->getUsuario()->getEmail()));
         }
     }
     echo "ENVIADOS: " . $enviado;
     return sfView::NONE;
 }
コード例 #12
0
 /**
  * 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 = FormularioPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdFormulario($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdTabla($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setIdUsuarioCreador($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setIdUsuario($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setFecha($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCreatedAt($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setUpdatedAt($arr[$keys[6]]);
     }
 }
コード例 #13
0
     $value = campo_periodos($id_label_campo, $campo->getTipoPeriodo(), $periodo_desde, $year_desde, $periodo_hasta, $year_hasta);
 }
 if ($campo->esTipoTabla()) {
     if (isset($filtros['item_base'])) {
         $filtro = $filtros['item_base'];
     } else {
         $filtro = 0;
     }
     //Obtener el campo de la tabla que es el nombre
     $mitabla = TablaPeer::retrieveByPk($campo->getValorTabla());
     if ($mitabla != null) {
         //$formularios = $mitabla->getFormularios();
         //$value = select_tag($id_label_campo , objects_for_select($formularios , 'getPrimaryKey' , '__toString' , $filtro, array('include_blank' => true)) ,
         //  array('control_name' => $id_label_campo,));
         if ($filtro != 0) {
             $formulario_t = FormularioPeer::retrieveByPk($filtro);
         } else {
             $formulario_t = new Formulario();
         }
         $value .= popUp($id_label_campo, $formulario_t, $mitabla->getIdEmpresa(), $campo->getValorTabla());
     }
 }
 if ($campo->esTipoObjeto()) {
     if (isset($filtros['item_base'])) {
         $filtro = $filtros['item_base'];
     } else {
         $filtro = 0;
     }
     eval("if (in_array('getCriterioAlcance',get_class_methods('" . $campo->getValorObjeto() . "Peer'))) {\$c = " . $campo->getValorObjeto() . "Peer::getCriterioAlcance();} else {\$c = new Criteria();}");
     eval("\$valores = " . $campo->getValorObjeto() . "Peer::doSelect(\$c);");
     $value = select_tag($id_label_campo, objects_for_select($valores, 'getPrimaryKey', '__toString', $filtro, array('include_blank' => true)), array('control_name' => $id_label_campo));
コード例 #14
0
 /**
  * Selects a collection of Tarea objects pre-filled with all related objects except Empresa.
  *
  * @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 Tarea objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptEmpresa(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);
     }
     TareaPeer::addSelectColumns($c);
     $startcol2 = TareaPeer::NUM_COLUMNS - TareaPeer::NUM_LAZY_LOAD_COLUMNS;
     FormularioPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (FormularioPeer::NUM_COLUMNS - FormularioPeer::NUM_LAZY_LOAD_COLUMNS);
     CampoPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (CampoPeer::NUM_COLUMNS - CampoPeer::NUM_LAZY_LOAD_COLUMNS);
     UsuarioPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS);
     ParametroPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + (ParametroPeer::NUM_COLUMNS - ParametroPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(TareaPeer::ID_FORMULARIO), array(FormularioPeer::ID_FORMULARIO), $join_behavior);
     $c->addJoin(array(TareaPeer::ID_CAMPO), array(CampoPeer::ID_CAMPO), $join_behavior);
     $c->addJoin(array(TareaPeer::ID_USUARIO), array(UsuarioPeer::ID_USUARIO), $join_behavior);
     $c->addJoin(array(TareaPeer::ID_ESTADO_TAREA), array(ParametroPeer::ID_PARAMETRO), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = TareaPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = TareaPeer::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 = TareaPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             TareaPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Formulario rows
         $key2 = FormularioPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = FormularioPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = FormularioPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 FormularioPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Tarea) to the collection in $obj2 (Formulario)
             $obj2->addTarea($obj1);
         }
         // if joined row is not null
         // Add objects for joined Campo rows
         $key3 = CampoPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = CampoPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = CampoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 CampoPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Tarea) to the collection in $obj3 (Campo)
             $obj3->addTarea($obj1);
         }
         // if joined row is not null
         // Add objects for joined Usuario rows
         $key4 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = UsuarioPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = UsuarioPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 UsuarioPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (Tarea) to the collection in $obj4 (Usuario)
             $obj4->addTarea($obj1);
         }
         // if joined row is not null
         // Add objects for joined Parametro rows
         $key5 = ParametroPeer::getPrimaryKeyHashFromRow($row, $startcol5);
         if ($key5 !== null) {
             $obj5 = ParametroPeer::getInstanceFromPool($key5);
             if (!$obj5) {
                 $omClass = ParametroPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj5 = new $cls();
                 $obj5->hydrate($row, $startcol5);
                 ParametroPeer::addInstanceToPool($obj5, $key5);
             }
             // if $obj5 already loaded
             // Add the $obj1 (Tarea) to the collection in $obj5 (Parametro)
             $obj5->addTarea($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
コード例 #15
0
 protected function getCriterio()
 {
     return FormularioPeer::getCriterioAlcance();
 }