Exemple #1
0
 /**
  * Render Column
  *
  * @param DOMNode $column
  * @param SingleRow $row
  * @param EditListField $field
  */
 public function renderColumn($column, $row, $field)
 {
     switch ($field->fieldType) {
         case EditListFieldType::TEXT:
             XmlUtil::AddTextNode($column, $row->getField($field->fieldData));
             break;
         case EditListFieldType::IMAGE:
             //				XmlnukeImage $xmi
             $xmi = new XmlnukeImage($row->getField($field->fieldData));
             $xmi->generateObject($column);
             break;
         case EditListFieldType::LOOKUP:
             $value = $row->getField($field->fieldData);
             if ($value == "") {
                 $value = "---";
             } else {
                 $value = isset($field->arrayLookup[$value]) ? $field->arrayLookup[$value] : "[{$value} ?]";
             }
             XmlUtil::AddTextNode($column, $value);
             break;
         case EditListFieldType::FORMATTER:
             $obj = $field->formatter;
             if (is_null($obj) || !$obj instanceof IEditListFormatter) {
                 throw new InvalidArgumentException("The EditListFieldType::FORMATTER requires a valid IEditListFormatter class");
             } else {
                 XmlUtil::AddTextNode($column, $obj->Format($row, $field->fieldData, $row->getField($field->fieldData)));
             }
             break;
         default:
             XmlUtil::AddTextNode($column, $row->getField($field->fieldData));
             break;
     }
 }
Exemple #2
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
  *@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);
     }
 }
Exemple #3
0
 public function addJavaScript($javascript, $location = 'up')
 {
     $nodeWorking = XmlUtil::CreateChild($this->_nodePage, "script", "");
     XmlUtil::AddAttribute($nodeWorking, "language", "javascript");
     XmlUtil::AddAttribute($nodeWorking, "location", $location);
     XmlUtil::AddTextNode($nodeWorking, $javascript);
 }
Exemple #4
0
 /**
  *@desc Generate page, processing yours childs.
  *@param DOMNode $current
  *@return void
  */
 public function generateObject($current)
 {
     $node = $current;
     if ($this->_bold) {
         $node = XmlUtil::CreateChild($node, "b", "");
     }
     if ($this->_italic) {
         $node = XmlUtil::CreateChild($node, "i", "");
     }
     if ($this->_underline) {
         $node = XmlUtil::CreateChild($node, "u", "");
     }
     XmlUtil::AddTextNode($node, $this->_text);
     if ($this->_breakline) {
         XmlUtil::CreateChild($node, "br", "");
     }
 }
Exemple #5
0
 /**
  *  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;
         }
     }
 }
Exemple #6
0
 /**
  *@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;
 }