00001 <?php
00014 class CampoLista extends Campo{
00015 protected $atributos = array('id','clase','lista','editable','tabindex');
00016
00026 public function __construct($nodo){
00027 parent::__construct($nodo);
00028 if (!isset($this->id)) throw new ExcepcionCampoAtributoObligatorioNoDefinido('id',get_class($this));
00029 }
00033 public function verNodo(){
00034 $xml = new DOMDocument();
00035
00036 $select = $xml->createElement("select");
00037 $select->setAttribute("id", $this->id);
00038 if (isset($this->tabindex))
00039 $select->setAttribute("tabindex", $this->tabindex);
00040 if (isset($this->editable))
00041 if ($this->editable == "no")
00042 $select->setAttribute("disabled", "disabled");
00043
00044
00045 if (isset($this->nombre)){
00046 $lista = new ListaAuxiliar($this->nombre);
00047 $datos = $lista->ver();
00048 for($i=0; $i<sizeof($datos); $i++){
00049 $option = $xml->createElement("option");
00050 $option->setAttribute("value", $datos[$i]['id']);
00051 $nombre = $xml->createTextNode($datos[$i]['nombre']);
00052 $option->appendChild($nombre);
00053 $select->appendChild($option);
00054 }
00055 }
00056
00057 return $select;
00058 }
00059 }
00060
00062
00063 return true;
00064 ?>