Beispiel #1
0
 /**
  *
  * @param Context $context
  * @param string $appName
  * @param bool $saveToUser
  */
 public function __construct($appName, $saveToUser = false)
 {
     $this->_context = Context::getInstance();
     $this->_saveToUser = $saveToUser;
     $this->_appName = $appName;
     if ($saveToUser) {
         $users = $this->_context->getUsersDatabase();
         $this->_user = $users->getUserName($saveToUser);
         if ($this->_user == null) {
             throw new NotAuthenticatedException("You have to be authenticated to access this feature");
         }
     }
     $oauthFile = new AnydatasetFilenameProcessor("_oauthclient10");
     $oauthAny = new AnyDataset($oauthFile->FullQualifiedNameAndPath());
     $itf = new IteratorFilter();
     $itf->addRelation("appname", Relation::EQUAL, $appName);
     $it = $oauthAny->getIterator($itf);
     if ($it->hasNext()) {
         $sr = $it->moveNext();
         $this->_consumer_key = $sr->getField("consumer_key");
         $this->_consumer_secret = $sr->getField("consumer_secret");
         $this->_className = $sr->getField("appclass");
         $this->_extraArgs = $sr->getFieldArray("extra_arg");
     } else {
         throw new InvalidArgumentException("Cant find OAuth AppName " . $appName);
     }
 }
Beispiel #2
0
 public function testIterator()
 {
     $model = new AnyDataset();
     $model->AddField("id", 10);
     $model->AddField("name", 'Testing');
     $model->appendRow();
     $model->AddField("id", 20);
     $model->AddField("name", 'Other');
     $iterator = $model->getIterator();
     $object = new SerializerObject($iterator->toArray());
     $result = $object->build();
     $this->assertEquals([["id" => 10, "name" => "Testing"], ["id" => 20, "name" => "Other"]], $result);
 }
Beispiel #3
0
 /**
  *
  * @param string $configName
  */
 public function __construct($configName)
 {
     $file = new AnydatasetFilenameProcessor("_aws");
     $anydata = new AnyDataset($file->FullQualifiedNameAndPath());
     $itf = new IteratorFilter();
     $itf->addRelation("config", Relation::EQUAL, $configName);
     $it = $anydata->getIterator($itf);
     if ($it->hasNext()) {
         $sr = $it->moveNext();
         $this->_accessKey = $sr->getField("access-key");
         $this->_secretKey = $sr->getField("secret-key");
         $this->_extras = $sr->toArray();
         $this->_isValid = true;
     }
 }
 /**
  * @return SingleRow
  */
 public function moveNext()
 {
     if ($this->hasNext()) {
         $key = $this->_keys[$this->_currentRow];
         $cols = $this->_rows[$key];
         $any = new AnyDataset();
         $any->appendRow();
         $any->addField("__id", $this->_currentRow);
         $any->addField("__key", $key);
         foreach ($cols as $key => $value) {
             $any->addField(strtolower($key), $value);
         }
         $it = $any->getIterator(null);
         $sr = $it->moveNext();
         $this->_currentRow++;
         return $sr;
     } else {
         return null;
     }
 }
Beispiel #5
0
 public function getSerie()
 {
     return $this->_Serie->getIterator();
 }
Beispiel #6
0
 /**
  * Create Page Method
  *
  * @return PageXml
  */
 public function CreatePage()
 {
     parent::CreatePage();
     $this->_myWords = $this->WordCollection();
     $this->defaultXmlnukeDocument->addMenuItem("module:Xmlnuke.Admin.FileManagement", $this->_myWords->Value("FILEMANAGEMENT"), "");
     $this->_block = new XmlBlockCollection($this->_myWords->Value("FILEMANAGEMENT"), BlockPosition::Center);
     $this->setTitlePage($this->_myWords->Value("TITLE"));
     $this->setHelp($this->_myWords->Value("DESCRIPTION"));
     $this->defaultXmlnukeDocument->addXmlnukeObject($this->_block);
     //get the current folder
     $root = $this->_context->get("folder");
     $browser = new XmlFileBrowser($root, $this->_action, $this->_context);
     //SET FILEBROWSER ACESS LEVEL
     $processor = new AnydatasetFilenameProcessor("filemanagement");
     $processor->setFilenameLocation(ForceFilenameLocation::UseWhereExists);
     $anyDataSet = new AnyDataset($processor->FullQualifiedNameAndPath());
     $ignoreAdmin = false;
     $it = $anyDataSet->getIterator();
     while ($it->hasNext()) {
         $row = $it->moveNext();
         switch ($row->getField("type")) {
             case "INITIAL_DIR":
                 $initial_dir = $row->getFieldArray("value");
                 $browser->setSubFoldersPermitted($initial_dir);
                 break;
             case "VALID_FILE_NEW":
                 $file_new_list = $row->getFieldArray("value");
                 $browser->setFileNewList($file_new_list);
                 break;
             case "VALID_FILE_VIEW":
                 $file_view_list = $row->getFieldArray("value");
                 $browser->setFileViewList($file_view_list);
                 break;
             case "VALID_FILE_EDIT":
                 $file_edit_list = $row->getFieldArray("value");
                 $browser->setFileEditList($file_edit_list);
                 break;
             case "VALID_FILE_DELETE":
                 $file_delete_list = $row->getFieldArray("value");
                 $browser->setFileDeleteList($file_delete_list);
                 break;
             case "VALID_FILE_UPLOAD":
                 $file_upload_list = $row->getFieldArray("value");
                 $browser->setFileUploadList($file_upload_list);
                 break;
             case "VALID_FILE_MAX_UPLOAD":
                 $file_max_upload = $row->getField("value");
                 $browser->setFileMaxUpload($file_max_upload);
                 break;
             case "PERMISSION":
                 $browser->setFileNew($row->getField("file_new"));
                 $browser->setFileView($row->getField("file_view"));
                 $browser->setFileEdit($row->getField("file_edit"));
                 $browser->setFileDelete($row->getField("file_delete"));
                 $browser->setFileUpload($row->getField("file_upload"));
                 $browser->setFolderNew($row->getField("folder_new"));
                 $browser->setFolderView($row->getField("folder_view"));
                 $browser->setFolderEdit($row->getField("folder_edit"));
                 $browser->setFolderDelete($row->getField("folder_delete"));
                 $ignoreAdmin = $row->getField("ignore_admin") == "true";
                 break;
         }
     }
     if ($this->isUserAdmin() && !$ignoreAdmin) {
         $browser->setUserType(FileBrownserUserType::ADMIN);
     }
     $this->_block->addXmlnukeObject($browser);
     return $this->defaultXmlnukeDocument->generatePage();
 }
