Ejemplo n.º 1
0
  <?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 
}
?>
  
  <?php 
echo label_for('campo[mostrar_en_padre]', __($labels['campo{mostrar_en_padre}']) . ":", '');
?>
function preBox($s, $len = -1, $lenlimit = 2000, $style = '', $hinted = false)
{
    // takes any long string, trims if needed, converts special html chars, and wraps in pre tag
    // the result can be directly inserted in html safely
    // $len: if this is a smaller version of an original string, what was the original length?
    if ($s === NULL) {
        return '<div><i>NULL</i></div>';
    }
    if (strlen($s) > 1) {
        $lastline = strrpos($s, "\n", -2);
        if ($lastline === FALSE) {
            $lastline = "";
        } else {
            $lastline = substr($s, $lastline);
        }
        if (strlen($lastline) > $lenlimit) {
            $lastline = substr($lastline, strlen($lastline) - $lenlimit);
        }
    } else {
        $lastline = '';
    }
    if ($len == -1) {
        $len = strlen($s);
    }
    if ($lenlimit >= 0 && strlen($s) - strlen($lastline) > $lenlimit) {
        $s = substr($s, 0, $lenlimit) . "\n" . sprintf(__t('[Too long; only first %1$s out of %2$s characters shown]'), $lenlimit, $len) . $lastline;
    }
    $style = $style == "" ? "" : " style='{$style}'";
    $s = htmlspecialchars($s);
    if ($hinted) {
        $regex = "|Internal_Flag:(.*):galF|";
        preg_match($regex, $s, $match);
        $hint = determineHint($match[1]);
        if ($hint !== NULL) {
            $replacement = popUp($match[1], $hint, $style, "Click for more information about this error");
        } else {
            $replacement = $match[1];
        }
        $s = preg_replace($regex, $replacement, $s);
    }
    global $popupBoxen;
    return "<pre class='prebox'{$style}>" . "\n" . $s . '</pre>' . $popupBoxen;
}
Ejemplo n.º 3
0
 } 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";
     }
     $value .= "&nbsp;&nbsp;o&nbsp;&nbsp;" . link_to(image_tag("icons/add.png"), $modulo . "/create");
 }
 //texto de ayuda
function pyHintHandler($options, $content)
{
    return popUp($content, do_short_and_sweetcode($options["hint"]), getSoft($options, "class", ""));
}
Ejemplo n.º 5
0
             $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));
     }
 }
 if ($value) {
     ?>