/** * * @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); } }
/** * * @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; } }
/** * * @param type $field * @param type $value * @return \ByJG\AnyDataset\Repository\SingleRow */ public static function getInfoLocaleDB($field, $value) { if (self::$_localeData == null) { $file = new \Xmlnuke\Core\Processor\AnydatasetSetupFilenameProcessor('locale'); self::$_localeData = new \ByJG\AnyDataset\Repository\AnyDataset($file->FullQualifiedNameAndPath()); } if (!isset(self::$_localeDbCache[$field])) { $filter = new \ByJG\AnyDataset\Repository\IteratorFilter(); $filter->addRelation($field, \ByJG\AnyDataset\Enum\Relation::CONTAINS, $value); $it = self::$_localeData->getIterator($filter); if ($it->hasNext()) { self::$_localeDbCache[$field] = $it->moveNext(); } else { $sr = new \ByJG\AnyDataset\Repository\SingleRow(); \Xmlnuke\Core\Engine\Context::getInstance()->WriteWarningMessage("The language {$value} was not found in locale.anydata.xml file"); $sr->AddField('name', $value . ' ???'); $sr->AddField('shortname', $value); self::$_localeDbCache[$field] = $sr; } } return self::$_localeDbCache[$field]; }
public function CreatePage() { parent::CreatePage(); // Doesnt necessary get PX, because PX is protected! $myWords = $this->WordCollection(); $forceReset = false; // Get parameters to define type of edit $catId = $this->_context->get("ci"); $type = $this->_context->get("t"); if ($type == "") { if ($this->_action == XmlnukeCrudBase::ACTION_VIEW) { $type = "FILE"; $catId = $this->_context->get("valueid"); $catIdAr = explode("|", $catId); $catId = $catIdAr[1]; $forceReset = true; } else { $type = "CATEGORY"; } } $block = new XmlBlockCollection($myWords->Value("TITLE"), BlockPosition::Center); $this->setTitlePage($myWords->Value("TITLE")); $this->setHelp($myWords->Value("DESCRIPTION")); $this->defaultXmlnukeDocument->addXmlnukeObject($block); // Download File $downloadFile = new AnydatasetFilenameProcessor("_download"); $fields = new CrudFieldCollection(); // Create Process Page Fields $field = CrudField::FactoryMinimal("TYPE", $myWords->Value("FORMTYPE"), 20, false, true); $field->key = true; $field->editable = false; $field->dataType = INPUTTYPE::UPPERASCII; $field->defaultValue = $type; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("cat_id", $myWords->Value("FORMCATEGORY"), 20, true, true); $field->key = $type == "CATEGORY"; $field->editable = $type == "CATEGORY"; $field->defaultValue = $catId; $fields->addCrudField($field); if ($type == "FILE") { $field = CrudField::FactoryMinimal("file_id", $myWords->Value("FORMFILE"), 20, true, true); $field->key = $type == "FILE"; $fields->addCrudField($field); } $field = CrudField::FactoryMinimal("name", $myWords->Value("LABEL_NAME"), 20, true, true); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("description", $myWords->Value("FORMDESCRIPTION"), 40, true, true); $field->maxLength = 500; $fields->addCrudField($field); $langs = $this->_context->LanguagesAvailable(); foreach ($langs as $key => $desc) { $field = CrudField::FactoryMinimal("name_" . $key, $myWords->Value("LABEL_NAME") . $desc, 20, false, false); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("description_" . $key, $myWords->Value("FORMDESCRIPTION") . $desc, 40, false, false); $field->maxLength = 500; $fields->addCrudField($field); } if ($type == "FILE") { $field = CrudField::FactoryMinimal("url", $myWords->Value("FORMURL"), 40, true, true); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("seemore", $myWords->Value("FORMSEEMORE"), 40, false, true); $field->maxLength = 40; $fields->addCrudField($field); $field = CrudField::FactoryMinimal("emailto", $myWords->Value("FORMEMAILTO"), 40, false, true); $field->maxLength = 50; $field->dataType = INPUTTYPE::EMAIL; $fields->addCrudField($field); } // Write custom message if ($this->_action == XmlnukeCrudBase::ACTION_LIST || $this->_action == XmlnukeCrudBase::ACTION_MSG || $forceReset) { $p = new XmlParagraphCollection(); if ($type == "CATEGORY") { $p->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTE_CATEGORY"))); } else { $href = new XmlAnchorCollection("module:Xmlnuke.Admin.download"); $href->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTE_FILE", $catId))); $p->addXmlnukeObject($href); } $block->addXmlnukeObject($p); } // Show Process Page State $itf = new IteratorFilter(); $itf->addRelation("TYPE", Relation::EQUAL, $type); if ($type == "FILE") { $itf->addRelation("cat_id", Relation::EQUAL, $catId); } $processor = new XmlnukeCrudAnydata($this->_context, $fields, $myWords->Value("TITLE_" . $type, $catId), "module:Xmlnuke.Admin.download", null, $downloadFile, $itf); if ($forceReset) { $processor->forceCurrentAction(XmlnukeCrudBase::ACTION_LIST); } if ($type == "FILE") { $processor->addParameter("t", $type); $processor->addParameter("ci", $catId); } $block->addXmlnukeObject($processor); return $this->defaultXmlnukeDocument; }
/** *@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; } } }
public function CreatePage() { parent::CreatePage(); // Doesnt necessary get PX, because PX is protected! $users = $this->getUsersDatabase(); //anydataset.SingleRow user; $action = strtolower($this->_action); $uid = $this->_context->get("valueid"); $this->myWords = $this->WordCollection(); $this->setTitlePage($this->myWords->Value("TITLE")); $this->setHelp($this->myWords->Value("DESCRIPTION")); $this->addMenuOption($this->myWords->Value("NEWUSER"), $this->url, null); $this->addMenuOption($this->myWords->Value("ADDROLE"), "module:Xmlnuke.Admin.manageusersgroups", null); // -------------------------------------- // CHECK ACTION // -------------------------------------- $exec = false; if ($action != "" && $action != "move") { $message = new XmlParagraphCollection(); if ($action == "newuser") { if (!$users->addUser($this->_context->get("name"), $this->_context->get("login"), $this->_context->get("email"), $this->_context->get("password"))) { $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("USEREXIST"), true)); } else { if ($this->isUserAdmin()) { $user = $users->getUserName($this->_context->get("login")); $user->setField($users->getUserTable()->admin, $this->_context->get("admin")); $users->Save(); } $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CREATED"), true)); } $exec = true; } if ($action == "update") { $user = $users->getById($uid); $user->setField($users->getUserTable()->name, $this->_context->get("name")); $user->setField($users->getUserTable()->email, $this->_context->get("email")); if ($this->isUserAdmin()) { $user->setField($users->getUserTable()->admin, $this->_context->get("admin")); } $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("UPDATE"), true)); $exec = true; } if ($action == "changepassword") { $user = $users->getById($uid); $user->setField($users->getUserTable()->password, $users->getSHAPassword($this->_context->get("password"))); $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CHANGEPASSWORD"), true)); $exec = true; } if ($action == "delete") { if ($users->removeUserName($uid)) { $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("DELETE"), true)); $uid = ""; } else { $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ERRO"), true)); } $exec = true; } if ($action == "addrole") { $users->addPropertyValueToUser($uid, $this->_context->get("role"), UserProperty::Role); $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ROLEADDED"), true)); $exec = true; } if ($action == "removerole") { $users->removePropertyValueFromUser($uid, $this->_context->get("role"), UserProperty::Role); $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("ROLEREMOVED"), true)); $exec = true; } if ($action == "addcustomvalue") { $users->addPropertyValueToUser($uid, $this->_context->get("customvalue"), $this->_context->get("customfield")); $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CUSTOMFIELDUPDATED"), true)); $exec = true; } if ($action == "removecustomvalue") { $users->removePropertyValueFromUser($uid, $this->_context->get("customvalue"), $this->_context->get("customfield")); $users->Save(); $message->addXmlnukeObject(new XmlnukeText($this->myWords->Value("CUSTOMFIELDREMOVED"), true)); $exec = true; } if ($exec) { $block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center); $block->addXmlnukeObject($message); $this->defaultXmlnukeDocument->addXmlnukeObject($block); } } // -------------------------------------- // LIST USERS // -------------------------------------- $block = new XmlBlockCollection($this->myWords->Value("USERS"), BlockPosition::Center); $itf = new IteratorFilter(); if (!$this->isUserAdmin()) { $itf->addRelation("admin", Relation::NOT_EQUAL, "yes"); } if ($this->_context->get("pesquser") != "") { $itf->startGroup(); $itf->addRelationOr($users->getUserTable()->username, Relation::CONTAINS, $this->_context->get("pesquser")); $itf->addRelationOr($users->getUserTable()->name, Relation::CONTAINS, $this->_context->get("pesquser")); $itf->addRelationOr($users->getUserTable()->email, Relation::CONTAINS, $this->_context->get("pesquser")); $itf->endGroup(); } $it = $users->getIterator($itf); $formpesq = new XmlFormCollection($this->_context, $this->url, $this->myWords->Value("TITLEPESQUSER")); $formpesq->setFormName("form-label-top"); $textbox = new XmlInputTextBox($this->myWords->Value("PESQUSER"), "pesquser", $this->_context->get("pesquser")); $textbox->setDataType(INPUTTYPE::TEXT); $formpesq->addXmlnukeObject($textbox); $textbox->setRequired(true); $boxButton = new XmlInputButtons(); $boxButton->addSubmit($this->myWords->Value("GOSEARCH"), ""); $formpesq->addXmlnukeObject($boxButton); $block->addXmlnukeObject($formpesq); $editlist = new XmlEditList($this->_context, $this->myWords->Value("USERS"), $this->url, true, false, true, true); $editlist->setDataSource($it); $editlist->setPageSize(20, 0); $editlist->setEnablePage(true); $field = new EditListField(); $field->fieldData = $users->getUserTable()->id; $editlist->addEditListField($field); $field = new EditListField(); $field->fieldData = $users->getUserTable()->username; $field->editlistName = $this->myWords->Value("TXT_LOGIN"); $editlist->addEditListField($field); $field = new EditListField(); $field->fieldData = $users->getUserTable()->name; $field->editlistName = $this->myWords->Value("TXT_NAME"); $editlist->addEditListField($field); $field = new EditListField(); $field->fieldData = $users->getUserTable()->email; $field->editlistName = $this->myWords->Value("TXT_EMAIL"); $editlist->addEditListField($field); $field = new EditListField(); $field->fieldData = $users->getUserTable()->admin; $field->editlistName = $this->myWords->Value("TITADM"); $editlist->addEditListField($field); $block->addXmlnukeObject($editlist); $this->defaultXmlnukeDocument->addXmlnukeObject($block); // -------------------------------------- // EDIT AREA // -------------------------------------- if ($action == "new" || $action == "newuser" || $action == "" || $action == "move" || $action == "delete") { $this->NewUser(); } else { $this->EditUser($users, $uid); } return $this->defaultXmlnukeDocument->generatePage(); }
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); } } } }
/** * Validate if the user and password exists in the file * Return SingleRow if user exists; null, otherwise * * @param string $userName User login * @param string $password Plain text password * @return SingleRow * */ public function isValidUser($userName, $password) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserTable()->username, Relation::EQUAL, strtolower($userName)); $filter->addRelation($this->getUserTable()->password, Relation::EQUAL, $this->getPasswordHash($password)); return $this->getUser($filter); }
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(); }
/** * 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; }
/** * 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); }