Beispiel #7
0
 /**
  * Get the user based on a filter.
  * Return SingleRow if user was found; null, otherwise
  *
  * @param IteratorFilter $filter Filter to find user
  * @return SingleRow
  * */
 public function getUser($filter)
 {
     $it = $this->getIterator($filter);
     if ($it->hasNext()) {
         // Get the Requested User
         $sr = $it->moveNext();
         $this->setCustomFieldsInUser($sr);
         // Clone the User Properties
         $anyOri = new AnyDataset();
         $anyOri->appendRow();
         foreach ($sr->getFieldNames() as $key => $fieldName) {
             $anyOri->addField($fieldName, $sr->getField($fieldName));
         }
         $itOri = $anyOri->getIterator();
         $srOri = $itOri->moveNext();
         // Store and return to the user the proper single row.
         $this->_cacheUserOriginal[$sr->getField($this->getUserTable()->id)] = $srOri;
         $this->_cacheUserWork[$sr->getField($this->getUserTable()->id)] = $sr;
         return $this->_cacheUserWork[$sr->getField($this->getUserTable()->id)];
     } else {
         return null;
     }
 }
Beispiel #8
0
 /**
  *@desc Execute the proper action to insert, update and delete $data from database.
  *@param Context $context
  *@return IXmlnukeDocumentObject $it contains all necessary XML to inform the user the operation result
  */
 public function updateRecord()
 {
     $message = "";
     //		IXmlnukeDocumentObject $mdo
     $mdo = $this->validateUpdate();
     if ($mdo != null) {
         return $mdo;
     }
     $data = new AnyDataset($this->_anydata->FullQualifiedNameAndPath());
     if ($this->_currentAction == self::ACTION_NEW_CONFIRM) {
         $data->appendRow();
         for ($i = 0, $fieldLength = sizeof($this->_fields); $i < $fieldLength; $i++) {
             $value = $this->_context->get($this->_fields[$i]->fieldName);
             if ($this->_fields[$i]->beforeInsertFormatter != null) {
                 $value = $this->_fields[$i]->beforeInsertFormatter->Format($srCurInfo, $this->_fields[$i]->fieldName, $value);
             }
             $data->addField($this->_fields[$i]->fieldName, $value);
         }
     } else {
         $itf = $this->getIteratorFilterKey();
         $it = $data->getIterator($itf);
         if ($it->hasNext()) {
             $sr = $it->moveNext();
             if ($this->_currentAction == self::ACTION_EDIT_CONFIRM) {
                 for ($i = 0, $fieldsLength = sizeof($this->_fields); $i < $fieldsLength; $i++) {
                     $value = $this->_context->get($this->_fields[$i]->fieldName);
                     if ($this->_fields[$i]->fieldXmlInput == XmlInputObjectType::FILEUPLOAD) {
                         $files = $this->_context->getUploadFileNames();
                         if ($files[$this->_fields[$i]->fieldName] == "") {
                             continue;
                         }
                         // Do nothing if none files are uploaded.
                     }
                     if ($this->_fields[$i]->beforeInsertFormatter != null) {
                         $value = $this->_fields[$i]->beforeInsertFormatter->Format($srCurInfo, $this->_fields[$i]->fieldName, $value);
                     }
                     $sr->setField($this->_fields[$i]->fieldName, $value);
                 }
             } else {
                 if ($this->_currentAction == self::ACTION_DELETE_CONFIRM) {
                     $data->removeRow($sr);
                     // Remove the Current Row;
                 }
             }
         }
     }
     $data->Save($this->_anydata);
     //XmlFormCollection $retorno = new XmlFormCollection($this->_context, $this->_module, $message);
     //$retorno->addXmlnukeObject(new XmlInputHidden("filter", $this->_filter));
     //$retorno->addXmlnukeObject(new XmlInputHidden("sort", $this->_sort));
     //$retorno->addXmlnukeObject(new XmlInputHidden("curpage", $this->_curPage->ToString()));
     //$retorno->addXmlnukeObject(new XmlInputHidden("offset", $this->_qtdRows->ToString()));
     //XmlInputButtons btnRetorno = new XmlInputButtons();
     //btnRetorno->addSubmit("Retornar", "");
     //$retorno->addXmlnukeObject(btnRetorno);
     //		XmlParagraphCollection $retorno
     return null;
 }
