Exemple #1
0
 /**
  * Enter description here...
  *
  * @param XmlBlockCollection $block
  */
 protected function CreateSetup($block)
 {
     if ($this->_action == ModuleAction::CreateConfirm) {
         $p = new XmlParagraphCollection();
         if ($this->_context->get("type") != "-anydata-") {
             try {
                 $tblpoll = $this->_context->get("tbl_poll");
                 $tblanswer = $this->_context->get("tbl_answer");
                 $tbllastip = $this->_context->get("tbl_lastip");
                 $suffix = $this->_context->get("tablesuffix");
                 $dbdata = new DBDataset($this->_context->get("type"));
                 $results = array();
                 $results[] = $this->CreateTable($dbdata, "create table {$tblpoll}", "create table {$tblpoll} (name varchar(15), lang char(5), question varchar(150), multiple char(1), showresults char(1), active char(1)) {$suffix}");
                 $results[] = $this->CreateTable($dbdata, "create table {$tblanswer}", "create table {$tblanswer} (name varchar(15), lang char(5), code int, short varchar(10), answer varchar(50), votes int) {$suffix}");
                 //$results[] = $this->CreateTable($dbdata, "create table $tbllastip", "create table $tbllastip (name varchar(15), ip varchar(15)) $suffix");
                 $results[] = $this->CreateTable($dbdata, "add primary key poll", "alter table {$tblpoll} add constraint pk_poll primary key (name, lang);");
                 $results[] = $this->CreateTable($dbdata, "add primary key answer", "alter table {$tblanswer} add constraint pk_answer primary key (name, lang, code)");
                 //$results[] = $this->CreateTable($dbdata, "add primary key lastip", "alter table $tbllastip add constraint pk_lastip primary key (name, ip)");
                 $results[] = $this->CreateTable($dbdata, "add check poll 1", "alter table {$tblpoll} add constraint ck_poll_multiple check (multiple in ('Y', 'N'))");
                 $results[] = $this->CreateTable($dbdata, "add check poll 2", "alter table {$tblpoll} add constraint ck_poll_showresults check (showresults in ('Y', 'N'))");
                 $results[] = $this->CreateTable($dbdata, "add check poll 3", "alter table {$tblpoll} add constraint ck_poll_active check (active in ('Y', 'N'))");
                 $results[] = $this->CreateTable($dbdata, "add foreign key answer", "alter table {$tblanswer} add constraint pk_answer_poll foreign key (name) references {$tblpoll}(name)");
                 //$results[] = $this->CreateTable($dbdata, "add foreign key lastip", "alter table $tbllastip add constraint pk_lastip_poll foreign key (name) references $tblpoll(name)");
                 $block->addXmlnukeObject(new XmlEasyList(EasyListType::UNORDEREDLIST, "", $this->myWords->Value("RESULTSQL"), $results));
                 $poll = new AnydatasetFilenameProcessor("_poll");
                 $anypoll = new AnyDataset($poll);
                 $anypoll->appendRow();
                 $anypoll->addField("dbname", $this->_context->get("type"));
                 $anypoll->addField("tbl_poll", $tblpoll);
                 $anypoll->addField("tbl_answer", $tblanswer);
                 $anypoll->addField("tbl_lastip", $tbllastip);
                 $anypoll->Save();
             } catch (Exception $ex) {
                 $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GOTERROR", $ex->getMessage())));
             }
         } else {
             $poll = new AnydatasetFilenameProcessor("_poll");
             $anypoll = new AnyDataset($poll);
             $anypoll->appendRow();
             $anypoll->addField("dbname", "-anydata-");
             $anypoll->Save();
         }
         $p->addXmlnukeObject(new XmlnukeBreakLine());
         $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CONFIGCREATED"), true));
         $block->addXmlnukeObject($p);
     } else {
         $p = new XmlParagraphCollection();
         $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("FIRSTTIMEMESSAGE")));
         $block->addXmlnukeObject($p);
         $form = new XmlFormCollection($this->_context, $this->_moduleUrl, $this->myWords->Value("CREATESETUP"));
         $form->addXmlnukeObject(new XmlInputHidden("action", ModuleAction::CreateConfirm));
         $db = array("-anydata-" => $this->myWords->Value("NOTUSEDB"));
         $anydatafile = new AnydatasetFilenameProcessor("_db");
         $anydata = new AnyDataset($anydatafile->FullQualifiedNameAndPath());
         $it = $anydata->getIterator();
         while ($it->hasNext()) {
             $sr = $it->moveNext();
             $db[$sr->getField("dbname")] = $sr->getField("dbname");
         }
         $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "type", $this->myWords->Value("FORMCONN"), $db));
         $inputGroup = new XmlInputGroup($this->_context, "tabledetail", true);
         $inputGroup->setVisible(false);
         $text = new XmlInputTextBox($this->myWords->Value("TABLENAME_POLL"), "tbl_poll", "xmlnuke_poll", 20);
         $text->setRequired(true);
         $inputGroup->addXmlnukeObject($text);
         $text = new XmlInputTextBox($this->myWords->Value("TABLENAME_ANSWER"), "tbl_answer", "xmlnuke_answer", 20);
         $text->setRequired(true);
         $inputGroup->addXmlnukeObject($text);
         $text = new XmlInputTextBox($this->myWords->Value("TABLENAME_LASTIP"), "tbl_lastip", "xmlnuke_lastip", 20);
         $text->setRequired(true);
         $inputGroup->addXmlnukeObject($text);
         $text = new XmlInputTextBox($this->myWords->Value("TABLE_SUFFIX"), "tablesuffix", "TYPE INNODB", 30);
         $text->setRequired(true);
         $inputGroup->addXmlnukeObject($text);
         $form->addXmlnukeObject($inputGroup);
         $buttons = new XmlInputButtons();
         $buttons->addSubmit($this->myWords->Value("CREATESETUPBTN"));
         $form->addXmlnukeObject($buttons);
         $block->addXmlnukeObject($form);
         $javascript = "\n\t\t\t\t// ByJG \n\t\t\t\tfn_addEvent('type', 'change', enableFields);\n\t\t\t\tfunction enableFields(e) {\n\t\t    \t\tobj = document.getElementById('type');\n\t\t    \t\tshowHide_tabledetail(obj.selectedIndex != 0);\n\t\t\t\t}\n\t\t\t\t";
         $this->defaultXmlnukeDocument->addJavaScriptSource($javascript, true);
     }
 }
