コード例 #1
0
 /**
  * Draws the control, or the default text area if a setup file is not found
  *
  * @param  string   $tag_path           The XML path to the params (by default 'params')
  * @param  string   $grand_parent_path  [optional] First find as grand-parent that node (if exists)
  * @param  string   $parent_tag         [optional] Then find as parent that node (if exists)
  * @param  string   $parent_attr        [optional] but parent with that attribute having
  * @param  string   $parent_attrvalue   [optional] that value
  * @param  string   $control_name       The control name (by default 'params')
  * @param  boolean  $paramstextarea     If there are no params XML descriptor should params be represented just as a textarea of the raw params (to avoid loosing them) ?
  * @param  string   $viewType           View type ( 'view', 'param', 'depends': means: <param> tag => param, <field> tag => view )
  * @param  string   $htmlFormatting     HTML formatting type for params ( 'table', 'td', 'none', 'fieldsListArray' )
  * @return string|array                 HTML or values if $htmlFormatting = 'fieldsListArray'
  */
 function draw($tag_path = 'params', $grand_parent_path = null, $parent_tag = null, $parent_attr = null, $parent_attrvalue = null, $control_name = 'params', $paramstextarea = true, $viewType = 'depends', $htmlFormatting = 'table')
 {
     if ($this->_xml) {
         $element = $this->_xml;
         if ($element && $element->getName() == $this->_maintagname && $element->attributes($this->_attrname) == $this->_attrvalue) {
             if ($grand_parent_path != null) {
                 $element = $element->getElementByPath($grand_parent_path);
                 if (!$element) {
                     return null;
                 }
             }
             if ($parent_tag != null && $parent_attr != null && $parent_attrvalue != null) {
                 $element = $element->getChildByNameAttr($parent_tag, $parent_attr, $parent_attrvalue);
                 if ($element) {
                     if ($tag_path) {
                         /** @var SimpleXMLElement $element */
                         $element = $element->getElementByPath($tag_path);
                     }
                     if ($element !== false) {
                         $this->_xmlElem =& $element;
                     }
                 }
             } else {
                 $element = $element->getElementByPath($tag_path);
                 if ($element !== false) {
                     $this->_xmlElem = $element;
                 }
             }
         } elseif (!$tag_path) {
             $this->_xmlElem = $element;
         }
     }
     if ($this->_xmlElem !== null) {
         $controllerView = new DrawController($this->input, $this->_xmlElem, $this->_actions, $this->_options);
         $controllerView->setControl_name($control_name);
         $editRowView = new RegistryEditView($this->input, $this->_db, $this->_pluginParams, $this->_types, $this->_actions, $this->_views, $this->_pluginObject, $this->_tabId);
         $modelOfDataRows = $this->registry->getStorage();
         $editRowView->setModelOfDataRows($modelOfDataRows);
         if ($this->_extendViewParser) {
             $editRowView->setExtendedViewParser($this->_extendViewParser);
         }
         return $editRowView->renderEditRowView($this->_xmlElem, $this->registry, $controllerView, $this->_options, $viewType, $htmlFormatting);
     } else {
         if ($paramstextarea) {
             return "<textarea name=\"{$control_name}\" cols=\"40\" rows=\"10\" class=\"text_area\">" . htmlspecialchars($this->registry->asJson()) . "</textarea>";
         } else {
             return null;
         }
     }
 }
コード例 #2
0
ファイル: cbEditRowView.php プロジェクト: Raul-mz/web-erpcya
 /**
  * Sets an extended view parser
  * This method is experimental and not part of CB API.
  *
  * @param  SimpleXMLElement  $extendedViewParserElement  An Object of class className (where className is from an xml element like <extendparser class="className" /> where className extends RegistryEditView
  * @return void
  */
 public function setExtendedViewParser(&$extendedViewParserElement)
 {
     $this->registryEditView->setExtendedViewParser($extendedViewParserElement);
 }