public function CreatePage() { parent::CreatePage(); $onlyGroup = $this->_context->get("onlygroup") != ""; $urlXml = "module:Xmlnuke.Admin.ManageXML"; $urlGrp = "module:Xmlnuke.Admin.ManageGroup"; $this->myWords = $this->WordCollection(); $this->setTitlePage($this->myWords->Value("TITLE")); $this->setHelp($this->myWords->Value("DESCRIPTION")); if (!$onlyGroup) { $this->addMenuOption($this->myWords->Value("EDITALLXML"), $urlXml . "?id=_all"); $this->addMenuOption($this->myWords->Value("NEWXML"), $urlXml); } $this->addMenuOption($this->myWords->Value("NEWGROUP"), $urlGrp); // Open Index File $indexFile = new XMLFilenameProcessor("index"); //XmlDocument $index = $this->_context->getXMLDataBase()->getDocument($indexFile->FullQualifiedName(), null); $groupList = XmlUtil::SelectNodes($index->documentElement, "group"); $table = new XmlTableCollection(); foreach ($groupList as $node) { $groupText = XmlUtil::SelectSingleNode($node, "title")->nodeValue; $groupId = XmlUtil::SelectSingleNode($node, "id")->nodeValue; $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlGrp . "?id=" . $groupId, ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_EDIT"), true, false, false)); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlGrp . "?id=" . $groupId . "&action=delete", ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_DELETE"), true, false, false)); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($groupText, true, false, false)); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); if (!$onlyGroup) { $fileList = XmlUtil::SelectNodes($index->documentElement, "group[id='" . $groupId . "']/page"); foreach ($fileList as $nodeFile) { $fileText = XmlUtil::SelectSingleNode($nodeFile, "title")->nodeValue; $fileId = XmlUtil::SelectSingleNode($nodeFile, "id")->nodeValue; $fileAbstract = XmlUtil::SelectSingleNode($nodeFile, "summary")->nodeValue; $row = new XmlTableRowCollection(); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlXml . "?id=" . $fileId, ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_EDIT"))); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $anchor = new XmlAnchorCollection($urlXml . "?id=" . $fileId . "&action=delete", ""); $anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_DELETE"))); $col->addXmlnukeObject($anchor); $row->addXmlnukeObject($col); $col = new XmlTableColumnCollection(); $col->addXmlnukeObject(new XmlnukeText($fileText)); $col->addXmlnukeObject(new XmlnukeBreakLine()); $col->addXmlnukeObject(new XmlnukeText($fileAbstract, false, true, false)); $row->addXmlnukeObject($col); $table->addXmlnukeObject($row); } } } $block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center); $paragraph = new XmlParagraphCollection(); $paragraph->addXmlnukeObject($table); $block->addXmlnukeObject($paragraph); $this->defaultXmlnukeDocument->addXmlnukeObject($block); return $this->defaultXmlnukeDocument->generatePage(); }
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); }