Exemple #2
0
 /**
  * Form Password Info
  *
  */
 protected function formPasswordInfo()
 {
     $form = new XmlFormCollection($this->_context, $this->_url, $this->_myWords->Value("CHANGEPASSTITLE"));
     $this->_paragraph->addXmlnukeObject($form);
     $hidden = new XmlInputHidden("action", "changepassword");
     $form->addXmlnukeObject($hidden);
     $textbox = new XmlInputTextBox($this->_myWords->Value("CHANGEPASSOLDPASS"), "oldpassword", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("CHANGEPASSNEWPASS"), "newpassword", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("CHANGEPASSNEWPASS2"), "newpassword2", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $form->addXmlnukeObject($textbox);
     $button = new XmlInputButtons();
     $button->addSubmit($this->_myWords->Value("TXT_CHANGE"), "");
     $form->addXmlnukeObject($button);
 }
Exemple #3
0
 /**
  * Show Form
  *
  */
 protected function Form()
 {
     $myWords = $this->WordCollection();
     $blockCenter = new XmlBlockCollection($myWords->Value("PAGETITLE"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockCenter);
     $paragraph = new XmlParagraphCollection();
     $blockCenter->addXmlnukeObject($paragraph);
     $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("PAGETEXT")));
     $form_target = "module:search";
     $form = new XmlFormCollection($this->_context, $form_target, $myWords->Value("CAPTION"));
     $paragraph->addXmlnukeObject($form);
     $form->setJSValidate(true);
     $textbox = new XmlInputTextBox($myWords->Value("txtSearch"), "txtSearch", $this->txtSearch, 40);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $checkbox = new XmlInputCheck($myWords->Value("chkAll"), "checkAll", "all");
     $checkbox->setChecked($this->_context->get("checkAll"));
     $form->addXmlnukeObject($checkbox);
     $button = new XmlInputButtons();
     $button->addSubmit($myWords->Value("SUBMIT"), "");
     $form->addXmlnukeObject($button);
 }
