Beispiel #1
0
 /**
  * Enter description here...
  *
  * @param Context $context
  * @param LanguageFileTypes $type
  * @param string $name
  * @return LanguageCollection
  */
 public static function GetLanguageCollection($className, $deprecated = "")
 {
     if ($deprecated != "") {
         throw new \Xmlnuke\Core\Exception\UnsupportedFeatureException('Please fix call to GetLanguageCollection');
     }
     $langName = str_replace("\\", "-", $className);
     $langFile = new AnydatasetLangFilenameProcessor($langName);
     $lang = new LanguageCollection();
     $lang->LoadLanguages($langFile);
     return $lang;
 }
Beispiel #2
0
 /**
  * Form Roles Info
  *
  */
 protected function formRolesInfo()
 {
     $form = new XmlFormCollection($this->_context, $this->_url, $this->_myWords->Value("OTHERTITLE"));
     $this->_paragraph->addXmlnukeObject($form);
     $easyList = new XmlEasyList(EasyListType::SELECTLIST, "", $this->_myWords->Value("OTHERROLE"), $this->_users->returnUserProperty($this->_context->authenticatedUserId(), UserProperty::Role));
     $form->addXmlnukeObject($easyList);
 }
Beispiel #3
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 #4
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 #5
0
 /**
  * Show a message of the error
  *
  */
 public function showMessage()
 {
     $blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGOK"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockcenter);
     $paragraph = new XmlParagraphCollection();
     $blockcenter->addXmlnukeObject($paragraph);
     $paragraph->addXmlnukeObject(new XmlnukeText($_customMessage));
 }
Beispiel #6
0
 /**
  *@desc Contains specific instructions to generate all XML informations-> This method is processed only one time-> Usually is the last method processed->
  *@param DOMNode $current \DOMNode where the XML will be created->
  *@return void
  */
 public function generateObject($current)
 {
     // Improve Security
     $wrongway = !$this->_edit && ($this->_currentAction == self::ACTION_EDIT || $this->_currentAction == self::ACTION_EDIT_CONFIRM);
     $wrongway = $wrongway || !$this->_new && ($this->_currentAction == self::ACTION_NEW || $this->_currentAction == self::ACTION_NEW_CONFIRM);
     $wrongway = $wrongway || !$this->_delete && ($this->_currentAction == self::ACTION_DELETE || $this->_currentAction == self::ACTION_DELETE_CONFIRM);
     if ($wrongway) {
         $message = $this->_lang->Value("MSG_DONT_HAVEGRANT");
         $p = new XmlParagraphCollection();
         $p->addXmlnukeObject(new XmlnukeText($message, true, true, false));
         $p->generateObject($current);
         return;
     }
     // Checkings!
     if ($this->_context->get(self::PARAM_CANCEL) != "") {
         $this->listAllRecords()->generateObject($current);
     } else {
         if (strpos($this->_currentAction, "_confirm") !== false) {
             try {
                 $validateResult = $this->updateRecord();
             } catch (Exception $ex) {
                 $nvc = array($ex->getMessage());
                 //XmlParagraphCollection $p
                 $p = new XmlParagraphCollection();
                 $p->addXmlnukeObject(new XmlEasyList(EasyListType::UNORDEREDLIST, "Error", $this->_lang->Value("ERR_FOUND"), $nvc, ""));
                 //XmlAnchorCollection $a
                 $a = new XmlAnchorCollection("javascript:history.go(-1)", "");
                 $a->addXmlnukeObject(new XmlnukeText($this->_lang->Value("TXT_GOBACK")));
                 $p->addXmlnukeObject($a);
                 $validateResult = $p;
             }
             if (is_null($validateResult)) {
                 $this->_context->redirectUrl($this->redirProcessPage(false));
             } else {
                 $validateResult->generateObject($current);
                 if ($this->_currentAction != XmlnukeCrudBase::ACTION_NEW_CONFIRM) {
                     $this->showCurrentRecord()->generateObject($current);
                 }
             }
         } else {
             if ($this->_currentAction == self::ACTION_MSG) {
                 $this->showResultMessage()->generateObject($current);
                 $this->listAllRecords()->generateObject($current);
             } else {
                 if ($this->_currentAction == self::ACTION_NEW || $this->_currentAction == self::ACTION_VIEW || $this->_currentAction == self::ACTION_EDIT || $this->_currentAction == self::ACTION_DELETE) {
                     $this->showCurrentRecord()->generateObject($current);
                 } else {
                     $this->listAllRecords()->generateObject($current);
                 }
             }
         }
     }
 }
Beispiel #7
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 #8
0
 /**
  * Send a email with user data profile
  *
  * @param LanguageCollection $myWords
  * @param String $name
  * @param String $user
  * @param String $email
  * @param String $password
  */
 protected function sendResetPasswordMessage($myWords, $name, $user, $email, $token)
 {
     $path = $this->_context->get("SCRIPT_NAME");
     $path = substr($path, 0, strrpos($path, "/") + 1);
     $url = "http://" . $this->_context->getServerName() . $path;
     $body = $myWords->ValueArgs("RESETPASSWORDMESSAGE", array($name, $this->_context->get("SERVER_NAME"), $user, $url . $this->_context->bindModuleUrl(str_replace('\\', '.', get_class()) . '?action=' . ModuleActionLogin::RESETPASSWORD . '&username='******'&resettoken=' . $token . '&returnurl=' . $this->_login->getReturnUrl())));
     $envelope = new MailEnvelope(Util::getFullEmail($email, $name), $myWords->Value("RESETSUBJECTMESSAGE", "[" . $this->_context->getServerName() . "]"), $body);
     $envelope->Send();
 }
Beispiel #9
0
 /**
  * Action Upload
  *
  */
 protected function actionUpload()
 {
     $blockCenter = new XmlBlockCollection($this->_myWords->Value("UPLOAD"), BlockPosition::Center);
     $this->_document->addXmlnukeObject($blockCenter);
     $paragraph = new XmlParagraphCollection();
     $blockCenter->addXmlnukeObject($paragraph);
     switch ($this->_action) {
         case 'add':
             $fileProcessor = new UploadFilenameProcessor('*.*');
             $fileProcessor->setFilenameLocation(ForceFilenameLocation::DefinePath, "diretorio/subdir/");
             $result = $this->_context->processUpload($fileProcessor, false, 'form_file');
             $paragraph->addXmlnukeObject(new XmlnukeText("Arquivo " . $result[0] . " enviado com sucesso ao servidor!"));
             break;
         default:
             $paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("DESCUPLOADTEXT2")));
             $url = new XmlnukeManageUrl(URLTYPE::MODULE, $this->_url);
             $url->addParam('op', '6');
             $url->addParam('action', 'add');
             $form = new XmlFormCollection($this->_context, $url->getUrl(), $this->_myWords->Value("MAKEUPLOAD"));
             $paragraph = new XmlParagraphCollection();
             $blockCenter->addXmlnukeObject($paragraph);
             $paragraph->addXmlnukeObject($form);
             $fileField = new XmlInputFile($this->_myWords->Value("FILE"), 'form_file');
             $form->addXmlnukeObject($fileField);
             $button = new XmlInputButtons();
             $button->addSubmit($this->_myWords->Value("ADD"), "");
             $form->addXmlnukeObject($button);
             break;
     }
 }