class LineForm !!!1191685.php!!! __construct(inout orm : ORM, inout context : ApplicationContext) : ABMForm parent::__construct($orm, $context); $this->setClass("Line") ->setTitle("Lineas") ->setMethod("post") ->setFormType(Form::FORM_OK_CANCEL) ->setId("id_form_lines"); $this->context = $context; $site_id = $this->getValueOf("site_id"); $line = new TextComponent(); $line->setLabel("Linea") ->setMaps('line'); $description = new TextComponent(); $description->setLabel("Descripcion") ->setMaps('description'); $status = new SelectComponent(); $status->setLabel("Estado") ->setMaps('status') ->setSelected("1") ->setOptions(array(array("value" => "1", "description" => "Activo"), array("value" => "0", "description" => "Inactivo"))); $lineTypeOptions = $orm->query('lineType') ->attributes('id AS value', 'description') ->find(); $lineType = new SelectComponent(); $lineType->setLabel("Tipo de Linea") ->setMaps('lineType.id') ->setSelected("1") ->setOptions($lineTypeOptions); $interno = new TextComponent(); $interno->setLabel("Nro Interno") ->setMaps('interno'); $passwordSip = new TextComponent(); $passwordSip->setLabel("Password Sip") ->setMaps('passwordSip'); $aRecursos = $orm->query('Site') ->attributes( 'serviceProvider.resources.id AS value', 'serviceProvider.resources.description AS description', 'serviceProvider.resources.field AS field') ->filterBy('id', '=', $site_id) ->find(); $aComponentesAgregados = array(); $def = $orm->getDefinition('Line'); for ($i = 0; $i < count($aRecursos); $i++) { $definido = $def->getFieldDefinition($aRecursos[$i]["field"]); if ($definido) { if (isset($definido["type"])) { switch ($definido["type"]) { case ORM_TYPES::ORM_ENTITY: $clase = $definido["class"]; $valores = $orm->query($clase)->attributes('id AS value', 'description')->find(); break; default: $valores = array(array("value" => "0", "description" => "No"), array("value" => "1", "description" => "Si")); break; } $tmp = new SelectComponent(); $tmp->setLabel($aRecursos[$i]["description"]) ->setMaps($aRecursos[$i]["field"]) ->setOptional(true) ->setOptions($valores); $aComponentesAgregados[] = $tmp; } } } //Agrego el componente hidden de site_id $sitio = new HiddenComponent(); $sitio->setMaps('sitio.id') ->setValue($site_id); $servicePackOptions = $orm->query('Site')->attributes('serviceProvider.servicePacks.id AS value', 'serviceProvider.servicePacks.description AS description') ->filterBy('id', '=', $site_id) ->find(); $servicePack = new SelectComponent(); $servicePack->setLabel("Service Pack") ->setMaps('servicePack.id') ->setOptions($servicePackOptions); $subscription = new TextComponent(); $subscription->setLabel("ID Subscription Tenfold") ->setMaps('subscription'); $ssi = new TextComponent(); $ssi->setLabel("ID ruta SSI") ->setMaps('ssi'); /*$compBotonete = new ButtonComponent(); $compBotonete->setLabel("") ->setId('id_sumb') ->setName('subm') ->setAction('submit') ->setValue("Aceptar");*/ if (is_array($aComponentesAgregados)) { $ag = count($aComponentesAgregados); } else { $ag = 0; } $oLayout1 = new GridLayout(9+$ag, 1); $oLayout1->addComponent($line, 1, 1) ->addComponent($description, 2, 1) ->addComponent($status, 3, 1) ->addComponent($lineType, 4, 1) ->addComponent($interno, 5, 1) ->addComponent($passwordSip, 6, 1); $j = 0; if (is_array($aComponentesAgregados)) { for ($j = 0; $j < count($aComponentesAgregados); $j++) { $oLayout1->addComponent($aComponentesAgregados[$j], 7 + $j, 1); } } $oLayout1->addComponent($subscription, 7 + $j, 1) ->addComponent($ssi, 8 + $j, 1)/* ->addComponent($compBotonete, 9 + $j, 1)*/; $this->addComponent($oLayout1)->addComponent($sitio); $this->setAction($context->getCurrentAction()->getStringCommand()); return $this;