Exemple #4
0
 public function EditUser($users, $uid)
 {
     $user = $users->getById($uid);
     $block = new XmlBlockCollection($this->myWords->Value("EDITUSER") . $user->getField($users->getUserTable()->username), BlockPosition::Center);
     if (!$this->isUserAdmin() && $user->getField($users->getUserTable()->admin) == "yes") {
         $p = new XmlParagraphCollection();
         $p->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CANNOTEDITADMIN")));
         $block->addXmlnukeObject($p);
         $this->defaultXmlnukeDocument->addXmlnukeObject($block);
         return;
     }
     $tabview = new XmlnukeTabView();
     $block->addXmlnukeObject($tabview);
     // -------------------------------------------------------------------
     // EDITAR USUÁRIO
     $form = new XmlFormCollection($this->_context, $this->url, "");
     $form->setJSValidate(true);
     $form->addXmlnukeObject(new XmlInputHidden("action", "update"));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage")));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid));
     $textbox = new XmlInputTextBox($this->myWords->Value("LABEL_LOGIN"), "login", $user->getField($users->getUserTable()->username));
     $textbox->setDataType(INPUTTYPE::TEXT);
     $textbox->setRequired(true);
     $textbox->setReadOnly(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->myWords->Value("LABEL_NAME"), "name", $user->getField($users->getUserTable()->name));
     $textbox->setDataType(INPUTTYPE::TEXT);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->myWords->Value("LABEL_EMAIL"), "email", $user->getField($users->getUserTable()->email));
     $textbox->setDataType(INPUTTYPE::EMAIL);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputLabelField($this->myWords->Value("LABEL_PASSWORD"), $this->myWords->Value("FORMPASSWORDNOTVIEW"));
     $form->addXmlnukeObject($textbox);
     $check = new XmlInputCheck($this->myWords->Value("FORMADMINISTRADOR"), "admin", "yes");
     $check->setChecked($user->getField($users->getUserTable()->admin));
     $check->setReadOnly(!$this->isUserAdmin());
     $form->addXmlnukeObject($check);
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("TXT_UPDATE"), "");
     $form->addXmlnukeObject($boxButton);
     $tabview->addTabItem($this->myWords->Value("TABEDITUSER"), $form);
     // -------------------------------------------------------------------
     // ALTERAR SENHA
     $form = new XmlFormCollection($this->_context, $this->url, "");
     $form->setJSValidate(true);
     $form->addXmlnukeObject(new XmlInputHidden("action", "changepassword"));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage")));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid));
     $textbox = new XmlInputTextBox($this->myWords->Value("FORMNEWPASSWORD"), "password", "");
     $textbox->setInputTextBoxType(InputTextBoxType::PASSWORD);
     $textbox->setDataType(INPUTTYPE::TEXT);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("TXT_CHANGE"), "");
     $form->addXmlnukeObject($boxButton);
     $tabview->addTabItem($this->myWords->Value("TABCHANGEPASSWD"), $form);
     // -------------------------------------------------------------------
     // REMOVER USUARIO
     $form = new XmlFormCollection($this->_context, $this->url, "");
     $form->setJSValidate(true);
     $form->addXmlnukeObject(new XmlInputHidden("action", "delete"));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage")));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid));
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("BUTTONREMOVE"), "");
     $form->addXmlnukeObject($boxButton);
     $tabview->addTabItem($this->myWords->Value("TABREMOVEUSER"), $form);
     // -------------------------------------------------------------------
     // REMOVER PAPEL DO USUARIO
     $para = new XmlParagraphCollection();
     $form = new XmlFormCollection($this->_context, $this->url, $this->myWords->Value("FORMEDITROLES"));
     $form->setJSValidate(true);
     $form->addXmlnukeObject(new XmlInputHidden("action", "removerole"));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage")));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid));
     $userroles = $users->returnUserProperty($uid, UserProperty::Role);
     $userroles = is_null($userroles) ? array() : $userroles;
     $roles = array();
     foreach ($userroles as $i) {
         $roles[$i] = $i;
     }
     $form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "role", $this->myWords->Value("FORMUSERROLES"), $roles));
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("TXT_REMOVE"), "");
     $form->addXmlnukeObject($boxButton);
     $para->addXmlnukeObject($form);
     // -------------------------------------------------------------------
     // ADICIONAR PAPEL AO USUARIO
     $form = new XmlFormCollection($this->_context, $this->url, "");
     $form->setJSValidate(true);
     $form->addXmlnukeObject(new XmlInputHidden("action", "addrole"));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage")));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid));
     //		$textbox = new XmlInputTextBox($this->myWords->Value("FORMROLES"), "role", "", 10);
     //		$textbox->setInputTextBoxType(InputTextBoxType::TEXT);
     //		$textbox->setDataType(INPUTTYPE::TEXT);
     //		$textbox->setRequired(true);
     //		$form->addXmlnukeObject($textbox);
     //		$form->addXmlnukeObject(new XmlInputLabelField("DEFAULT ROLES", "EDITOR"));
     //		$form->addXmlnukeObject(new XmlInputLabelField("", "DESIGNER"));
     //		$form->addXmlnukeObject(new XmlInputLabelField("", "MANAGER"));
     $roleData = $this->getAllRoles($users);
     $selectRole = new XmlEasyList(EasyListType::SELECTLIST, "role", $this->myWords->Value("FORMROLES"), $roleData);
     $form->addXmlnukeObject($selectRole);
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("TXT_ADD"), "");
     $form->addXmlnukeObject($boxButton);
     $para->addXmlnukeObject($form);
     $tabview->addTabItem($this->myWords->Value("TABMANROLE"), $para, $this->_action == "addrole" || $this->_action == "removerole");
     //------------------------------------------------------------------------
     // CUSTOM FIELDS
     //------------------------------------------------------------------------
     $block2 = new XmlnukeSpanCollection();
     $table = new XmlTableCollection();
     $row = new XmlTableRowCollection();
     $col = new XmlTableColumnCollection();
     $col->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ACTION"), true));
     $row->addXmlnukeObject($col);
     $col = new XmlTableColumnCollection();
     $col->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GRIDFIELD"), true));
     $row->addXmlnukeObject($col);
     $col = new XmlTableColumnCollection();
     $col->addXmlnukeObject(new XmlnukeText($this->myWords->Value("GRIDVALUE"), true));
     $row->addXmlnukeObject($col);
     $table->addXmlnukeObject($row);
     $fields = $user->getFieldNames();
     $fieldsLength = count($fields);
     foreach ($fields as $fldValue => $fldName) {
         $values = $user->getFieldArray($fldName);
         foreach ($values as $value) {
             $row = new XmlTableRowCollection();
             $col = new XmlTableColumnCollection();
             if ($fldName != $users->getUserTable()->name && $fldName != $users->getUserTable()->username && $fldName != $users->getUserTable()->email && $fldName != $users->getUserTable()->password && $fldName != $users->getUserTable()->created && $fldName != $users->getUserTable()->admin && $fldName != $users->getUserTable()->id) {
                 $href = new XmlAnchorCollection("module:Xmlnuke.Admin.ManageUsers?action=removecustomvalue&customfield=" . $fldName . "&valueid=" . $uid . "&customvalue=" . urlencode($value), "");
                 $href->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_REMOVE")));
                 $col->addXmlnukeObject($href);
             } else {
                 $col->addXmlnukeObject(new XmlnukeText("---"));
             }
             $row->addXmlnukeObject($col);
             $col = new XmlTableColumnCollection();
             $col->addXmlnukeObject(new XmlnukeText($fldName));
             $row->addXmlnukeObject($col);
             $col = new XmlTableColumnCollection();
             $col->addXmlnukeObject(new XmlnukeText($value));
             $row->addXmlnukeObject($col);
             $table->addXmlnukeObject($row);
         }
     }
     $paragraph = new XmlParagraphCollection();
     $paragraph->addXmlnukeObject($table);
     $block2->addXmlnukeObject($paragraph);
     $table = new XmlTableCollection();
     $row = new XmlTableRowCollection();
     $col = new XmlTableColumnCollection();
     $form = new XmlFormCollection($this->_context, $this->url, $this->myWords->Value("GRIDVALUE"));
     $form->setJSValidate(true);
     $form->addXmlnukeObject(new XmlInputHidden("action", "addcustomvalue"));
     $form->addXmlnukeObject(new XmlInputHidden("curpage", $this->_context->get("curpage")));
     $form->addXmlnukeObject(new XmlInputHidden("valueid", $uid));
     $textbox = new XmlInputTextBox($this->myWords->Value("FORMFIELD"), "customfield", "", 20);
     $textbox->setInputTextBoxType(InputTextBoxType::TEXT);
     $textbox->setDataType(INPUTTYPE::TEXT);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->myWords->Value("FORMVALUE"), "customvalue", "", 40);
     $textbox->setInputTextBoxType(InputTextBoxType::TEXT);
     $textbox->setDataType(INPUTTYPE::TEXT);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $boxButton = new XmlInputButtons();
     $boxButton->addSubmit($this->myWords->Value("TXT_ADD"), "");
     $form->addXmlnukeObject($boxButton);
     $col->addXmlnukeObject($form);
     $row->addXmlnukeObject($col);
     $table->addXmlnukeObject($row);
     $paragraph = new XmlParagraphCollection();
     $paragraph->addXmlnukeObject($table);
     $block2->addXmlnukeObject($paragraph);
     $tabview->addTabItem($this->myWords->Value("TABCUSTOMVALUE"), $block2, $this->_action == "addcustomvalue" || $this->_action == "removecustomvalue");
     $this->defaultXmlnukeDocument->addXmlnukeObject($block);
 }