Beispiel #9
0
 /**
  *@param AnydatasetBaseFilenameProcessor $langFile
  *@return void
  *@desc Load Languages
  */
 public function LoadLanguages($langFile)
 {
     $all = $langFile->ToString() == "_all";
     if (!$all) {
         $this->LoadLanguages(new AnydatasetLangFilenameProcessor("_all"));
     }
     $this->_loadedFromFile = false;
     $paths = array();
     if ($langFile->getFilenameLocation() == ForceFilenameLocation::UseWhereExists || $langFile->getFilenameLocation() == ForceFilenameLocation::SharedPath) {
         $paths[] = $langFile->SharedPath();
     }
     if ($langFile->getFilenameLocation() == ForceFilenameLocation::UseWhereExists || $langFile->getFilenameLocation() == ForceFilenameLocation::PrivatePath) {
         $paths = array_merge($paths, $langFile->PrivatePath());
     }
     foreach ($paths as $path) {
         $filename = $path . $langFile->FullQualifiedName();
         $this->_debugInfo .= $langFile->ToString() . " in " . $filename . ' ';
         if (!FileUtil::Exists($filename)) {
             $this->_debugInfo .= "[Does not exists]; \n";
             continue;
         }
         $this->_debugInfo .= "[Exists]; \n";
         $curLang = strtolower($this->_context->Language()->getName());
         try {
             $lang = new AnyDataset($filename);
         } catch (Exception $e) {
             throw new EngineException('Can\'t load language file "' . $langFile->FullQualifiedName() . '"! ' . $e->getMessage());
         }
         $itf = new IteratorFilter();
         $itf->addRelation("LANGUAGE", Relation::EQUAL, $curLang);
         //AnyIterator
         $it = $lang->getIterator($itf);
         if ($it->hasNext()) {
             //SingleRow
             $sr = $it->moveNext();
             $names = $sr->getFieldNames();
             foreach ($names as $name) {
                 $this->addText($curLang, $name, $sr->getField($name));
             }
             $this->_loadedFromFile = true;
         }
     }
 }
Beispiel #10
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);
     }
 }
Beispiel #11
0
 public static function existsApp($appName)
 {
     $oauthFile = new AnydatasetFilenameProcessor("_oauthclient20");
     $oauthAny = new AnyDataset($oauthFile->FullQualifiedNameAndPath());
     $itf = new IteratorFilter();
     $itf->addRelation("appname", Relation::EQUAL, $appName);
     $it = $oauthAny->getIterator($itf);
     return $it->hasNext();
 }
Beispiel #12
0
 /**
  * Gets and array with the best content-type for the page.
  * It checks the file "contenttype.anydata.xsl" if the property "xmlnuke.CHECKCONTENTTYPE" is true
  *
  * The returned array is:
  * array(
  *   "xsl" => "",
  *   "content-type" => "",
  *   "content-disposition" => "",
  *   "extension" => ""
  * )
  *
  * @return array
  */
 public function getSuggestedContentType()
 {
     if (count($this->_contentType) == 0) {
         $this->_contentType["xsl"] = $this->getXsl();
         $this->_contentType["content-type"] = "text/html";
         $this->_contentType["content-disposition"] = "";
         $this->_contentType["extension"] = "";
         if ($this->get("xmlnuke.CHECKCONTENTTYPE")) {
             $filename = new AnydatasetFilenameProcessor("contenttype");
             $anydataset = new AnyDataset($filename->FullQualifiedNameAndPath());
             $itf = new IteratorFilter();
             $itf->addRelation("xsl", Relation::EQUAL, $this->getXsl());
             $it = $anydataset->getIterator($itf);
             if ($it->hasNext()) {
                 $sr = $it->moveNext();
                 $this->_contentType = $sr->getOriginalRawFormat();
             } else {
                 $filename = new AnydatasetSetupFilenameProcessor("contenttype");
                 $anydataset = new AnyDataset($filename->FullQualifiedNameAndPath());
                 $itf = new IteratorFilter();
                 $itf->addRelation("xsl", Relation::EQUAL, $this->getXsl());
                 $it = $anydataset->getIterator($itf);
                 if ($it->hasNext()) {
                     $sr = $it->moveNext();
                     $this->_contentType = $sr->getOriginalRawFormat();
                 }
             }
         }
     }
     return $this->_contentType;
 }
Beispiel #13
0
 /**
  * Enter description here...
  *
  */
 protected function getStringConnectionsArray()
 {
     $processor = new AnydatasetFilenameProcessor("_db");
     $processor->UseFileFromAnyLanguage();
     $anydata = new AnyDataset($processor->FullQualifiedNameAndPath());
     $it = $anydata->getIterator();
     $ret = array();
     $ret[''] = '-- Default UsersAnydataSet --';
     while ($it->hasNext()) {
         $sr = $it->moveNext();
         $ret[$sr->getField("dbname")] = $sr->getField("dbname");
     }
     return $ret;
 }
