当前位置: 首页>>代码示例>>PHP>>正文


PHP object::addChild方法代码示例

本文整理汇总了PHP中object::addChild方法的典型用法代码示例。如果您正苦于以下问题:PHP object::addChild方法的具体用法?PHP object::addChild怎么用?PHP object::addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object的用法示例。


在下文中一共展示了object::addChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addChild

 /**
  * Method to add a child
  *
  * @param   JMenuNode  &$node       The node to process
  * @param   boolean    $setCurrent  True to set as current working node
  *
  * @return  void
  */
 public function addChild(JMenuNode &$node, $setCurrent = false)
 {
     $this->_current->addChild($node);
     if ($setCurrent) {
         $this->_current =& $node;
     }
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:15,代码来源:menu.php

示例2: addChild

	/**
	 * Method to add a child
	 *
	 * @param   array   $node.
	 * @param   boolean $setCurrent
	 *
	 * @return  mixed
	 *
	 * @since   11.1
	 */
	function addChild(&$node, $setCurrent = false)
	{
		$this->_current->addChild($node);
		if ($setCurrent) {
			$this->_current = &$node;
		}
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:17,代码来源:tree.php

示例3: addChild

 /**
  * Method to add a child
  *
  * @param   array    &$node       The node to process
  * @param   boolean  $setCurrent  True to set as current working node
  *
  * @return  mixed
  *
  * @since   11.1
  */
 public function addChild(&$node, $setCurrent = false)
 {
     JLog::add('JTree::addChild() is deprecated.', JLog::WARNING, 'deprecated');
     $this->_current->addChild($node);
     if ($setCurrent) {
         $this->_current =& $node;
     }
 }
开发者ID:01J,项目名称:topm,代码行数:18,代码来源:tree.php

示例4: setUp

 public function setUp()
 {
     $this->metadataFactory = $this->getMock(ClassMetadataFactory::class);
     $this->metadataFactory->method('hasMetadataFor')->will($this->returnValueMap([[DummyEntity::class, true], [DummyEmbeddable::class, true]]));
     $this->metadataFactory->method('getMetadataFor')->will($this->returnValueMap([[DummyEntity::class, DummyEntity::getMetadata()], [DummyEmbeddable::class, DummyEmbeddable::getMetadata()]]));
     $em = $this->getMock(EntityManagerInterface::class);
     $em->method('getMetadataFactory')->willReturn($this->metadataFactory);
     $this->entity = new DummyEntity();
     $this->entity->setId(1);
     $this->entity->setA('1a');
     $this->entity->setB('1b');
     $this->entity->setC('1c');
     $d = new DummyEmbeddable();
     $d->setX(1);
     $d->setY(2);
     $d->setZ(3);
     $this->entity->setD($d);
     $child = new DummyEntity();
     $child->setId(2);
     $child->setA('2a');
     $child->setB('2b');
     $child->setC('2c');
     $d = new DummyEmbeddable();
     $d->setX(21);
     $d->setY(22);
     $d->setZ(23);
     $child->setD($d);
     $this->entity->addChild($child);
     $child = new DummyEntity();
     $child->setId(3);
     $child->setA('3a');
     $child->setB('3b');
     $child->setC('3c');
     $d = new DummyEmbeddable();
     $d->setX(31);
     $d->setY(32);
     $d->setZ(33);
     $child->setD($d);
     $this->entity->addChild($child);
     $subchild = new DummyEntity();
     $subchild->setId(4);
     $subchild->setA('4a');
     $subchild->setB('4b');
     $subchild->setC('4c');
     $d = new DummyEmbeddable();
     $d->setX(41);
     $d->setY(42);
     $d->setZ(43);
     $subchild->setD($d);
     $child->addChild($subchild);
     $this->normalizer = new DoctrineNormalizer(null, null, null, $em);
     $propertyNormalizer = new PropertyNormalizer();
     $serializer = new Serializer([$this->normalizer, $propertyNormalizer]);
     $this->normalizer->setSerializer($serializer);
 }
开发者ID:mihai-stancu,项目名称:serializer,代码行数:55,代码来源:DoctrineNormalizerTest.php

示例5: init

 /**
  * Executes initialization actions required to setup the data structures
  * related to the tag.
  * <p>
  * This includes:
  * <ul>
  * <li>creation of the nested element</li>
  * <li>calling the setters for attributes</li>
  * <li>adding the element to the container object</li>
  * <li>adding a reference to the element (if id attribute is given)</li>
  * </ul>
  *
  * @param  string  the tag that comes in
  * @param  array   attributes the tag carries
  * @throws ExpatParseException if the setup process fails
  * @access public
  */
 function init($propType, $attrs)
 {
     $configurator = $this->configurator;
     $project = $this->configurator->project;
     // introspect the parent class that is custom
     $parentClass = get_class($this->parent);
     $ih = IntrospectionHelper::getHelper($parentClass);
     try {
         if ($this->parent instanceof UnknownElement) {
             $this->child = new UnknownElement(strtolower($propType));
             $this->parent->addChild($this->child);
         } else {
             $this->child = $ih->createElement($project, $this->parent, strtolower($propType));
         }
         $configurator->configureId($this->child, $attrs);
         if ($this->parentWrapper !== null) {
             $this->childWrapper = new RuntimeConfigurable($this->child, $propType);
             $this->childWrapper->setAttributes($attrs);
             $this->parentWrapper->addChild($this->childWrapper);
         } else {
             $configurator->configure($this->child, $attrs, $project);
             $ih->storeElement($project, $this->parent, $this->child, strtolower($propType));
         }
     } catch (BuildException $exc) {
         throw new ExpatParseException("Error initializing nested element <{$propType}>", $exc, $this->parser->getLocation());
     }
 }
开发者ID:sufius,项目名称:pmbSymfony1,代码行数:44,代码来源:NestedElementHandler.php

示例6: init

 /**
  * Executes initialization actions required to setup the data structures
  * related to the tag.
  * <p>
  * This includes:
  * <ul>
  * <li>creation of the nested element</li>
  * <li>calling the setters for attributes</li>
  * <li>adding the element to the container object</li>
  * <li>adding a reference to the element (if id attribute is given)</li>
  * </ul>
  *
  * @param  string  the tag that comes in
  * @param  array   attributes the tag carries
  * @throws ExpatParseException if the setup process fails
  */
 public function init($propType, $attrs)
 {
     $configurator = $this->configurator;
     $project = $this->configurator->project;
     try {
         $this->child = new UnknownElement(strtolower($propType));
         $this->child->setTaskName($propType);
         $this->child->setTaskType($propType);
         $this->child->setProject($project);
         $this->child->setLocation($this->parser->getLocation());
         if ($this->target !== null) {
             $this->child->setOwningTarget($this->target);
         }
         if ($this->parent !== null) {
             $this->parent->addChild($this->child);
         } elseif ($this->target !== null) {
             $this->target->addTask($this->child);
         }
         $configurator->configureId($this->child, $attrs);
         $this->childWrapper = new RuntimeConfigurable($this->child, $propType);
         $this->childWrapper->setAttributes($attrs);
         if ($this->parentWrapper !== null) {
             $this->parentWrapper->addChild($this->childWrapper);
         }
     } catch (BuildException $exc) {
         throw new ExpatParseException("Error initializing nested element <{$propType}>", $exc, $this->parser->getLocation());
     }
 }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:44,代码来源:ElementHandler.php

示例7: setBinding_Operation

 /**
  * 
  *
  *
  * @param   string    $function     Name function point for attribute name on entity wsdl:operation section Binding.
  * @return  bool      TRUE if entity Operation/Binding was created on WSDL, FALSE if not.
  */
 private function setBinding_Operation($function)
 {
     if (!is_object($this->node_Binding)) {
         $this->errorMSG = "Error - XMLNodeObject Binding is null";
         return false;
     }
     if (empty($function)) {
         $this->errorMSG = "Error - Operation Binding name function isn't defined";
         return false;
     }
     try {
         $objOperation = $this->node_Binding->addChild("{$this->prefix_ns_wsdl}:operation", null, $this->ns_wsdl);
         $objOperation->addAttribute("name", $function);
         $objSOAP_Oper = $objOperation->addChild("{$this->prefix_ns_soap}:operation", null, $this->ns_soap);
         $objSOAP_Oper->addAttribute("soapAction", "{$this->targetNamespace}/{$function}");
         $objSOAP_Oper->addAttribute("style", "document");
         $objIN = $objOperation->addChild("{$this->prefix_ns_wsdl}:input", null, $this->ns_wsdl);
         $objOUT = $objOperation->addChild("{$this->prefix_ns_wsdl}:output", null, $this->ns_wsdl);
         $objIN_Body = $objIN->addChild("{$this->prefix_ns_soap}:body", null, $this->ns_soap);
         $objOUT_Body = $objOUT->addChild("{$this->prefix_ns_soap}:body", null, $this->ns_soap);
         $objIN_Body->addAttribute("use", "literal");
         $objOUT_Body->addAttribute("use", "literal");
         $objIN_Body->addAttribute("namespace", $this->targetNamespace);
         $objOUT_Body->addAttribute("namespace", $this->targetNamespace);
     } catch (Exception $ex) {
         $this->errorMSG = "Failed generate Operation Binding WSDL section " . $ex->getMessage();
         return false;
     }
     return true;
 }
开发者ID:lordbasex,项目名称:elastix-gui,代码行数:37,代码来源:WSDLcreator.class.php

示例8: generateMenu

 /**
  * Recursively generates a menu from the description.
  *
  * Helper function called from generateMenuBar.
  *
  * @param  object   $parent      The parent menu or menu bar.
  *
  * @param  array    $description See generateMenuBar's $description parameter.
  *
  */
 protected function generateMenu($parent, array $description)
 {
     foreach ($description as $itemDescription) {
         if (empty($itemDescription['routeParameters'])) {
             $itemDescription['routeParameters'] = array();
         }
         if (empty($itemDescription['children'])) {
             $parent->addChild($itemDescription['label'], array('route' => $itemDescription['route'], 'routeParameters' => $itemDescription['routeParameters'], 'attributes' => array("data-dojo-type" => "dijit/MenuItem", "data-dojo-props" => $this->generateOnClickHandler($itemDescription['route'], $itemDescription['routeParameters']))));
         } else {
             if (isset($itemDescription['route'])) {
                 $newParent = $parent->addChild($itemDescription['label'], array('route' => $itemDescription['route'], 'routeParameters' => $itemDescription['routeParameters'], 'attributes' => array("data-dojo-type" => "dijit/PopupMenuItem", "data-dojo-props" => $this->generateOnClickHandler($itemDescription['route'], $itemDescription['routeParameters'])), 'childrenAttributes' => array('data-dojo-type' => 'dijit/DropDownMenu')));
             } else {
                 $newParent = $parent->addChild($itemDescription['label'], array('attributes' => array("data-dojo-type" => "dijit/PopupMenuItem"), 'childrenAttributes' => array('data-dojo-type' => 'dijit/DropDownMenu')));
             }
             $this->generateMenu($newParent, $itemDescription['children']);
         }
     }
 }
开发者ID:adrianles,项目名称:elkarbackup,代码行数:28,代码来源:Builder.php

示例9: addChildWithAttributes

 /**
  * Add child with attributes to $xmlObject.
  *
  * @param array $attributes
  * @return void
  */
 protected function addChildWithAttributes($attributes = array())
 {
     $child = static::$xmlObject->addChild($this->child);
     foreach ($attributes as $key => $value) {
         $child->addAttribute($key, $value);
     }
     foreach ($this->new as $key => $value) {
         $child->addChild($key, $value);
     }
 }
开发者ID:markcell,项目名称:salvaon,代码行数:16,代码来源:Salvaon.php

示例10: generateMenu

 /**
  * Recursively generates a menu from the description.
  *
  * Helper function called from generateMenuBar.
  *
  * @param  object   $parent      The parent menu or menu bar.
  *
  * @param  array    $description See generateMenuBar's $description parameter.
  *
  */
 protected function generateMenu($parent, array $description)
 {
     foreach ($description as $itemDescription) {
         if (empty($itemDescription['routeParameters'])) {
             $itemDescription['routeParameters'] = array();
         }
         if (empty($itemDescription['children'])) {
             // submenus hijos
             $parent->addChild($itemDescription['label'], array('route' => $itemDescription['route'], 'routeParameters' => $itemDescription['routeParameters'], 'extras' => array('safe_label' => true), 'label' => $itemDescription['icon'], 'attributes' => array('class' => $itemDescription['class'])));
         }
     }
 }
开发者ID:xezpeleta,项目名称:elkarbackup,代码行数:22,代码来源:Builder.php

示例11: set_temp_img

 /**
  * Добавление временного изображения,
  * когда, например, заполняются не все поля и шаг create ad 
  * перезагружается.
  *
  * @param int $id - имя изображения 
  */
 public function set_temp_img($img_name, $img_w, $img_h)
 {
     if (isset($this->campaign->img_temp)) {
         $img_temp = $this->campaign->img_temp;
         $img_temp->attributes()->src = $img_name;
         $img_temp->attributes()->width = $img_w;
         $img_temp->attributes()->height = $img_h;
     } else {
         $img_temp = $this->campaign->addChild('img_temp');
         $img_temp->addAttribute('src', $img_name);
         $img_temp->addAttribute('width', $img_w);
         $img_temp->addAttribute('height', $img_h);
     }
 }
开发者ID:sabril-2t,项目名称:Open-Ad-Server,代码行数:21,代码来源:new_campaign.php

示例12: getListCounterOrders

 /**
  * XML-интерфейс списка встречных заявок
  * по конкретной НОВОЙ заявке ВМ-идентификатора
  *
  * @param integer $queryId        номер (id) новой заявки идентификатора wmid,
  * информацию по которой необходимо вернуть
  * @param integer $capitallerWmid ВМ-идентификатор капиталлера
  * @return object Объект ответа
  */
 public function getListCounterOrders($queryId, $capitallerWmid = false)
 {
     $this->url = 'https://wm.exchanger.ru/asp/XMLWMList3Det.asp';
     $this->buildObject();
     $sign = $this->sign($this->wmid . $queryId);
     $this->xml->addChild('wmid', $this->wmid);
     $this->xml->addChild('signstr', $sign);
     $this->xml->addChild('queryid', $queryId);
     if ($capitallerWmid) {
         $this->xml->addChild('capitallerwmid', $capitallerWmid);
     }
     $this->run();
     return $this->result;
 }
开发者ID:richweber,项目名称:yii2-wm-exchanger,代码行数:23,代码来源:Exchanger.php

示例13: _add

 /**
  * Add row
  */
 private function _add()
 {
     $data = $this->_data;
     $this->xml['lastID'] += 1;
     $row = $this->xml->addChild('row');
     $row->addAttribute('id', $this->get_last_id());
     foreach (get_object_vars($data) as $name => $value) {
         $type = $this->check_type($value);
         $value = $type == 'array' ? serialize($value) : $value;
         $field = $row->addChild('field', $value);
         $field->addAttribute('name', $name);
         $field->addAttribute('type', $type);
     }
 }
开发者ID:cesimar,项目名称:XML-FileDatabase,代码行数:17,代码来源:xmlDB.php

示例14: addLogger

 function addLogger($type, $mask = null, $config = array())
 {
     // make child logger
     $child = $this->loggerFactory($type, $config);
     if (!empty($child)) {
         //set error level mask
         if (!empty($mask)) {
             $child->setMask($mask);
         }
         // add child to main composite logger
         $ret = $this->logger->addChild($child);
     } else {
         $ret = false;
     }
     //set hasChildren flag
     if ($ret == true) {
         $this->hasChildren = true;
     } else {
         return false;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:21,代码来源:error.php

示例15: object_to_xml

/**
 * Recusively travserses through an array to propagate SimpleXML objects.
 * @param array $array the array to parse
 * @param object $xml the Simple XML object (must be at least a single empty node)
 * @return object the Simple XML object (with array objects added)
 * @author Ben Balter
 */
function object_to_xml($array, $xml)
{
    /*
     * Array of keys that will be treated as attributes, not children.
     */
    $attributes = array('id', 'number', 'label', 'prefix');
    /*
     * Recursively loop through each item.
     */
    foreach ($array as $key => $value) {
        /*
         * If this is a numbered array, grab the parent node to determine the node name.
         */
        if (is_numeric($key)) {
            $key = 'unit';
        }
        /*
         * If this is an attribute, treat as an attribute.
         */
        if (in_array($key, $attributes)) {
            $xml->addAttribute($key, $value);
        } else {
            if (is_object($value) || is_array($value)) {
                $child = $xml->addChild($key);
                $child = object_to_xml($value, $child);
            } else {
                $xml->addChild($key, $value);
            }
        }
    }
    return $xml;
}
开发者ID:davemcphee,项目名称:AustinDecoded,代码行数:39,代码来源:functions.inc.php


注:本文中的object::addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。