Exemple #5
0
 /**
  * Show the form
  *
  */
 public function showForm()
 {
     $blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGFILL"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockcenter);
     $paragraph = new XmlParagraphCollection();
     $blockcenter->addXmlnukeObject($paragraph);
     $form = new XmlFormCollection($this->_context, "module:sendpage", $this->_myWords->Value("CAPTION"));
     $paragraph->addXmlnukeObject($form);
     $caption = new XmlInputCaption($this->_myWords->ValueArgs("INFO", array(urldecode($this->_link))));
     $form->addXmlnukeObject($caption);
     $hidden = new XmlInputHidden("action", "submit");
     $form->addXmlnukeObject($hidden);
     $hidden = new XmlInputHidden("link", $this->_link);
     $form->addXmlnukeObject($hidden);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDNAME"), "fromname", "", 40);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDEMAIL"), "frommail", "", 40);
     $textbox->setDataType(INPUTTYPE::EMAIL);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDTONAME"), "toname", "", 40);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $textbox = new XmlInputTextBox($this->_myWords->Value("FLDTOEMAIL"), "tomail", "", 40);
     $textbox->setDataType(INPUTTYPE::EMAIL);
     $textbox->setRequired(true);
     $form->addXmlnukeObject($textbox);
     $memo = new XmlInputMemo($this->_myWords->Value("LABEL_MESSAGE"), "custommessage", "");
     $form->addXmlnukeObject($memo);
     $form->addXmlnukeObject(new XmlInputImageValidate($this->_myWords->Value("TYPETEXTFROMIMAGE")));
     $button = new XmlInputButtons();
     $button->addSubmit($this->_myWords->Value("TXT_SUBMIT"), "");
     $form->addXmlnukeObject($button);
 }
