當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。