Beispiel #14
0
 public function CreatePage()
 {
     parent::CreatePage();
     // Doesnt necessary get PX, because PX is protected!
     $this->myWords = $this->WordCollection();
     $this->setTitlePage($this->myWords->Value("TITLE"));
     $this->setHelp($this->myWords->Value("DESCRIPTION"));
     $this->addMenuOption($this->myWords->Value("NEWLANGUAGEFILE"), "module:Xmlnuke.Admin.EditLanguage?action=new");
     $this->addMenuOption($this->myWords->Value("VIEWSHAREDFILES"), "module:Xmlnuke.Admin.EditLanguage?op=1");
     $this->addMenuOption($this->myWords->Value("VIEWPRIVATEFILES"), "module:Xmlnuke.Admin.EditLanguage");
     $block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center);
     $this->defaultXmlnukeDocument->addXmlnukeObject($block);
     $op = $this->_context->get("op");
     $ed = $this->_context->get("ed");
     $langDir = new AnydatasetLangFilenameProcessor("");
     if ($op == "") {
         $filelist = FileUtil::RetrieveFilesFromFolder($langDir->PrivatePath(), $langDir->Extension());
     } else {
         $filelist = FileUtil::RetrieveFilesFromFolder($langDir->SharedPath(), $langDir->Extension());
     }
     $it = $this->getIteratorFromList($filelist, $langDir);
     if ($this->_action == "") {
         $editlist = new XmlEditList($this->_context, $this->myWords->Value("FILELIST{$op}"), "module:Xmlnuke.Admin.EditLanguage", true, false, true, false);
         $field = new EditListField();
         $field->editlistName = "#";
         $field->fieldData = "key";
         $editlist->addEditListField($field);
         $field = new EditListField();
         $field->editlistName = "Language Filename";
         $field->fieldData = "singlename";
         $editlist->addEditListField($field);
         $editlist->setDataSource($it);
         $editlist->addParameter("op", $op);
         $editlist->setEnablePage(true);
         $editlist->setPageSize(20, 0);
         $block->addXmlnukeObject($editlist);
     } elseif ($this->_action == ModuleAction::Edit || $ed == 1) {
         if ($ed == 1) {
             $file = $this->_context->get("file");
         } else {
             $file = $this->_context->get("valueid");
         }
         $langDir = new AnydatasetLangFilenameProcessor($file);
         $langDir->setFilenameLocation($op == "" ? ForceFilenameLocation::PrivatePath : ForceFilenameLocation::SharedPath);
         $anydata = new AnyDataset($langDir->FullQualifiedNameAndPath());
         $it = $anydata->getIterator();
         $sr = $it->moveNext();
         $arFields = $sr->getFieldNames();
         $i = 0;
         $CrudFieldCollection = new CrudFieldCollection();
         foreach ($arFields as $value) {
             $process = CrudField::FactoryMinimal($value, $value, 40, $i < 4, true);
             $process->key = $i == 0;
             if ($value == "LANGUAGE") {
                 $process->beforeInsertFormatter = $this;
             }
             $CrudFieldCollection->addCrudField($process);
             $i++;
         }
         $crud = new XmlnukeCrudAnydata($this->_context, $CrudFieldCollection, $this->myWords->Value("EDITLANGUAGE", $file), "module:Xmlnuke.Admin.EditLanguage", null, $langDir);
         $crud->addParameter("op", $op);
         $crud->addParameter("ed", 1);
         $crud->addParameter("file", $file);
         $block->addXmlnukeObject($crud);
     } elseif ($this->_action == ModuleAction::Create) {
         $form = new XmlFormCollection($this->_context, "module:Xmlnuke.Admin.EditLanguage", $this->myWords->Value("NEWLANGUAGEFILE"));
         $form->addXmlnukeObject(new XmlInputHidden("action", ModuleAction::CreateConfirm));
         $form->addXmlnukeObject(new XmlInputHidden("op", $op));
         $form->addXmlnukeObject(new XmlInputTextBox($this->myWords->Value("NEWFILE"), "newfile", "", 30));
         $form->addXmlnukeObject(new XmlInputMemo($this->myWords->Value("FIELDS"), "fields", "TITLE\r\nABSTRACT"));
         $form->addXmlnukeObject(XmlInputButtons::CreateSubmitButton($this->myWords->Value("TXT_SUBMIT")));
         $block->addXmlnukeObject($form);
     } elseif ($this->_action == ModuleAction::CreateConfirm) {
         $file = $this->_context->get("newfile");
         $langDir = new AnydatasetLangFilenameProcessor($file);
         $langDir->setFilenameLocation($op == "" ? ForceFilenameLocation::PrivatePath : ForceFilenameLocation::SharedPath);
         $anydata = new AnyDataset($langDir->FullQualifiedNameAndPath());
         $fields = explode("\r\n", $this->_context->get("fields"));
         $langs = $this->_context->LanguagesAvailable();
         foreach ($langs as $lang => $dummy) {
             $anydata->appendRow();
             $anydata->addField("lang", $lang);
             foreach ($fields as $field) {
                 $anydata->addField($field, "");
             }
         }
         $anydata->Save($langDir);
         $this->_context->redirectUrl("module:Xmlnuke.Admin.EditLanguage?ed=1&file={$file}");
     }
     $langfile = $this->_context->get("langfile");
     $contents = $this->_context->get("contents");
     $contents = stripslashes($contents);
     return $this->defaultXmlnukeDocument;
 }