Exemple #6
0
 /**
  *@desc
  *@param CrudField $field
  *@param string $curValue
  *@return IXmlnukeDocumentObject
  */
 public function renderField($field, $curValue)
 {
     if ($field->fieldXmlInput == XmlInputObjectType::TEXTBOX || $field->fieldXmlInput == XmlInputObjectType::PASSWORD || $field->fieldXmlInput == XmlInputObjectType::TEXTBOX_AUTOCOMPLETE) {
         //			XmlInputTextBox $itb
         $itb = new XmlInputTextBox($field->fieldCaption, $field->fieldName, $curValue, $field->size);
         $itb->setRequired($field->required);
         $itb->setRange($field->rangeMin, $field->rangeMax);
         $itb->setDescription($field->fieldCaption);
         if ($field->fieldXmlInput == XmlInputObjectType::PASSWORD) {
             $itb->setInputTextBoxType(InputTextBoxType::PASSWORD);
         } elseif ($field->fieldXmlInput == XmlInputObjectType::TEXTBOX_AUTOCOMPLETE) {
             if (!is_array($field->arraySelectList) || $field->arraySelectList["URL"] == "" || $field->arraySelectList["PARAMREQ"] == "") {
                 throw new XMLNukeException("You have to pass a array to arraySelectList field parameter with the following keys: URL, PARAMREQ. Optional: ATTRINFO, ATTRID, JSCALLBACK");
             }
             $itb->setInputTextBoxType(InputTextBoxType::TEXT);
             $itb->setAutosuggest($this->_context, $field->arraySelectList["URL"], $field->arraySelectList["PARAMREQ"], $field->arraySelectList["JSCALLBACK"]);
         } else {
             $itb->setInputTextBoxType(InputTextBoxType::TEXT);
         }
         $itb->setReadOnly($this->isReadOnly($field));
         $itb->setMaxLength($field->maxLength);
         $itb->setDataType($field->dataType);
         return $itb;
     } else {
         if ($field->fieldXmlInput == XmlInputObjectType::RADIOBUTTON || $field->fieldXmlInput == XmlInputObjectType::CHECKBOX) {
             //			XmlInputCheck $ic
             $ic = new XmlInputCheck($field->fieldCaption, $field->fieldName, $field->defaultValue);
             if ($field->fieldXmlInput == XmlInputObjectType::TEXTBOX) {
                 $ic->setType(InputCheckType::CHECKBOX);
             } else {
                 $ic->setType(InputCheckType::CHECKBOX);
             }
             $ic->setChecked($field->defaultValue == $curValue);
             $ic->setReadOnly($this->isReadOnly($field));
             return $ic;
         } else {
             if ($field->fieldXmlInput == XmlInputObjectType::MEMO) {
                 //			XmlInputMemo $im
                 $im = new XmlInputMemo($field->fieldCaption, $field->fieldName, $curValue);
                 $im->setWrap("SOFT");
                 $im->setSize(50, 8);
                 $im->setReadOnly($this->isReadOnly($field));
                 return $im;
             } else {
                 if ($field->fieldXmlInput == XmlInputObjectType::HTMLTEXT) {
                     //			XmlInputMemo $im
                     $im = new XmlInputMemo($field->fieldCaption, $field->fieldName, $curValue);
                     //$im->setWrap("SOFT");
                     //$im->setSize(50, 8);
                     $im->setVisualEditor(true);
                     $im->setReadOnly($this->isReadOnly($field));
                     return $im;
                 } else {
                     if ($field->fieldXmlInput == XmlInputObjectType::HIDDEN) {
                         //			XmlInputHidden $ih
                         $ih = new XmlInputHidden($field->fieldName, $curValue);
                         return $ih;
                     } else {
                         if ($field->fieldXmlInput == XmlInputObjectType::SELECTLIST) {
                             //			XmlEasyList $el
                             $el = new XmlEasyList(EasyListType::SELECTLIST, $field->fieldName, $field->fieldCaption, $field->arraySelectList, $curValue);
                             $el->setReadOnly($this->isReadOnly($field));
                             return $el;
                         } else {
                             if ($field->fieldXmlInput == XmlInputObjectType::DUALLIST) {
                                 $ards = new ArrayDataset($field->arraySelectList, "value");
                                 $duallist = new XmlDualList($this->_context, $field->fieldName, $this->_lang->Value("TXT_AVAILABLE", $field->fieldCaption), $this->_lang->Value("TXT_USED", $field->fieldCaption));
                                 $duallist->createDefaultButtons();
                                 $duallist->setDataSourceFieldName("key", "value");
                                 if ($curValue != "") {
                                     $ardt = explode(",", $curValue);
                                     $ardt = array_flip($ardt);
                                     foreach ($ardt as $key => $value) {
                                         $ardt[$key] = $field->arraySelectList[$key];
                                     }
                                 } else {
                                     $ardt = array();
                                 }
                                 $ards2 = new ArrayDataset($ardt, "value");
                                 $duallist->setDataSource($ards->getIterator(), $ards2->getIterator());
                                 $label = new XmlInputLabelObjects("=>");
                                 $label->addXmlnukeObject($duallist);
                                 return $label;
                             } else {
                                 if ($field->fieldXmlInput == XmlInputObjectType::DATE || $field->fieldXmlInput == XmlInputObjectType::DATETIME) {
                                     $cur = explode(" ", $curValue);
                                     if (count($cur) == 0) {
                                         $cur = array('', '');
                                     } else {
                                         if (count($cur) == 1) {
                                             $cur[] = '';
                                         }
                                     }
                                     $idt = new XmlInputDateTime($field->fieldCaption, $field->fieldName, $this->_dateFormat, $field->fieldXmlInput == XmlInputObjectType::DATETIME, $cur[0], $cur[1]);
                                     return $idt;
                                 } else {
                                     if ($field->fieldXmlInput == XmlInputObjectType::FILEUPLOAD) {
                                         $file = new XmlInputFile($field->fieldCaption, $field->fieldName);
                                         return $file;
                                     } else {
                                         //			XmlInputLabelField xlf
                                         $xlf = new XmlInputLabelField($field->fieldCaption, $curValue);
                                         return $xlf;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #7
0
 protected function Opcao14()
 {
     $block = new XmlBlockCollection("Exemplo 14: Auto Suggest", BlockPosition::Center);
     //XmlnukeBreakLine br = new XmlnukeBreakLine();
     $para = new XmlParagraphCollection();
     $para->addXmlnukeObject(new XmlnukeText("É possível associar um TextBox e uma consulta com auto sugestão de valores. Nesse exemplo, estamos consultando TODOS os links <A> existentes na página que é exibido como XML."));
     $block->addXmlnukeObject($para);
     $form = new XmlFormCollection($this->_context, "", "Teste");
     $form->addXmlnukeObject(new XmlInputCaption("Auto Suggest"));
     // First Create the the TextBox
     $txt = new XmlInputTextBox("Teste", "Nome", "");
     $txt->setRequired(true);
     // and then associate the AutoSuggest
     $txt->setAutosuggest($this->_context, "engine:xmlnuke?xml=forms&raw=json&xpath=//select", "term");
     $form->addXmlnukeObject($txt);
     $form->addXmlnukeObject(new XmlInputCaption("Auto Suggest com CallBack"));
     // First Create the the TextBox
     $txt = new XmlInputTextBox("Teste", "Nome2", "");
     $txt->setRequired(true);
     $txt->setAutosuggest($this->_context, "engine:xmlnuke?xml=forms&raw=json&xpath=//select", "term", "alert(ui.item.id + ' - ' + ui.item.value); \$(this).val(ui.item.id); ");
     $form->addXmlnukeObject($txt);
     $block->addXmlnukeObject($form);
     $this->_document->addXmlnukeObject($block);
 }