static function probarXML($encodedXml) { $connect = xmlResponse::connect(); if ($connect['result'] == 'fail') { return array('result' => __('Error de conexión'), 'message' => $connect['message']); } elseif ($connect['result'] == 'ok') { try { //_COMUNICACION_APD_ $c1 = new Criteria(); $c1->addAnd(ParametroPeer::TIPOPARAMETRO, "_COMUNICACION_APD_", Criteria::EQUAL); $parametro = ParametroPeer::doSelectOne($c1); if ($parametro->getSiNo()) { $ejecutar = sfConfig::get('app_metodo_prueba_xml'); } else { $ejecutar = $ejecutar = sfConfig::get('app_metodo_registro_xml'); } $res = xmlResponse::$client->__soapCall($ejecutar, array($encodedXml)); //echo "\n\nRESPONSE1:\n" . xmlResponse::$client->__getLastResponse() . "\n"; //echo "\n\nRESPONSE2:\n" . print_r($res) . "\n"; return array('result' => 'ok', 'res' => $res, 'last' => xmlResponse::$client->__getLastResponse()); } catch (SOAPFault $e) { return array('result' => __('Error de Soap'), 'message' => $e); } } }
/** * Función que devuelve el estado de la tarea. * @return string * @version 10-02-09 * @author Ana Martín */ public function getEstadoTarea() { $objeto = ParametroPeer::retrievebypk($this->getIdEstadoTarea()); if ($objeto instanceof Parametro) { return $objeto->getNombre(); } else { return '--'; } }
/** * Función que devuelve una lista con los estados de las tareas que son eventos. * @return array, lista de objetos de tipo parametro * @version 10-02-09 * @author Ana Martín */ public static function getAllEstadosEventos() { $c = new Criteria(); $c->add(ParametroPeer::TIPOPARAMETRO, '_ESTADO_TAREA_'); $c->add(ParametroPeer::SI_NO, 1); $c->addAscendingOrderByColumn(ParametroPeer::NUMERO); $c->addAscendingOrderByColumn(ParametroPeer::NOMBRE); $lista = ParametroPeer::doSelect($c); return $lista; }
public function save(PropelPDO $con = null) { // New records need to be initialized with orden = maxOrden +1 if (!$this->getPrimaryKey()) { $con = $con ? $con : Propel::getConnection(ParametroPeer::DATABASE_NAME); try { $con->beginTransaction(); $this->setOrden(ParametroPeer::getMaxOrden($this->getTipoParametro()) + 1); parent::save(); $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } } else { parent::save(); } }
/** * 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(ParametroPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(ParametroPeer::DATABASE_NAME); $criteria->add(ParametroPeer::ID_PARAMETRO, $pks, Criteria::IN); $objs = ParametroPeer::doSelect($criteria, $con); } return $objs; }
?> <th id="sf_admin_list_th_estado"><?php echo __('Estado'); ?> </th> <th id="sf_admin_list_th_acciones"><?php echo __('Acciones'); ?> </th> </tr> </thead> <?php $max = ParametroPeer::getMaxOrden($parametro_def->getPrimaryKey()); ?> <tbody> <?php $i = 1; foreach ($parametros as $parametro) { $odd = fmod(++$i, 2); $td_class = "sf_admin_row_" . $odd; if ($parametro->getPrimaryKey() == $id_parametro_editado) { $td_class = "highlight strong"; } if ($parametro->getFechaBorrado()) { } ?> <tr class="<?php
/** * Get the associated Parametro object * * @param PropelPDO Optional Connection object. * @return Parametro The associated Parametro object. * @throws PropelException */ public function getParametro(PropelPDO $con = null) { if ($this->aParametro === null && $this->id_estado_tarea !== null) { $c = new Criteria(ParametroPeer::DATABASE_NAME); $c->add(ParametroPeer::ID_PARAMETRO, $this->id_estado_tarea); $this->aParametro = ParametroPeer::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->aParametro->addTareas($this); */ } return $this->aParametro; }
public static function getTiposUnidadesHtml() { $c = new Criteria(); $c->addAnd(ParametroPeer::TIPOPARAMETRO, "_TIPO_UNIDAD_", Criteria::EQUAL); $unidades = ParametroPeer::doSelect($c); $lista = array(); foreach ($unidades as $unidad) { $lista[$unidad->getIdParametro()] = $unidad->getNombre(); } return $lista; }
public static function getCategoriasDocumentos() { $c = UsuarioPeer::getCriterioNoBorrado(ParametroPeer::FECHABORRADO); $c->add(ParametroPeer::TIPOPARAMETRO, "_CATEGORIA_DOCUMENTOS_", Criteria::EQUAL); $c->addAscendingOrderByColumn(ParametroPeer::NUMERO); return ParametroPeer::doSelect($c); }
/** * Returns the number of related Parametro objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related Parametro objects. * @throws PropelException */ public function countParametros(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(ParametroDefPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collParametros === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(ParametroPeer::TIPOPARAMETRO, $this->tipoparametro); $count = ParametroPeer::doCount($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 count of the collection. $criteria->add(ParametroPeer::TIPOPARAMETRO, $this->tipoparametro); if (!isset($this->lastParametroCriteria) || !$this->lastParametroCriteria->equals($criteria)) { $count = ParametroPeer::doCount($criteria, $con); } else { $count = count($this->collParametros); } } else { $count = count($this->collParametros); } } return $count; }
?> </li> <li><?php echo link_to(__('Informe acerca de un error'), 'content/bugreport'); ?> </li> </ul> </div> <div style="clear:both"><!-- ie bugfix --></div> </div> <?php $base = 85; $categorias = ParametroPeer::getCategorias(); $base = $base + sizeof($categorias) * 90; ?> <script language="Javascript"> elements = getElementsByClassName(document, "*", "ThemeGrayMenu"); for (i = 0; i < elements.length; i++){ elements[i].style.marginLeft = "-<?php echo $base; ?> px"; } </script> <?php /* <?php $empresa = EmpresaPeer::retrieveByPk($id_empresa);
/** * Selects a collection of Tabla 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 Tabla 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); } TablaPeer::addSelectColumns($c); $startcol2 = TablaPeer::NUM_COLUMNS - TablaPeer::NUM_LAZY_LOAD_COLUMNS; EmpresaPeer::addSelectColumns($c); $startcol3 = $startcol2 + (EmpresaPeer::NUM_COLUMNS - EmpresaPeer::NUM_LAZY_LOAD_COLUMNS); ParametroPeer::addSelectColumns($c); $startcol4 = $startcol3 + (ParametroPeer::NUM_COLUMNS - ParametroPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(TablaPeer::ID_EMPRESA), array(EmpresaPeer::ID_EMPRESA), $join_behavior); $c->addJoin(array(TablaPeer::ID_CATEGORIA), array(ParametroPeer::ID_PARAMETRO), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = TablaPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = TablaPeer::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 = TablaPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); TablaPeer::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 (Tabla) to the collection in $obj2 (Empresa) $obj2->addTabla($obj1); } // if joined row is not null // Add objects for joined Parametro rows $key3 = ParametroPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = ParametroPeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = ParametroPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); ParametroPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Tabla) to the collection in $obj3 (Parametro) $obj3->addTabla($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
protected function getParametroOr404($id_parametro = 'item') { if (!$this->getRequestParameter($id_parametro)) { $this->forward404(); } else { $parametro = ParametroPeer::retrieveByPk($this->getRequestParameter($id_parametro)); $this->forward404Unless($parametro); } return $parametro; }
function _jscookmenu($arr, $name, $orientation, $theme) { $arr2 = array(); $id_empresa_sel = sfContext::getInstance()->getUser()->getAttribute('idempresa', null); $categorias = ParametroPeer::getCategorias(); foreach ($categorias as $cat) { $tmp_array = array(); $tmp_array["title"] = strtoupper($cat->getNombre()); $c = TablaPeer::getCriterioAlcance(true); $c->addAnd(TablaPeer::ID_EMPRESA, $id_empresa_sel, Criteria::EQUAL); $c->addAnd(TablaPeer::ID_CATEGORIA, $cat->getIdParametro(), Criteria::EQUAL); $tablas = TablaPeer::doSelect($c); $cont = 1; if (sizeof($tablas) > 0) { $tmp_array["submenu"] = array(); } foreach ($tablas as $tabla) { $tmp_array["submenu"]["menu0" . $cat->getIdParametro() . "." . $cont] = array("title" => $tabla->getNombre(), "url" => 'formularios/list', "after_url" => '/?filters[id_empresa]=' . $id_empresa_sel . '&filters[id_tabla]=' . $tabla->getIdTabla() . '&filter=filter'); $cont++; } if (sizeof($tablas) > 0) { $arr2["menu0" . $cat->getIdParametro()] = $tmp_array; } } foreach ($arr as $key => $ar) { $arr2[$key] = $ar; } $arr = $arr2; _load_jscookmenu_resources($theme); $sf_user = sfContext::getInstance()->getUser(); $js = "var {$name} = ["; foreach ($arr as $item) { if (is_array($item)) { // check credentials $display = true; //if (isset($item['credentials'])) // $display = $sf_user->hasCredential($item['credentials']); if (isset($item['url'])) { $actions = explode("/", $item['url']); if (!isset($actions[1])) { $actions[1] = "index"; } $display = Usuario::tienePermisos($actions[0], $actions[1]); } // if sf_user has credentials, display the menu item if ($display) { $js .= "[" . _get_item($item); if (isset($item['submenu'])) { foreach ($item['submenu'] as $subitem) { if (is_array($subitem)) { // check credentials $display = true; if (isset($subitem['url'])) { $actions = explode("/", $subitem['url']); if (!isset($actions[1])) { $actions[1] = "index"; } $display = Usuario::tienePermisos($actions[0], $actions[1]); } //if (isset($subitem['credentials'])) //$display = $sf_user->hasCredential($subitem['credentials']); // if sf_user has credentials, display the menu item if ($display) { $js .= ", [" . _get_item($subitem); if (isset($subitem['submenu'])) { foreach ($subitem['submenu'] as $subsubitem) { if (is_array($subsubitem)) { // check credentials $display = true; if (isset($subsubitem['url'])) { $actions = explode("/", $subsubitem['url']); if (!isset($actions[1])) { $actions[1] = "index"; } $display = Usuario::tienePermisos($actions[0], $actions[1]); } //if (isset($subsubitem['credentials'])) //$display = $sf_user->hasCredential($subsubitem['credentials']); // if sf_user has credentials, display the menu item if ($display) { $js .= ", [" . _get_item($subsubitem) . "]"; } } else { if ($subsubitem == '_cmSplit') { $js .= ", " . $subsubitem; } } } } $js .= "]"; } } else { if ($subitem == '_cmSplit') { $js .= ', ' . $subitem; } } } } $js .= "], "; } } else { if ($item == '_cmSplit') { $js .= $item . ', '; } } } $js = substr($js, 0, strlen($js) - 2); $js .= "];"; $html = tag('div', array('id' => "{$name}"), true); $html .= tag('/div', array(), true); $js2 = "cmDraw('{$name}', {$name}, '{$orientation}', {$theme});"; return javascript_tag($js) . $html . javascript_tag($js2); }
/** * 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 = ParametroPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setIdParametro($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setTipoparametro($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setNombre($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setOrden($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setNumero($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setNumero2($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setCadena($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setCadena1($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setOtroobjeto($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setSiNo($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setFecha($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setCreatedAt($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setUpdatedAt($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setFechaborrado($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setNombrefichero($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setTipo($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setFichero($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { $this->setTamano($arr[$keys[17]]); } }