Esempio n. 1
0
 protected function GetAdminModulesList()
 {
     if ($this->_adminModulesList == null) {
         $this->_adminModulesList = array();
         // Nodes
         $rowNode = "group/module";
         $colNode = array();
         $colNode["group"] = "../@name";
         $colNode["name"] = "@name";
         $colNode["icon"] = "icon";
         $colNode["url"] = "url";
         $colNode["command"] = "@command";
         // Read from Generic XML
         $xmlProcessor = new AdminModulesXmlFilenameProcessor();
         for ($i = 0; $i < 2; $i++) {
             if ($i == 0) {
                 $xmlProcessor->setFilenameLocation(ForceFilenameLocation::SharedPath);
             } else {
                 $xmlProcessor->setFilenameLocation(ForceFilenameLocation::PrivatePath);
             }
             $configFile = $xmlProcessor->FullQualifiedNameAndPath();
             if (FileUtil::Exists($configFile)) {
                 $config = FileUtil::QuickFileRead($configFile);
                 $dataset = new XmlDataset($config, $rowNode, $colNode);
                 foreach ($dataset->getIterator() as $sr) {
                     if (array_key_exists($sr->getField("group"), $this->_adminModulesList) || $i == 0) {
                         if ($sr->getField("command") != "@hidegroup") {
                             $this->_adminModulesList[$sr->getField("group")][$sr->getField("name")] = array($sr->getField("icon"), $sr->getField("url"));
                         } else {
                             unset($this->_adminModulesList[$sr->getField("group")]);
                         }
                     } else {
                         $x = array();
                         $x[$sr->getField("group")][$sr->getField("name")] = array($sr->getField("icon"), $sr->getField("url"));
                         $this->_adminModulesList = $x + $this->_adminModulesList;
                     }
                 }
             }
         }
     }
     return $this->_adminModulesList;
 }
Esempio n. 2
0
 public function saveDocumentStream($documentName, $stream)
 {
     $xml = new DOMDocument();
     $xmlstr = FileUtil::QuickFileRead($this->_persistUtil->getFullFileName($documentName));
     $this->saveDocumentStr($documentName, $xmlstr);
 }
Esempio n. 3
0
 protected function Opcao8()
 {
     $block = new XmlBlockCollection("Exemplo 8: TextFileDataset", BlockPosition::Center);
     //XmlnukeBreakLine br = new XmlnukeBreakLine();
     $para1 = new XmlParagraphCollection();
     $txtstr = $this->_context->get("txtstr");
     $regexp = $this->_context->get("regexp");
     $colNodeStr = preg_split("/\n/", $this->_context->get("cols"));
     if ($txtstr != "") {
         $processor = new AnydatasetFilenameProcessor("sample");
         FileUtil::QuickFileWrite($processor->PathSuggested() . "sample.csv", $txtstr);
         $dataset = new TextFileDataset($processor->PathSuggested() . "sample.csv", $colNodeStr, $regexp);
         //$para1->addXmlnukeObject(new XmlnukeText(""));
         $editlist = new XmlEditList($this->_context, "Text Flat", $this->_url . "?op=8");
         $editlist->setReadOnly(true);
         $editlist->setDataSource($dataset->getIterator());
         $para1->addXmlnukeObject($editlist);
     } else {
         $processor = new AnydatasetFilenameProcessor("sample");
         $txtstr = FileUtil::QuickFileRead($processor->PathSuggested() . "sample.csv");
         $regexp = TextFileDataset::CSVFILE;
         $colNodeStr = array();
         $colNodeStr[] = "category";
         $colNodeStr[] = "title";
         $colNodeStr[] = "titlelang";
         $colNodeStr[] = "year";
         $colNodeStr[] = "price";
         $colNodeStr[] = "buyprice";
         $colNodeStr[] = "author";
     }
     // Cria um Formulário
     $form = new XmlFormCollection($this->_context, $this->_url, "Formulário de Edição");
     $form->addXmlnukeObject(new XmlInputHidden("op", "8"));
     $memo = new XmlInputMemo("Text", "txtstr", $txtstr);
     $form->addXmlnukeObject($memo);
     $text = new XmlInputTextBox("Regular Expression", "regexp", $regexp, 40);
     $text->setRequired(true);
     $form->addXmlnukeObject($text);
     $colMemo = new XmlInputMemo("Col Names", "cols", join("\n", $colNodeStr));
     $form->addXmlnukeObject($colMemo);
     $buttons = new XmlInputButtons();
     $buttons->addSubmit("Submit", "bs");
     $form->addXmlnukeObject($buttons);
     $block->addXmlnukeObject($para1);
     $block->addXmlnukeObject($form);
     $this->_document->addXmlnukeObject($block);
 }