Beispiel #15
0
 /**
  * Enter description here...
  *
  * @param XmlnukeDocument $xmlnukeDoc
  */
 protected function Find()
 {
     $myWords = $this->WordCollection();
     $xmlnukeDB = $this->_context->getXMLDataBase();
     $arr = $xmlnukeDB->searchDocuments($this->txtSearch, $this->_context->get("checkAll") != "");
     $blockCenter = new XmlBlockCollection($myWords->Value("BLOCKRESULT"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockCenter);
     if ($arr == null) {
         $paragraph = new XmlParagraphCollection();
         $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTFOUND")));
         $blockCenter->addXmlnukeObject($paragraph);
     } else {
         $nodeTitleList = array("/meta/title");
         $nodeAbstractList = array("/meta/abstract");
         $configSearchFile = new AnydatasetFilenameProcessor("_configsearch");
         $configSearch = new AnyDataset($configSearchFile->FullQualifiedNameAndPath());
         $iterator = $configSearch->getIterator();
         while ($iterator->hasNext()) {
             $singleRow = $iterator->moveNext();
             $nodeTitleList[] = $sr->getField("nodetitle");
             $nodeAbstractList[] = $sr->getField("nodeabstract");
         }
         foreach ($arr as $s) {
             $singleName = FilenameProcessor::StripLanguageInfo($s);
             try {
                 $file = new XMLFilenameProcessor($singleName);
                 $docResult = $this->_context->getXMLDataBase()->getDocument($file->FullQualifiedName(), null);
                 $nodeResult = $this->getNode($nodeTitleList, $docResult);
                 $titulo = $nodeResult == null ? $myWords->Value("NOTITLE") : $nodeResult->nodeValue;
                 $nodeResult = $this->getNode($nodeAbstractList, $docResult);
                 $abstr = $nodeResult == null ? "" : $nodeResult->nodeValue;
                 $paragraph = new XmlParagraphCollection();
                 $blockCenter->addXmlnukeObject($paragraph);
                 $href = new XmlAnchorCollection("engine:xmlnuke?xml={$singleName}", "");
                 $href->addXmlnukeObject(new XmlnukeText($titulo));
                 $paragraph->addXmlnukeObject($href);
                 $paragraph->addXmlnukeObject(new XmlnukeText(" ["));
                 $href = new XmlAnchorCollection("engine:xmlnuke?xml={$singleName}&xsl=rawxml", "");
                 $href->addXmlnukeObject(new XmlnukeText($myWords->Value("VIEWXML")));
                 $paragraph->addXmlnukeObject($href);
                 $paragraph->addXmlnukeObject(new XmlnukeText("]"));
                 $paragraph->addXmlnukeObject(new XmlnukeBreakLine());
                 $paragraph->addXmlnukeObject(new XmlnukeText($abstr));
             } catch (Exception $e) {
                 $paragraph = new XmlParagraphCollection();
                 $paragraph->addXmlnukeObject(new XmlnukeText($s . " (" . $myWords->Value("NOTITLE") . ")"));
                 $blockCenter->addXmlnukeObject($paragraph);
             }
         }
         $paragraph = new XmlParagraphCollection();
         $paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("DOCFOUND", sizeof($arr))));
         $blockCenter->addXmlnukeObject($paragraph);
     }
 }
Beispiel #16
0
 /**
  * @param SQLType $sqlType
  */
 protected function ExecuteSQL($sqlType)
 {
     $fieldList = array();
     if ($sqlType != SQLType::SQL_DELETE) {
         // Get a SingleRow with all field values
         $anyCurInfo = new AnyDataset();
         $anyCurInfo->appendRow();
         foreach ($this->_fields as $field) {
             $anyCurInfo->addField($field->fieldName, $this->_context->get($field->fieldName));
         }
         $itCurInfo = $anyCurInfo->getIterator();
         $srCurInfo = $itCurInfo->moveNext();
         // Format and Adjust all field values
         foreach ($this->_fields as $field) {
             if ($field->editable) {
                 $value = $this->preProcessValue($field->fieldName, $field->dataType, $this->_context->get($field->fieldName));
                 if ($field->fieldXmlInput == XmlInputObjectType::FILEUPLOAD) {
                     $files = $this->_context->getUploadFileNames();
                     if ($files[$field->fieldName] == "") {
                         continue;
                     }
                     // Do nothing if none files are uploaded.
                 }
                 if ($field->beforeInsertFormatter != null) {
                     $value = $field->beforeInsertFormatter->Format($srCurInfo, $field->fieldName, $value);
                 }
                 $fieldList[$field->fieldName] = array(SQLFieldType::TEXT, $value);
             }
         }
     }
     $param = array();
     if ($sqlType != SQLType::SQL_INSERT) {
         $filter = $this->getWhereClause($param);
     } else {
         $filter = "";
     }
     $helper = new SQLHelper($this->_dbData);
     $helper->setFieldDelimeters($this->getFieldDeliLeft(), $this->getFieldDeliRight());
     $sql = $helper->generateSQL($this->_table, $fieldList, $param, $sqlType, $filter, $this->_decimalSeparator);
     $this->DebugInfo($sql, $param);
     $this->_dbData->execSQL($sql, $param);
 }
Beispiel #17
0
 /**
  * Get an Iterator based on a filter
  *
  * @param IteratorFilter $filter
  * @return IteratorInterface
  */
 public function getIterator($filter = null)
 {
     return $this->_anyDataSet->getIterator($filter);
 }
Beispiel #18
0
 /**
  * Add EditList to site
  *
  * @param XmlBlockCollection $this->_mainBlock
  * @param string $site
  * @param AnyDataset $dataset
  */
 protected function AddEditListToSite($block, $site, $dataset)
 {
     $para = new XmlParagraphCollection();
     $this->_mainBlock->addXmlnukeObject($para);
     $this->url->addParam("editsite", $site);
     $editList = new XmlEditList($this->_context, $this->myWords->Value("EDITLIST_TITLE", $site), $this->url->getUrl(), true, false, true, true);
     $editList->setDataSource($dataset->getIterator());
     $listField = new EditListField();
     $listField->editlistName = "";
     $listField->fieldData = "role";
     $editList->addEditListField($listField);
     $listField = new EditListField();
     $listField->editlistName = $this->myWords->Value("EDITLIST_ROLES");
     $listField->fieldData = $this->user->getRolesTable()->Role;
     $editList->addEditListField($listField);
     $listField = new EditListField();
     $listField->editlistName = $this->myWords->Value("EDITLIST_SITES");
     $listField->fieldData = $this->user->getRolesTable()->Site;
     $editList->addEditListField($listField);
     $para->addXmlnukeObject($editList);
 }
