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


PHP Collection::addObject方法代码示例

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


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

示例1: addField

 /**
  * Add an object to the fiedset's elements collection
  *
  * @param \ValidFormBuilder\Base $field The object to add
  * @throws \InvalidArgumentException if property passed to `addField()` is not an instance of Base
  */
 public function addField($field)
 {
     if (!$field instanceof Base) {
         throw new \InvalidArgumentException("No valid object passed to Fieldset::addField(). " . "Object should be an instance of \\ValidFormBuilder\\Base.", E_ERROR);
     }
     $this->__fields->addObject($field);
     // Set parent element hard, overwrite if previously set.
     $field->setMeta("parent", $this, true);
     if ($field->isDynamic() && get_class($field) !== "ValidFormBuilder\\MultiField" && get_class($field) !== "ValidFormBuilder\\Area") {
         $objHidden = new Hidden($field->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array("default" => 0, "dynamicCounter" => true));
         $this->__fields->addObject($objHidden);
         $field->setDynamicCounter($objHidden);
     }
 }
开发者ID:BTHUNTERCN,项目名称:validformbuilder,代码行数:20,代码来源:Fieldset.php

示例2: getRecords

 /**
  * Retrieve an array with available records for a specific form.
  *
  * @param  string           $strFormId The Fulcrum form id
  * @return \Fulcrum\Records
  */
 public function getRecords($strFormId, $arrParameters = array())
 {
     $objReturn = new Collection();
     $strGet = "/records";
     $arrParameters["form_id"] = $strFormId;
     $this->objRest = new RestRequest($this->apiUrl . $strGet, "GET", $arrParameters, $this->getHeaders());
     $this->objRest->execute();
     $this->parseResponse();
     if (is_object($this->response)) {
         $objReturn->setTotalCount($this->response->total_count);
         $objStdRecords = $this->response->records;
         $objForm = $this->getForm($strFormId);
         foreach ($objStdRecords as $objStdClass) {
             $objReturn->addObject(new Record($objStdClass, $objForm));
         }
     }
     return $objReturn;
 }
开发者ID:neverwoods,项目名称:fulcrum,代码行数:24,代码来源:API.php

示例3: getFields

 /**
  * getFields creates a flat collection of all form fields.
  *
  * @internal
  * @param boolean $blnIncludeMultiFields Set this to true if you want to include MultiFields in the collection
  * @return Collection The collection of fields.
  */
 public function getFields($blnIncludeMultiFields = false)
 {
     $objFields = new Collection();
     foreach ($this->__elements as $objPage) {
         if ($objPage->hasFields()) {
             foreach ($objPage->getFields() as $objFieldset) {
                 if ($objFieldset->hasFields()) {
                     foreach ($objFieldset->getFields() as $objField) {
                         if (is_object($objField)) {
                             if ($objField->hasFields()) {
                                 // Also add the multifield to the resulting collection, if $blnIncludeMultiFields is true.
                                 if (get_class($objField) == "ValidFormBuilder\\MultiField" && $blnIncludeMultiFields) {
                                     $objFields->addObject($objField);
                                 }
                                 foreach ($objField->getFields() as $objSubField) {
                                     if (is_object($objSubField)) {
                                         if ($objSubField->hasFields()) {
                                             // Also add the multifield to the resulting collection, if $blnIncludeMultiFields is true.
                                             if (get_class($objField) == "ValidFormBuilder\\MultiField" && $blnIncludeMultiFields) {
                                                 $objFields->addObject($objField);
                                             }
                                             foreach ($objSubField->getFields() as $objSubSubField) {
                                                 if (is_object($objSubSubField)) {
                                                     $objFields->addObject($objSubSubField);
                                                 }
                                             }
                                         } else {
                                             $objFields->addObject($objSubField);
                                         }
                                     }
                                 }
                             } else {
                                 $objFields->addObject($objField);
                             }
                         }
                     }
                 } else {
                     $objFields->addObject($objFieldset);
                 }
             }
         } else {
             $objFields->addObject($objPage);
         }
     }
     return $objFields;
 }
开发者ID:BTHUNTERCN,项目名称:validformbuilder,代码行数:53,代码来源:ValidWizard.php

示例4: getFields

 /**
  * Get a flat Collection of all internal elements.
  *
  * This loops through all elements and adds each element and their children to a new Collection which will be
  * returned. This results in a flat Collection filled with ValidForm Builder elements.
  *
  * @return \ValidFormBuilder\Collection
  */
 public function getFields()
 {
     $objFields = new Collection();
     foreach ($this->__elements as $objFieldset) {
         if ($objFieldset->hasFields()) {
             foreach ($objFieldset->getFields() as $objField) {
                 if (is_object($objField)) {
                     if ($objField->hasFields()) {
                         if (get_class($objField) == "ValidFormBuilder\\Area" && $objField->isActive()) {
                             $objFields->addObject($objField);
                         }
                         foreach ($objField->getFields() as $objSubField) {
                             if (is_object($objSubField)) {
                                 if ($objSubField->hasFields()) {
                                     if (get_class($objSubField) == "ValidFormBuilder\\Area" && $objSubField->isActive()) {
                                         $objFields->addObject($objSubField);
                                     }
                                     foreach ($objSubField->getFields() as $objSubSubField) {
                                         if (is_object($objSubSubField)) {
                                             $objFields->addObject($objSubSubField);
                                         }
                                     }
                                 } else {
                                     $objFields->addObject($objSubField);
                                 }
                             }
                         }
                     } else {
                         $objFields->addObject($objField);
                     }
                 }
             }
         } else {
             $objFields->addObject($objFieldset);
         }
     }
     $this->__cachedfields = $objFields;
     return $objFields;
 }
开发者ID:SLivio,项目名称:validformbuilder,代码行数:47,代码来源:ValidForm.php

示例5: getCountersRecursive

 /**
  * Get a collection of fields and look for dynamic counters recursively
  * @internal
  * @param Collection $objFields
  * @param Collection $objCollection
  * @return Collection
  */
 protected function getCountersRecursive($objFields, $objCollection = null)
 {
     if (is_null($objCollection)) {
         $objCollection = new Collection();
     }
     foreach ($objFields as $objField) {
         if ($objField instanceof Element && $objField->isDynamicCounter()) {
             $objCollection->addObject($objField);
         }
         if ($objField->hasFields()) {
             $this->getCountersRecursive($objField->getFields(), $objCollection);
         }
     }
     return $objCollection;
 }
开发者ID:BTHUNTERCN,项目名称:validformbuilder,代码行数:22,代码来源:Base.php


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