/** * Generated from @assert */ public function testRender() { $e = new TextElement("xy"); $e->setAttribute("name", "dddddddd"); $e->setLabel('ddd', 'sdfdsfdsfs', 'css'); $this->object->setAttribute("id", "test"); $this->object->setAttribute("target", "_blank"); $this->object->setElement($e); $e1 = new HtmlScript(); $e1->setScript("<a herf='aa.html' target='_blank'>"); $this->object->setElement($e1); $e2 = new TextElement("xy1"); $e2->setAttribute("name", "dddddddd11"); $e2->setLabel('ddd', 'sdfdsfdsfs1', 'css1'); $this->object->setElement($e2); $e3 = new HtmlScript(); $e3->setScript("</a>"); $this->object->setElement($e3); $output = "<form id='test' target='_blank'><div id='ddd' class='css'>sdfdsfdsfs</div><input id='xy' type='text' name='dddddddd'><a herf='aa.html' target='_blank'><div id='ddd' class='css1'>sdfdsfdsfs1</div><input id='xy1' type='text' name='dddddddd11'></a></form>"; $this->assertEquals($output, $this->object->render()); }
/** * Create the form object. * @param string $formAction * @param string $formId * @param string $formName * @param string $uidLabel * @param string $pwdLabel * @param string $moduleName * @param string $loginMsgId */ protected function createForm($formAction, $formId, $formName, $uidLabel, $pwdLabel, $moduleName, $loginMsgId) { $acl = AclUtility::getInstance(); $tblId = $acl->getTableIdByModule($moduleName); $mapFields = $acl->getMappingFieldByTbl($tblId); $uidField = $mapFields["user_id"]; $pwdField = $mapFields["pwd"]; //set form $this->setAttribute("id", $formName); $this->setAttribute("name", $formName); $this->setAttribute("class", $formName); $this->setAttribute("action", $formAction); //set form elements $uidTxtField = new TextElement($uidField); $pwdTxtField = new PasswordElement($pwdField); $submitBtn = new SubmitElement("submit"); $messageDiv = new DivElement($loginMsgId); $uidTxtField->setLabel('uid', $uidLabel, 'uid'); $uidTxtField->setAttribute('name', $uidField); $pwdTxtField->setLabel('pwd', $pwdLabel, 'pwd'); $pwdTxtField->setAttribute('name', $pwdField); //set default form layout here if (is_null($this->_formDecoration)) { $this->_formDecoration = array($formId => array("<div class='{$formName}' name='{$formId}'>", "</div>")); } $this->setDecoration($this->_formDecoration); $this->setElement($uidTxtField); $this->setElement($pwdTxtField); $this->setElement($messageDiv); $this->setElement($submitBtn); }
<?php require_once dirname(__FILE__) . '/../zframework/app/library/ui/JsUIComponentInterface.php'; require_once dirname(__FILE__) . '/../zframework/app/library/ui/jquery/JUIComponent.php'; require_once dirname(__FILE__) . '/../zframework/app/library/ui/html/UIComponent.php'; require_once dirname(__FILE__) . '/../zframework/app/library/ui/jquery/Tab.php'; require_once dirname(__FILE__) . '/../zframework/app/library/ui/html/components/TextElement.php'; require_once dirname(__FILE__) . '/../zframework/app/library/ui/html/components/HtmlScript.php'; //put your code here $sf = new Tab('test'); $sf->addTab("x1", "x1"); $sf->addTab("d1", "d1"); $e = new TextElement("xy"); $e->setAttribute("name", "dddddddd"); $e->setLabel('ddd', 'sdfdsfdsfs', 'css'); //$sf->setAttribute("id", "test"); //$sf->setAttribute("target", "_blank"); $sf->setElement("x1", $e); $e1 = new HtmlScript(); $e1->setScript("<a herf='aa.html' target='_blank'>"); $sf->setElement('d1', $e1); $e2 = new TextElement("xy1"); $e2->setAttribute("name", "dddddddd11"); $e2->setLabel('ddd', 'sdfdsfdsfs1', 'css1'); $sf->setElement("d1", $e2); $e3 = new HtmlScript(); $e3->setScript("</a>"); $sf->setElement("d1", $e3); echo $sf->render();