Beispiel #19
0
 public function generateObject($current)
 {
     // Is there some error?
     if ($this->_error) {
         $nodeWorking = XmlUtil::CreateChild($current, "poll");
         XmlUtil::CreateChild($nodeWorking, "error", $this->_myWords->Value("ERROR_POLLNOTSETUP"));
     } else {
         // Get Data to SHOW the answers OR chart.
         $itf = new IteratorFilter();
         $itf->addRelation("name", Relation::EQUAL, $this->_poll);
         $itf->addRelation("lang", Relation::EQUAL, $this->_lang);
         if ($this->_isdb) {
             $dbdata = new DBDataset($this->_connection);
             $param = array();
             $sql = $itf->getSql($this->_tblpoll, $param);
             $itPoll = $dbdata->getIterator($sql, $param);
             $param = array();
             $sql = $itf->getSql($this->_tblanswer, $param);
             $itAnswer = $dbdata->getIterator($sql, $param);
         } else {
             $this->getAnyData();
             $itPoll = $this->_anyPoll->getIterator($itf);
             $itAnswer = $this->_anyAnswer->getIterator($itf);
         }
         // Show the answers if not was called the method processVote()
         if (!$this->_processed) {
             $nodeWorking = XmlUtil::CreateChild($current, "poll");
             XmlUtil::AddAttribute($nodeWorking, "url", $this->_url);
             XmlUtil::AddAttribute($nodeWorking, "name", $this->_poll);
             XmlUtil::AddAttribute($nodeWorking, "lang", $this->_lang);
             // Show Data Only if Poll is active
             if ($itPoll->hasNext()) {
                 $sr = $itPoll->moveNext();
                 XmlUtil::AddAttribute($nodeWorking, "multiple", $sr->getField("multiple") == "Y" ? "true" : "false");
                 if ($sr->getField("active") == "Y") {
                     XmlUtil::AddAttribute($nodeWorking, "active", "true");
                     XmlUtil::AddAttribute($nodeWorking, "sendbtn", $this->_myWords->Value("SENDBTN"));
                     XmlUtil::CreateChild($nodeWorking, "question", $sr->getField("question"));
                     while ($itAnswer->hasNext()) {
                         $sr = $itAnswer->moveNext();
                         $nodeanswer = XmlUtil::CreateChild($nodeWorking, "answer", $sr->getField("answer"));
                         XmlUtil::AddAttribute($nodeanswer, "code", $sr->getField("code"));
                     }
                 } else {
                     XmlUtil::AddAttribute($nodeWorking, "sendbtn", $this->_myWords->Value("VIEWRESULTSBTN"));
                     XmlUtil::CreateChild($nodeWorking, "question", $sr->getField("question") . " - " . $this->_myWords->Value("POLLENDED"));
                 }
             } else {
                 XmlUtil::CreateChild($nodeWorking, "error", $this->_myWords->Value("ERROR_POLLEMPTY"));
             }
         } else {
             $srPoll = $itPoll->moveNext();
             if ($srPoll->getField("showresults") == "Y") {
                 $colors = array('#FFF8A3', '#A9CC8F', '#B2C8D9', '#BEA37A', '#F3AA79', '#B5B5A9', '#E6A5A4', '#F8D753', '#5C9746', '#3E75A7', '#7A653E', '#E1662A', '#74796F', '#C4384F', '#F0B400', '#1E6C0B', '#00488C', '#332600', '#D84000', '#434C43', '#B30023', '#FAE16B', '#82B16A', '#779DBF', '#907A52', '#EB8953', '#8A8D82', '#D6707B', '#F3C01C', '#3D8128', '#205F9A', '#63522B', '#DC5313', '#5D645A', '#BC1C39');
                 //\Xmlnuke\Util\Debug::PrintValue($itAnswer);
                 $info = array();
                 $info[] = array("column" => "answer", "type" => ChartColumnType::String, "name" => "Legend");
                 $info[] = array("column" => "votes", "type" => ChartColumnType::Number, "name" => "Value");
                 $chart = new ChartObject("");
                 $chart->setChartType(ChartType::Pie);
                 $chart->setIs3d(true);
                 $chart->setWidth($this->_width);
                 $chart->setHeight($this->_height);
                 $chart->addSeriesIterator($itAnswer, $info);
                 $object = new ObjectHandler($current, $chart, "xmlnuke");
                 $object->CreateObjectFromModel();
             } else {
                 if ($srPoll->getField("active") == "Y") {
                     $txt = new XmlnukeText($this->_myWords->Value("VOTECOMPUTED"), true);
                 } else {
                     $txt = new XmlnukeText($this->_myWords->Value("CANNOTSHOWRESULTS"), true);
                 }
                 $txt->generateObject($current);
             }
         }
     }
 }
