/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $this->_genNode = XmlUtil::CreateChild($current, $this->_NODE, ""); XmlUtil::AddAttribute($this->_genNode, "id", $this->getId()); XmlUtil::AddAttribute($this->_genNode, "style", $this->getStyle()); parent::generatePage($this->_genNode); }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { XmlUtil::AddAttribute($current, "ENCTYPE", 'multipart/form-data'); $nodeWorking = XmlUtil::CreateChild($current, "file", ""); XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); XmlUtil::AddAttribute($nodeWorking, "name", $this->_name); }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $nodeWorking = XmlUtil::CreateChild($current, "imagevalidate", ""); XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); XmlUtil::AddAttribute($nodeWorking, "challengequestion", $this->_challengeQuestion); XmlUtil::AddAttribute($nodeWorking, "chars", $this->_chars); }
public function generateObject($current) { $node = XmlUtil::CreateChild($current, "faq", ""); XmlUtil::AddAttribute($node, "title", $this->_title); foreach ($this->_faqs as $key => $value) { $nodefaq = XmlUtil::CreateChild($node, "item", ""); XmlUtil::AddAttribute($nodefaq, "question", $key); $value->generateObject($nodefaq); } }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $node = XmlUtil::CreateChild($current, "external"); if ($this->_name != "") { XmlUtil::AddAttribute($node, "name", $this->_name); } XmlUtil::AddAttribute($node, "src", $this->_src); XmlUtil::AddAttribute($node, "width", $this->_width); XmlUtil::AddAttribute($node, "height", $this->_height); }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $nodeWorking = XmlUtil::CreateChild($current, "a", ""); $link = str_replace("&", "&", $this->_src); XmlUtil::AddAttribute($nodeWorking, "href", $link); if ($this->_target != "") { XmlUtil::AddAttribute($nodeWorking, "target", $this->_target); } $this->generatePage($nodeWorking); }
public function generateObject($current) { $mediaGallery = XmlUtil::CreateChild($current, "mediagallery"); XmlUtil::AddAttribute($mediaGallery, "name", $this->_name); XmlUtil::AddAttribute($mediaGallery, "api", $this->_api ? "true" : "false"); XmlUtil::AddAttribute($mediaGallery, "visible", $this->_visible ? "true" : "false"); XmlUtil::AddAttribute($mediaGallery, "showthumbcaption", $this->_showCaptionOnThumb ? "true" : "false"); $this->generatePage($mediaGallery); return $mediaGallery; }
public function generateObject($current) { $node = XmlUtil::CreateChild($current, "inputgroup", ""); XmlUtil::AddAttribute($node, "name", $this->_name); if ($this->_caption) { XmlUtil::AddAttribute($node, "caption", $this->_caption); } if ($this->_canhide) { XmlUtil::AddAttribute($node, "canhide", "true"); } if ($this->_breakline) { XmlUtil::AddAttribute($node, "breakline", "true"); } if (!$this->_visible) { XmlUtil::AddAttribute($node, "visible", "false"); } parent::generatePage($node); }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $nodeWorking = XmlUtil::CreateChild($current, "hidden", ""); XmlUtil::AddAttribute($nodeWorking, "name", $this->_name); XmlUtil::AddAttribute($nodeWorking, "value", $this->_value); }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $nodeWorking = XmlUtil::CreateChild($current, "img", ""); $link = $this->_src; XmlUtil::AddAttribute($nodeWorking, "src", $link); XmlUtil::AddAttribute($nodeWorking, "alt", $this->_alt); if (!empty($this->_id)) { XmlUtil::AddAttribute($nodeWorking, "id", $this->_id); } if ($this->_width != 0) { XmlUtil::AddAttribute($nodeWorking, "width", $this->_width); } if ($this->_height != 0) { XmlUtil::AddAttribute($nodeWorking, "height", $this->_height); } if ($this->_alternateImage != "") { XmlUtil::AddAttribute($nodeWorking, "altimage", $this->_alternateImage); } }
/** *@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("&", "&", $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; }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $node = XmlUtil::CreateChild($current, "code", $this->_text); if ($this->_title != "") { XmlUtil::AddAttribute($node, "information", $this->_title); } }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $nodeWorking = XmlUtil::CreateChild($current, "label", ""); XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); $this->generatePage($nodeWorking); }
/** * Contains specific instructions to generate all XML informations * This method is processed only one time * Usually is the last method processed * * @param DOMNode $current */ public function generateObject($current) { $nodeWorking = null; // Criando o objeto que conterá a lista switch ($this->_easyListType) { case EasyListType::CHECKBOX: XmlUtil::CreateChild($current, "caption", $this->_caption); $nodeWorking = $current; $iHid = new XmlInputHidden("qty" . $this->_name, count($this->_values)); $iHid->generateObject($nodeWorking); break; case EasyListType::RADIOBOX: XmlUtil::CreateChild($current, "caption", $this->_caption); $nodeWorking = $current; break; case EasyListType::SELECTLIST: case EasyListType::SELECTIMAGELIST: if ($this->_readOnly) { if ($this->_easyListType == EasyListType::SELECTLIST) { $deliLeft = strlen($this->_readOnlyDeli) != 0 ? $this->_readOnlyDeli[0] : ""; $deliRight = strlen($this->_readOnlyDeli) != 0 ? $this->_readOnlyDeli[1] : ""; //XmlInputHidden $xih //XmlInputLabelField $xlf $xlf = new XmlInputLabelField($this->_caption, $deliLeft . $this->_values[$this->_selected] . $deliRight); $xih = new XmlInputHidden($this->_name, $this->_selected); $xlf->generateObject($current); $xih->generateObject($current); } elseif ($this->_easyListType == EasyListType::SELECTIMAGELIST) { $img = new XmlnukeImage($this->_values[$this->_selected]); $img->generateObject($current); } return; } else { $nodeWorking = XmlUtil::CreateChild($current, "select", ""); XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); XmlUtil::AddAttribute($nodeWorking, "name", $this->_name); if ($this->_required) { XmlUtil::AddAttribute($nodeWorking, "required", "true"); } if ($this->_size > 1) { XmlUtil::AddAttribute($nodeWorking, "size", $this->_size); } if ($this->_easyListType == EasyListType::SELECTIMAGELIST) { XmlUtil::AddAttribute($nodeWorking, "imagelist", "true"); XmlUtil::AddAttribute($nodeWorking, "thumbnailsize", $this->_thumbnailSize); XmlUtil::AddAttribute($nodeWorking, "notfoundimage", $this->_notFoundImage); XmlUtil::AddAttribute($nodeWorking, "noimage", $this->_noImage); } } break; case EasyListType::UNORDEREDLIST: XmlUtil::CreateChild($current, "b", $this->_caption); $nodeWorking = XmlUtil::CreateChild($current, "ul", ""); break; } $i = 0; foreach ($this->_values as $key => $value) { switch ($this->_easyListType) { case EasyListType::CHECKBOX: // XmlInputCheck $iCk $iCk = new XmlInputCheck($value, $this->_name . $i++, $key); $iCk->setType(InputCheckType::CHECKBOX); $iCk->setChecked($key == $this->_selected); $iCk->setReadOnly($this->_readOnly); $iCk->generateObject($nodeWorking); break; case EasyListType::RADIOBOX: // XmlInputCheck $iCk $iCk = new XmlInputCheck($value, $this->_name, $key); $iCk->setType(InputCheckType::RADIOBOX); $iCk->setChecked($key == $this->_selected); $iCk->setReadOnly($this->_readOnly); $iCk->generateObject($nodeWorking); break; case EasyListType::SELECTLIST: case EasyListType::SELECTIMAGELIST: $node = XmlUtil::CreateChild($nodeWorking, "option", ""); XmlUtil::AddAttribute($node, "value", $key); if ($key == $this->_selected) { XmlUtil::AddAttribute($node, "selected", "yes"); } XmlUtil::AddTextNode($node, $value); break; case EasyListType::UNORDEREDLIST: XmlUtil::CreateChild($nodeWorking, "li", $value); break; } } }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { $nodeWorking = XmlUtil::CreateChild($current, "editform", ""); XmlUtil::AddAttribute($nodeWorking, "action", $this->_action); XmlUtil::AddAttribute($nodeWorking, "title", $this->_title); XmlUtil::AddAttribute($nodeWorking, "name", $this->_formname); if ($this->_target != "") { XmlUtil::AddAttribute($nodeWorking, "target", $this->_target); } if ($this->_jsValidate) { XmlUtil::AddAttribute($nodeWorking, "jsvalidate", "true"); XmlUtil::AddAttribute($nodeWorking, "decimalseparator", $this->_decimalSeparator); XmlUtil::AddAttribute($nodeWorking, "dateformat", $this->_dateformat); $this->_customSubmit .= ($this->_customSubmit != "" ? " && " : "") . $this->_formname . "_checksubmit()"; } if ($this->_ajaxcallback != null) { $ajaxId = $this->_ajaxcallback->getId(); $this->_customSubmit .= ($this->_customSubmit != "" ? " && " : "") . "AIM.submit(this, {'onStart' : startCallback{$ajaxId}, 'onComplete' : completeCallback{$ajaxId}})"; } if ($this->_customSubmit != "") { XmlUtil::AddAttribute($nodeWorking, "customsubmit", $this->_customSubmit); } if ($this->_disableAutoComplete) { XmlUtil::AddAttribute($nodeWorking, "autocomplete", "off"); } $this->generatePage($nodeWorking); }
public function generateObject($current) { $node = XmlUtil::CreateChild($current, "flash", ""); XmlUtil::AddAttribute($node, "major", $this->_majorVersion); XmlUtil::AddAttribute($node, "minor", $this->_minorVersion); XmlUtil::AddAttribute($node, "revision", $this->_revision); if ($this->_movie != "") { XmlUtil::AddAttribute($node, "movie", $this->getMovie()); } if ($this->_width != "") { XmlUtil::AddAttribute($node, "width", $this->getWidth()); } if ($this->_height != "") { XmlUtil::AddAttribute($node, "height", $this->getHeight()); } foreach ($this->_extraParams as $key => $value) { $param = XmlUtil::CreateChild($node, "param"); XmlUtil::AddAttribute($param, "name", $key); XmlUtil::AddAttribute($param, "value", str_replace("&", "&", $value)); } parent::generatePage($node); }
public function generateObject($current) { $editForm = $current; while ($editForm != null && $editForm->tagName != "editform") { $editForm = $editForm->parentNode; } if ($editForm == null) { throw new InvalidArgumentException("XmlInputSortableList must be inside a XmlFormCollection"); } $node = XmlUtil::CreateChild($current, "sortablelist", ""); XmlUtil::AddAttribute($node, "name", $this->_name); XmlUtil::AddAttribute($node, "caption", $this->_caption); XmlUtil::AddAttribute($node, "connectkey", $this->getConnectKey()); XmlUtil::AddAttribute($node, "columns", $this->_columns); XmlUtil::AddAttribute($node, "fullsize", $this->_fullSize ? "true" : "false"); foreach ($this->_items as $index => $column) { $columnNode = XmlUtil::CreateChild($node, "column", ""); XmlUtil::AddAttribute($columnNode, "id", $index); foreach ($column as $key => $value) { $info = explode("|", $key); $nodeitem = XmlUtil::CreateChild($columnNode, "item", ""); XmlUtil::AddAttribute($nodeitem, "key", $info[0]); XmlUtil::AddAttribute($nodeitem, "state", $info[1]); if (is_array($value)) { XmlUtil::AddAttribute($nodeitem, "title", $value[0]); $value[1]->generateObject($nodeitem); } else { $value->generateObject($nodeitem); } } } }
/** *@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 *@return void */ public function generateObject($current) { $objBoxButtons = XmlUtil::CreateChild($current, "buttons", ""); $clickEvent = ""; foreach ($this->_values as $button) { // InputButton $button if ($button->buttonType == ButtonType::CLICKEVENT) { $clickEvent .= ($clickEvent == "" ? "" : "|") . $button->name; } $nodeWorking = null; switch ($button->buttonType) { case ButtonType::CLICKEVENT: case ButtonType::SUBMIT: $nodeWorking = XmlUtil::CreateChild($objBoxButtons, "submit", ""); break; case ButtonType::RESET: $nodeWorking = XmlUtil::CreateChild($objBoxButtons, "reset", ""); break; case ButtonType::BUTTON: $nodeWorking = XmlUtil::CreateChild($objBoxButtons, "button", ""); XmlUtil::AddAttribute($nodeWorking, "onclick", $button->onClick); break; } XmlUtil::AddAttribute($nodeWorking, "caption", $button->caption); XmlUtil::AddAttribute($nodeWorking, "name", $button->name); } // Add Click Event $clickEventNode = XmlUtil::selectSingleNode($current, "clickevent"); if (is_null($clickEventNode)) { $clickEventNode = XmlUtil::CreateChild($current, "clickevent", $clickEvent); } else { $clickEventNode->nodeValue = $clickEventNode->nodeValue . "|" . $clickEvent; } }
public function addFlash($movie, $width, $height) { $nodeWorking = XmlUtil::CreateChild($this->_nodePage, "script", ""); XmlUtil::AddAttribute($nodeWorking, "movie", $movie); XmlUtil::AddAttribute($nodeWorking, "width", (string) $width); XmlUtil::AddAttribute($nodeWorking, "height", (string) $height); }
public function generateObject($current) { $node = XmlUtil::CreateChild($current, "tabview", ""); foreach ($this->_tabs as $key => $value) { $title = $value[0]; $type = $value[1]; $content = $value[2]; $nodetab = XmlUtil::CreateChild($node, "tabitem", ""); XmlUtil::AddAttribute($nodetab, "title", $title); if ($this->_tabDefault == $key) { XmlUtil::AddAttribute($nodetab, "default", "true"); } if ($type == "OBJ") { $content->generateObject($nodetab); } else { XmlUtil::AddAttribute($nodetab, "url", $content); } } }
/** * @desc Generate page, processing yours childs. * @param DOMNode $current * @return void */ public function generateObject($current) { $datetimebox = XmlUtil::CreateChild($current, "datetimebox"); $date = DateUtil::TimeStampFromStr($this->_date, $this->_dateformat); XmlUtil::AddAttribute($datetimebox, "name", $this->_name); XmlUtil::AddAttribute($datetimebox, "caption", $this->_caption); XmlUtil::AddAttribute($datetimebox, "day", date('j', $date)); // Day without leading zeros XmlUtil::AddAttribute($datetimebox, "month", date('n', $date)); // Month without leading zeros XmlUtil::AddAttribute($datetimebox, "year", date('Y', $date)); XmlUtil::AddAttribute($datetimebox, "dateformat", INPUTTYPE::DATE); XmlUtil::AddAttribute($datetimebox, "date", $this->_date); if ($this->_showHour) { $time = explode(":", $this->_time); XmlUtil::AddAttribute($datetimebox, "showhour", "true"); XmlUtil::AddAttribute($datetimebox, "hour", $this->removeLeadingZero($time[0])); // Hour without leading zeros XmlUtil::AddAttribute($datetimebox, "minute", $this->removeLeadingZero($time[1])); } XmlUtil::AddAttribute($datetimebox, "yearmin", $this->_yearmin); XmlUtil::AddAttribute($datetimebox, "yearmax", $this->_yearmax); XmlUtil::AddAttribute($datetimebox, "showday", $this->_showDay ? 'true' : 'false'); }
/** *@desc Generate page, processing yours childs using the parent. *@return DOMDocument */ public function makeDomObject() { $created = date("d/M/y h:m:s"); $createdTimeStamp = microtime(true); $xmlDoc = XmlUtil::CreateXmlDocument(); // Create the First first NODE ELEMENT! $nodePage = $xmlDoc->createElement("page"); $xmlDoc->appendChild($nodePage); // Create the META node $nodeMeta = XmlUtil::CreateChild($nodePage, "meta", ""); XmlUtil::CreateChild($nodeMeta, "title", $this->_pageTitle); XmlUtil::CreateChild($nodeMeta, "abstract", $this->_abstract); XmlUtil::CreateChild($nodeMeta, "keyword", $this->_keyword); XmlUtil::CreateChild($nodeMeta, "groupkeyword", $this->_groupKeyword); foreach ($this->_metaTag as $key => $value) { XmlUtil::CreateChild($nodeMeta, $key, $value); } // Create MENU (if exists some elements in menu). foreach ($this->_menuGroup as $key => $menuGroup) { if (sizeof($menuGroup->menus) > 0) { $nodeGroup = XmlUtil::CreateChild($nodePage, "group", ""); XmlUtil::CreateChild($nodeGroup, "id", $key); XmlUtil::CreateChild($nodeGroup, "title", $menuGroup->menuTitle); XmlUtil::CreateChild($nodeGroup, "keyword", "all"); foreach ($menuGroup->menus as $item) { $nodeWorking = XmlUtil::CreateChild($nodeGroup, "page", ""); XmlUtil::CreateChild($nodeWorking, "id", $item->id); XmlUtil::CreateChild($nodeWorking, "title", $item->title); XmlUtil::CreateChild($nodeWorking, "summary", $item->summary); if ($item->icon != "") { XmlUtil::CreateChild($nodeWorking, "icon", $item->icon); } } } } // Add Custom JS if (!$this->_disableButtonsOnSubmit) { $this->addJavaScriptSource("var XMLNUKE_DISABLEBUTTON = false;\n", false); } if ($this->_waitLoading) { $this->addJavaScriptSource("var XMLNUKE_WAITLOADING = true;\n", false); } // Generate Scripts if (!is_null($this->_scripts)) { foreach ($this->_scripts as $script) { $nodeWorking = XmlUtil::CreateChild($nodePage, "script", ""); XmlUtil::AddAttribute($nodeWorking, "language", "javascript"); if (!is_null($script->source)) { XmlUtil::AddTextNode($nodeWorking, $script->source, true); } if (!is_null($script->file)) { XmlUtil::AddAttribute($nodeWorking, "src", $script->file); } XmlUtil::AddAttribute($nodeWorking, "location", $script->location); } } // Process ALL XmlnukeDocumentObject existing in Collection. //---------------------------------------------------------- parent::generatePage($nodePage); //---------------------------------------------------------- // Finalize the Create Page Execution XmlUtil::CreateChild($nodeMeta, "created", $created); XmlUtil::CreateChild($nodeMeta, "modified", date("d/M/y h:m:s")); $elapsed = microtime(true) - $createdTimeStamp; XmlUtil::CreateChild($nodeMeta, "timeelapsed", intval($elapsed / 3600) . ":" . intval($elapsed / 60) % 60 . ":" . $elapsed % 60 . "." . substr(intval(($elapsed - intval($elapsed)) * 1000) / 1000, 2)); XmlUtil::CreateChild($nodeMeta, "timeelapsedsec", $elapsed); return $xmlDoc; }
/** *@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 *@return void */ public function generateObject($current) { if ($this->_readonly) { // XmlInputLabelField ic $ic = new XmlInputLabelField($this->_caption, $this->_value); $ic->generateObject($current); // XmlInputHidden $ih $ih = new XmlInputHidden($this->_name, $this->_value); $ih->generateObject($current); } else { $nodeWorking = XmlUtil::CreateChild($current, "memo", ""); XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); XmlUtil::AddAttribute($nodeWorking, "name", $this->_name); XmlUtil::AddAttribute($nodeWorking, "cols", $this->_cols); XmlUtil::AddAttribute($nodeWorking, "rows", $this->_rows); XmlUtil::AddAttribute($nodeWorking, "wrap", $this->_wrap); if ($this->_visualEditor) { XmlUtil::AddAttribute($nodeWorking, "visualedit", "true"); XmlUtil::AddAttribute($nodeWorking, "visualeditbasehref", $this->_visualEditorBaseHref); } elseif ($this->_maxLength > 0) { XmlUtil::AddAttribute($nodeWorking, "maxlength", $this->_maxLength); } XmlUtil::AddTextNode($nodeWorking, $this->_value); } }
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); } } } }
public function generateObject($current) { $node = XmlUtil::CreateChild($current, "progressbar", ""); XmlUtil::AddAttribute($node, "name", $this->_name); XmlUtil::AddAttribute($node, "value", $this->_value); }
public function generateObject($current) { $node = XmlUtil::CreateChild($current, "uialert", ""); XmlUtil::AddAttribute($node, "type", $this->_uialert); XmlUtil::AddAttribute($node, "name", $this->_name); XmlUtil::AddAttribute($node, "title", $this->_title); if ($this->_autoHide > 0) { XmlUtil::AddAttribute($node, "autohide", $this->_autoHide); } if ($this->_openAction) { XmlUtil::AddAttribute($node, "openaction", $this->_openAction); XmlUtil::AddAttribute($node, "openactiontext", $this->_openActionText); } if ($this->_width > 0) { XmlUtil::AddAttribute($node, "width", $this->_width); } if ($this->_height > 0) { XmlUtil::AddAttribute($node, "height", $this->_height); } foreach ($this->_buttons as $key => $value) { $btn = XmlUtil::CreateChild($node, "button", $value); XmlUtil::AddAttribute($btn, "text", $key); } $body = XmlUtil::CreateChild($node, "body"); parent::generatePage($body); }
/** *@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 *@return void */ public function generateObject($current) { if ($this->_readonly) { // XmlInputLabelField $ic; if ($this->_checked) { // XmlInputHidden $ih $ih = new XmlInputHidden($this->_name, $this->_value); $ic = new XmlInputLabelField($this->_caption, "[X]"); $ih->generateObject($current); } else { $ic = new XmlInputLabelField($this->_caption, "[ ]"); } $ic->generateObject($current); } else { // XmlNode $nodeWorking; if ($this->_inputCheckType == InputCheckType::CHECKBOX) { $nodeWorking = XmlUtil::CreateChild($current, "checkbox", ""); } else { $nodeWorking = XmlUtil::CreateChild($current, "radiobox", ""); } XmlUtil::AddAttribute($nodeWorking, "caption", $this->_caption); XmlUtil::AddAttribute($nodeWorking, "name", $this->_name); XmlUtil::AddAttribute($nodeWorking, "value", $this->_value); if ($this->_checked) { XmlUtil::AddAttribute($nodeWorking, "selected", "yes"); } } }
/** *@desc Transform an XMLDocument object with an XSLFile *@param DOMDocument $xml *@param XSLFilenameProcessor $xslFile XSL File *@return string - The transformation string */ public function TransformDocument($xml, $xslFile) { // Add a custom XML based on attribute xmlobjet inside root // Example: // <page xmlobject="plugin.name(param1, param2)"> $pattern = "/(?P<plugin>.*?)\\s*\\((?P<param>([#']?.*?[#']?\\s*,?\\s*)+)?\\)/"; $xmlRoot = $xml->documentElement; $xmlRootAttributes = $xmlRoot->attributes; if ($xmlRootAttributes != null) { foreach ($xmlRootAttributes as $attr) { if ($attr->nodeName == "xmlobject") { $match = preg_match_all($pattern, $attr->value, $matches); for ($iCount = 0; $iCount < $match; $iCount++) { $param = explode(",", $matches["param"][$iCount]); for ($i = 0; $i <= 4; $i++) { if (count($param) < $i + 1) { $param[] = null; } elseif ($param[$i] == "#CONTEXT#") { $param[$i] = $this->_context; } else { $param[$i] = trim($param[$i]); } } $className = str_replace('.', '\\', $matches["plugin"][$iCount]); if ($className[0] != '\\') { $className = "\\{$className}"; } $plugin = new $className($param[0], $param[1], $param[2], $param[3], $param[4]); if ($plugin instanceof IXmlnukeDocumentObject) { $plugin->generateObject($xmlRoot); } else { $handler = new ObjectHandler($xmlRoot, $plugin); $handler->CreateObjectFromModel(); } } } else { if ($attr->nodeName == 'xsl') { $xslFile = new XSLFilenameProcessor($attr->value); } } } } // Check if there is no XSL template if ($this->_outputResult != OutputData::Xslt) { if ($this->_extractNodes == "") { $outDocument = $xml; } else { $nodes = XmlUtil::selectNodes($xml->documentElement, "/" . $this->_extractNodes); $retDocument = XmlUtil::CreateXmlDocumentFromStr("<" . $this->_extractNodesRoot . "/>", false); $nodeRoot = $retDocument->documentElement; XmlUtil::AddAttribute($nodeRoot, "xpath", $this->_extractNodes); foreach ($nodes as $node) { $nodeToAdd = XmlUtil::CreateChild($nodeRoot, $node->nodeName, ""); $attributes = $node->attributes; foreach ($attributes as $value) { XmlUtil::AddAttribute($nodeToAdd, $value->nodeName, $value->nodeValue); } XmlUtil::AddNodeFromNode($nodeToAdd, $node); } $outDocument = $retDocument; } if ($this->_outputResult == OutputData::Json) { return ObjectHandler::xml2json($outDocument, $this->_extraParams["json_function"]); } else { return $outDocument->saveXML(); } } $this->_context->setXsl($xslFile->ToString()); // Set up a transform object with the XSLT file //XslTransform xslTran = new XslTransform(); $xslTran = new XSLTProcessor(); $snippetProcessor = new SnippetProcessor($xslFile); //Uri try { $uri = $snippetProcessor->getUriFromXsl($xslFile, $this->_context); } catch (XMLNukeException $ex) { throw new EngineException("Cannot load XSL file. The following error occured: " . $ex->getMessage(), 751); } //Process smipets and put teh xsl StyleShet try { $xsl = $snippetProcessor->IncludeSnippet($uri); } catch (XMLNukeException $ex) { throw new EngineException("Cannot load XSL cache file. The following error occured: " . $ex->getMessage(), 752); } $xsl = FileUtil::fixUTF8($xsl); $xslDom = new DOMDocument(); $xslDom->loadXML($xsl); $xslTran->importStyleSheet($xslDom); // Create Argument List $xslTran->setParameter("", "xml", $this->_context->getXml()); $xslTran->setParameter("", "xsl", $this->_context->getXsl()); $xslTran->setParameter("", "site", '_all'); $xslTran->setParameter("", "lang", $this->_context->Language()->getName()); $xslTran->setParameter("", "module", $this->_context->getModule()); $xslTran->setParameter("", "transformdate", date("Y-m-d H:i:s")); $xslTran->setParameter("", "urlbase", $this->_context->get("xmlnuke.URLBASE")); $xslTran->setParameter("", "engine", "PHP"); $xslTran->setParameter("", "url", $this->_context->getServerName(false, true) . $this->_context->get('REQUEST_URI')); //Transform and output $xtw = $xslTran->transformToXML($xml); $xhtml = new DOMDocument(); $xhtml->loadXML($xtw); // Reload XHTML result to process PARAM and HREFs $paramProcessor = new ParamProcessor(); $paramProcessor->AdjustToFullLink($xhtml, "A", "HREF"); $paramProcessor->AdjustToFullLink($xhtml, "FORM", "ACTION"); $paramProcessor->AdjustToFullLink($xhtml, "AREA", "HREF"); $paramProcessor->AdjustToFullLink($xhtml, "LINK", "HREF"); if ($this->_context->get("xmlnuke.ENABLEPARAMPROCESSOR")) { $paramProcessor->ProcessParameters($xhtml); } // ATENCAO: O codigo gerado pelo saveXML faz com que elementos vazios sejam // comprimidos. Exemplo: <table /> // para o HTML isso eh ruim. Logo o metodo deve ser saveHTML que deixa o tag // assim: <table></table> $arrCt = $this->_context->getSuggestedContentType(); if ($arrCt["content-type"] == "text/html") { return FileUtil::fixUTF8(strtr($xhtml->saveHTML(), array("></br>" => "/>"))); } else { return FileUtil::fixUTF8($xhtml->saveXML()); } }
/** *@desc Generate page, processing yours childs. *@param DOMNode $current *@return void */ public function generateObject($current) { XmlUtil::AddAttribute($current, "required", $this->_required ? "true" : "false"); XmlUtil::AddAttribute($current, "type", $this->_inputtype); if ($this->_minvalue != "") { XmlUtil::AddAttribute($current, "minvalue", $this->_minvalue); } if ($this->_maxvalue != "") { XmlUtil::AddAttribute($current, "maxvalue", $this->_maxvalue); } if ($this->_description != "") { XmlUtil::AddAttribute($current, "description", $this->_description); } if ($this->_customjs != "") { XmlUtil::AddAttribute($current, "customjs", $this->_customjs); } }
/** * Make a buttom * * @param DualListButton $button * @param string $name * @param DOMNode $duallist * @param string $from * @param string $to * @param string $all */ private function makeButton($button, $name, $duallist, $from, $to, $all) { $newbutton = XmlUtil::CreateChild($duallist, "button", ""); XmlUtil::AddAttribute($newbutton, "name", $name); if ($button->type == DualListButtonType::Image) { XmlUtil::AddAttribute($newbutton, "type", "image"); XmlUtil::AddAttribute($newbutton, "src", $button->href); XmlUtil::AddAttribute($newbutton, "value", $button->text); } else { XmlUtil::AddAttribute($newbutton, "type", "button"); XmlUtil::AddAttribute($newbutton, "value", $button->text); } XmlUtil::AddAttribute($newbutton, "from", $from); XmlUtil::AddAttribute($newbutton, "to", $to); XmlUtil::AddAttribute($newbutton, "all", $all); }