Beispiel #20
0
 /**
  *@desc Generate $page, processing yours childs.
  *@param DOMNode $current
  *@return void
  */
 public function generateObject($current)
 {
     $nodeWorking = XmlUtil::CreateChild($current, "editlist", "");
     XmlUtil::AddAttribute($nodeWorking, "module", $this->_module);
     XmlUtil::AddAttribute($nodeWorking, "title", $this->_title);
     XmlUtil::AddAttribute($nodeWorking, "name", $this->_name);
     if ($this->_new) {
         XmlUtil::AddAttribute($nodeWorking, "new", "true");
     }
     if ($this->_edit) {
         XmlUtil::AddAttribute($nodeWorking, "edit", "true");
     }
     if ($this->_view) {
         XmlUtil::AddAttribute($nodeWorking, "view", "true");
     }
     if ($this->_delete) {
         XmlUtil::AddAttribute($nodeWorking, "delete", "true");
     }
     if ($this->_readonly) {
         XmlUtil::AddAttribute($nodeWorking, "readonly", "true");
     }
     if ($this->_selecttype == SelectType::CHECKBOX) {
         XmlUtil::AddAttribute($nodeWorking, "selecttype", "check");
     }
     if ($this->_extraParam != null) {
         foreach ($this->_extraParam as $key => $value) {
             $param = XmlUtil::CreateChild($nodeWorking, "param", "");
             XmlUtil::AddAttribute($param, "name", $key);
             XmlUtil::AddAttribute($param, "value", $value);
         }
     }
     $processor = new ParamProcessor();
     if ($this->_customButton != null) {
         for ($i = 0, $customButtonsLength = sizeof($this->_customButton); $i < $customButtonsLength; $i++) {
             //			CustomButtons $cb
             $cb = $this->_customButton[$i];
             if ($cb->enabled) {
                 $nodeButton = XmlUtil::CreateChild($nodeWorking, "button");
                 if ($cb->url != "") {
                     $cb->url = str_replace("&", "&amp;", $processor->GetFullLink($cb->url));
                 }
                 XmlUtil::AddAttribute($nodeButton, "custom", $i + 1);
                 XmlUtil::AddAttribute($nodeButton, "acao", $cb->action);
                 XmlUtil::AddAttribute($nodeButton, "alt", $cb->alternateText);
                 XmlUtil::AddAttribute($nodeButton, "url", $cb->url);
                 XmlUtil::AddAttribute($nodeButton, "img", $cb->icon);
                 XmlUtil::AddAttribute($nodeButton, "multiple", $cb->multiple);
                 XmlUtil::AddAttribute($nodeButton, "message", $cb->message);
             }
         }
     }
     $qtd = 0;
     $qtdPagina = 0;
     $page = 0;
     $started = !$this->_enablePages;
     $first = true;
     $firstRow = true;
     $summaryFields = array();
     if (!$this->_it instanceof IteratorInterface) {
         throw new InvalidArgumentException('You have to pass an IteratorInterface object to the XmlEditList');
     }
     // Generate XML With Data
     while ($this->_it->hasNext()) {
         //com.xmlnuke.anydataset.SingleRow
         $registro = $this->_it->moveNext();
         // Insert fields if none is passed.
         if (sizeof($this->_fields) == 0) {
             foreach ($registro->getFieldNames() as $key => $fieldname) {
                 $fieldtmp = new EditListField(true);
                 $fieldtmp->editlistName = $fieldname;
                 $fieldtmp->fieldData = $fieldname;
                 $fieldtmp->fieldType = EditListFieldType::TEXT;
                 $this->addEditListField($fieldtmp);
                 if (sizeof($this->_fields) == 1) {
                     $this->addEditListField($fieldtmp);
                 }
             }
         }
         // Fill values
         if ($this->_enablePages) {
             $page = intval($qtd / $this->_qtdRows) + 1;
             $started = $page == $this->_curPage;
         }
         if ($started) {
             //\DOMNode
             $row = XmlUtil::CreateChild($nodeWorking, "row", "");
             $currentNode = null;
             if (is_null($this->_fields)) {
                 throw new InvalidArgumentException("No such EditListField Object", 850);
             }
             foreach ($this->_fields as $chave => $field) {
                 if ($field->newColumn || $currentNode == null) {
                     $currentNode = XmlUtil::CreateChild($row, "field", "");
                     if ($firstRow) {
                         if (!$first) {
                             XmlUtil::AddAttribute($currentNode, "name", $field->editlistName);
                         } else {
                             $first = false;
                         }
                         XmlUtil::AddAttribute($currentNode, "source", $field->fieldData);
                     }
                 } else {
                     XmlUtil::CreateChild($currentNode, "br", "");
                 }
                 $this->renderColumn($currentNode, $registro, $field);
                 // Check if this fields requires summary
                 if ($field->summary != EditListFieldSummary::NONE) {
                     $summaryFields[$field->fieldData] += $this->_context->Language()->getDoubleVal($registro->getField($field->fieldData));
                 }
             }
             $firstRow = false;
             $qtdPagina++;
         }
         $qtd += 1;
     }
     // Generate SUMMARY Information
     if (sizeof($summaryFields) > 0) {
         $anydata = new AnyDataset();
         $anydata->appendRow();
         foreach ($this->_fields as $chave => $field) {
             switch ($field->summary) {
                 case EditListFieldSummary::SUM:
                     $value = $summaryFields[$field->fieldData];
                     break;
                 case EditListFieldSummary::AVG:
                     $value = $summaryFields[$field->fieldData] / $qtdPagina;
                     break;
                 case EditListFieldSummary::COUNT:
                     $value = $qtdPagina;
                     break;
                 default:
                     $value = "";
                     break;
             }
             $anydata->addField($field->fieldData, $value);
         }
         $ittemp = $anydata->getIterator();
         $registro = $ittemp->moveNext();
         $row = XmlUtil::CreateChild($nodeWorking, "row", "");
         XmlUtil::AddAttribute($row, "total", "true");
         foreach ($this->_fields as $chave => $field) {
             $currentNode = null;
             if ($field->newColumn || $currentNode == null) {
                 $currentNode = XmlUtil::CreateChild($row, "field", "");
             } else {
                 XmlUtil::CreateChild($currentNode, "br", "");
             }
             $this->renderColumn($currentNode, $registro, $field);
         }
     }
     // Create other properties
     XmlUtil::AddAttribute($nodeWorking, "cols", sizeof($this->_fields));
     if ($this->_enablePages) {
         if ($this->_curPage > 1) {
             XmlUtil::AddAttribute($nodeWorking, "pageback", strval($this->_curPage - 1));
         }
         if (!$started) {
             XmlUtil::AddAttribute($nodeWorking, "pagefwd", strval($this->_curPage + 1));
         }
         XmlUtil::AddAttribute($nodeWorking, "curpage", strval($this->_curPage));
         XmlUtil::AddAttribute($nodeWorking, "offset", strval($this->_qtdRows));
         XmlUtil::AddAttribute($nodeWorking, "pages", strval($page));
     }
     if ($this->_customsubmit != "") {
         XmlUtil::AddAttribute($nodeWorking, "customsubmit", $this->_customsubmit);
     }
     if (!is_null($this->_objXmlHeader)) {
         $nodeHeader = XmlUtil::CreateChild($nodeWorking, "xmlheader", "");
         $this->_objXmlHeader->generateObject($nodeHeader);
     }
     return $nodeWorking;
 }
Beispiel #21
0
 /**
  * Edit DataBase
  *
  */
 protected function actionEditDB()
 {
     $blockCenter = new XmlBlockCollection($this->_myWords->Value("DATABASE"), BlockPosition::Center);
     $breakline = new XmlnukeBreakLine();
     $paragraph = new XmlParagraphCollection();
     $paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("DATABASETEXT")));
     $paragraph->addXmlnukeObject($breakline);
     $secop = $this->_context->get("secop");
     // Menu
     $form = new XmlFormCollection($this->_context, $this->_url . "?op=5", "Menu");
     $optionlist = array();
     $optionlist[""] = "-- Selecione --";
     $optionlist["setup"] = "Configurar a Conexão";
     $optionlist["test"] = "Testar a conexão";
     $optionlist["create"] = "Create Sample Table";
     $optionlist["edit"] = "Edit Sample Table";
     $list = new XmlEasyList(EasyListType::SELECTLIST, "secop", "Selecione a Ação", $optionlist, $secop);
     $form->addXmlnukeObject($list);
     $btnmenu = new XmlInputButtons();
     $btnmenu->addSubmit("Selecionar");
     $form->addXmlnukeObject($btnmenu);
     $blockCenter->addXmlnukeObject($form);
     // Opções:
     switch ($secop) {
         case "setup":
             $formsetup = new XmlFormCollection($this->_context, $this->_url . "?op=5", "Editar Conexão");
             $formsetup->addXmlnukeObject(new XmlInputHidden("secop", "setupconf"));
             $text = new XmlInputTextBox("Connection String", "connection", "adodriver://*****:*****@server/datasource");
             $text->setRequired(true);
             $formsetup->addXmlnukeObject($text);
             $btn = new XmlInputButtons();
             $btn->addSubmit("Salvar");
             $formsetup->addXmlnukeObject($btn);
             $blockCenter->addXmlnukeObject($formsetup);
             break;
         case "setupconf":
             $filename = new AnydatasetFilenameProcessor("_db");
             $anydata = new AnyDataset($filename->FullQualifiedNameAndPath());
             $itf = new IteratorFilter();
             $itf->addRelation("dbname", Relation::EQUAL, "sampledb");
             $it = $anydata->getIterator($itf);
             if ($it->hasNext()) {
                 $sr = $it->moveNext();
                 $sr->setField("dbtype", "dsn");
                 $sr->setField("dbconnectionstring", $this->_context->get("connection"));
             } else {
                 $anydata->appendRow();
                 $anydata->addField("dbname", "sampledb");
                 $anydata->addField("dbtype", "dsn");
                 $anydata->addField("dbconnectionstring", $this->_context->get("connection"));
             }
             $anydata->Save();
             $paragraph->addXmlnukeObject(new XmlnukeText("Updated!", true));
             break;
         case "test":
             $db = new DBDataset("sampledb");
             $db->TestConnection();
             $paragraph->addXmlnukeObject(new XmlnukeText("I suppose it is fine the connection string!", true));
             break;
         case "create":
             $db = new DBDataset("sampledb");
             $sql = "create table sample (fieldkey integer, fieldname varchar(20))";
             $db->execSQL($sql);
             $db->TestConnection();
             $paragraph->addXmlnukeObject(new XmlnukeText("Table Created!", true));
             break;
         case "edit":
             // Cria um acesso a $crud
             $pageFields = new CrudFieldCollection();
             $fieldPage = new CrudField();
             $fieldPage->fieldName = "fieldkey";
             $fieldPage->key = true;
             $fieldPage->dataType = INPUTTYPE::NUMBER;
             $fieldPage->fieldCaption = "Código";
             $fieldPage->fieldXmlInput = XmlInputObjectType::TEXTBOX;
             $fieldPage->visibleInList = true;
             $fieldPage->editable = true;
             $fieldPage->required = true;
             $fieldPage->rangeMin = "100";
             $fieldPage->rangeMax = "999";
             $pageFields->addCrudField($fieldPage);
             $fieldPage = new CrudField();
             $fieldPage->fieldName = "fieldname";
             $fieldPage->key = false;
             $fieldPage->dataType = INPUTTYPE::TEXT;
             $fieldPage->fieldCaption = "Name";
             $fieldPage->fieldXmlInput = XmlInputObjectType::TEXTBOX;
             $fieldPage->visibleInList = true;
             $fieldPage->editable = true;
             $fieldPage->required = true;
             $fieldPage->maxLength = 20;
             $pageFields->addCrudField($fieldPage);
             $crud = new XmlnukeCrudDB($this->_context, $pageFields, "Edição teste usando Banco de Dados", $this->_url . "?op=5", null, "sample", "sampledb");
             $crud->setPageSize(3, 0);
             $crud->addParameter("secop", "edit");
             $paragraph->addXmlnukeObject($crud);
             break;
     }
     $blockCenter->addXmlnukeObject($paragraph);
     $this->_document->addXmlnukeObject($blockCenter);
 }