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


PHP ArrayHelper::fromObject方法代码示例

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


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

示例1: getItems

 /**
  * Method to get an array of data items
  *
  * @return  mixed An array of data on success, false on failure.
  */
 public function getItems()
 {
     $items = parent::getItems();
     foreach ($items as $item) {
         if (isset($item->gender) && $item->gender != '') {
             if (is_object($item->gender)) {
                 $item->gender = ArrayHelper::fromObject($item->gender);
             }
             $values = is_array($item->gender) ? $item->gender : explode(',', $item->gender);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__contact_details`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->gender = !empty($textValue) ? implode(', ', $textValue) : $item->gender;
         }
         if (isset($item->event) && $item->event != '') {
             if (is_object($item->event)) {
                 $item->event = ArrayHelper::fromObject($item->event);
             }
             $values = is_array($item->event) ? $item->event : explode(',', $item->event);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__contact_details`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->event = !empty($textValue) ? implode(', ', $textValue) : $item->event;
         }
         if (isset($item->tshirt) && $item->tshirt != '') {
             if (is_object($item->tshirt)) {
                 $item->tshirt = ArrayHelper::fromObject($item->tshirt);
             }
             $values = is_array($item->tshirt) ? $item->tshirt : explode(',', $item->tshirt);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__contact_details`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->tshirt = !empty($textValue) ? implode(', ', $textValue) : $item->tshirt;
         }
         if (isset($item->blood_type) && $item->blood_type != '') {
             if (is_object($item->blood_type)) {
                 $item->blood_type = ArrayHelper::fromObject($item->blood_type);
             }
             $values = is_array($item->blood_type) ? $item->blood_type : explode(',', $item->blood_type);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__contact_details`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->blood_type = !empty($textValue) ? implode(', ', $textValue) : $item->blood_type;
         }
     }
     return $items;
 }
开发者ID:marrighi,项目名称:mundialcozumel2016,代码行数:84,代码来源:inscriptions.php

示例2: getItems

 /**
  * Method to get an array of data items
  *
  * @return  mixed An array of data on success, false on failure.
  */
 public function getItems()
 {
     $items = parent::getItems();
     //error_log("In AkrecipesModelRecipesbyuser::getItems Count == " . count($items) ) ;
     foreach ($items as $item) {
         //get the tags
         $item->tags = new JHelperTags();
         //$item->tags->getItemTags('com_akrecipes.recipe',$item->id);
         $item->tags->getItemTags($item->type_alias, $item->id);
         if (isset($item->catid)) {
             // Get the title of that particular template
             $title = AkrecipesFrontendHelper::getCategoryNameByCategoryId($item->catid);
             // Finally replace the data object with proper information
             $item->catid = !empty($title) ? $title : $item->catid;
         }
         if (isset($item->cuisines_id) && $item->cuisines_id != '') {
             if (is_object($item->cuisines_id)) {
                 $item->cuisines_id = ArrayHelper::fromObject($item->cuisines_id);
             }
             $values = is_array($item->cuisines_id) ? $item->cuisines_id : explode(',', $item->cuisines_id);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__akrecipes_cuisines`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->cuisines_id = !empty($textValue) ? implode(', ', $textValue) : $item->cuisines_id;
         }
         // set meal_course values
         if (isset($item->meal_course_id) && $item->meal_course_id != '') {
             if (is_object($item->meal_course_id)) {
                 $item->meal_course_id = ArrayHelper::fromObject($item->meal_course_id);
             }
             $values = is_array($item->meal_course_id) ? $item->meal_course_id : explode(',', $item->meal_course_id);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__akrecipes_meal_course`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->meal_course_id = !empty($textValue) ? implode(', ', $textValue) : $item->meal_course_id;
         }
         // set brand values
         if (isset($item->brand_id) && $item->brand_id != '') {
             if (is_object($item->brand_id)) {
                 $item->brand_id = ArrayHelper::fromObject($item->brand_id);
             }
             $values = is_array($item->brand_id) ? $item->brand_id : explode(',', $item->brand_id);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('brand_name'))->from('`#__akrecipes_brands`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->brand_name;
                 }
             }
             $item->brand_id = !empty($textValue) ? implode(', ', $textValue) : $item->brand_id;
         }
     }
     return $items;
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:79,代码来源:recipesbyuser.php

示例3: getItems

 /**
  * Method to get an array of data items
  *
  * @return  mixed An array of data on success, false on failure.
  */
 public function getItems()
 {
     $items = parent::getItems();
     foreach ($items as $item) {
         if (isset($item->subject) && $item->subject != '') {
             if (is_object($item->subject)) {
                 $item->subject = ArrayHelper::fromObject($item->subject);
             }
             $values = is_array($item->subject) ? $item->subject : explode(',', $item->subject);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('subject'))->from('`#__vocab_subject`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->subject;
                 }
             }
             $item->subject = !empty($textValue) ? implode(', ', $textValue) : $item->subject;
         }
         if (isset($item->category) && $item->category != '') {
             if (is_object($item->category)) {
                 $item->category = ArrayHelper::fromObject($item->category);
             }
             $values = is_array($item->category) ? $item->category : explode(',', $item->category);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('category'))->from('`#__vocab_category`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->category;
                 }
             }
             $item->category = !empty($textValue) ? implode(', ', $textValue) : $item->category;
         }
         if (isset($item->frequency) && $item->frequency != '') {
             if (is_object($item->frequency)) {
                 $item->frequency = ArrayHelper::fromObject($item->frequency);
             }
             $values = is_array($item->frequency) ? $item->frequency : explode(',', $item->frequency);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('frequency'))->from('`#__vocab_frequency`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->frequency;
                 }
             }
             $item->frequency = !empty($textValue) ? implode(', ', $textValue) : $item->frequency;
         }
         if (isset($item->pos) && $item->pos != '') {
             if (is_object($item->pos)) {
                 $item->pos = ArrayHelper::fromObject($item->pos);
             }
             $values = is_array($item->pos) ? $item->pos : explode(',', $item->pos);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('part'))->from('`#__vocab_pos`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->part;
                 }
             }
             $item->pos = !empty($textValue) ? implode(', ', $textValue) : $item->pos;
         }
     }
     return $items;
 }
开发者ID:brianteeman,项目名称:cam,代码行数:84,代码来源:contents.php

示例4: getItems

 /**
  * Method to get an array of data items
  *
  * @return  mixed An array of data on success, false on failure.
  */
 public function getItems()
 {
     $items = parent::getItems();
     //error_log("In AkrecipesModelRecipes::getItems Count == " . count($items) ) ;
     foreach ($items as $item) {
         //get the tags
         $item->tags = new JHelperTags();
         $item->tags->getItemTags('com_akrecipes.recipe', $item->id);
         // if (isset($item->tags))
         // {
         // 	// Catch the item tags (string with ',' coma glue)
         // 	$tags = explode(",", $item->tags);
         // 	$db = JFactory::getDbo();
         // 	// Cleaning and initalization of named tags array
         // 	$namedTags = array();
         // 	// Get the tag names of each tag id
         // 	foreach ($tags as $tag)
         // 	{
         // 		$query = $db->getQuery(true);
         // 		$query->select("title");
         // 		$query->from('`#__tags`');
         // 		$query->where("id=" . intval($tag));
         // 		$db->setQuery($query);
         // 		$row = $db->loadObjectList();
         // 		// Read the row and get the tag name (title)
         // 		if (!is_null($row))
         // 		{
         // 			foreach ($row as $value)
         // 			{
         // 				if ( $value && isset($value->title))
         // 				{
         // 					$namedTags[] = trim($value->title);
         // 				}
         // 			}
         // 		}
         // 	}
         // 	// Finally replace the data object with proper information
         // 	$item->tags = !empty($namedTags) ? implode(', ', $namedTags) : $item->tags;
         // }
         // if (isset($item->catid))
         // {
         // 	// Get the title of that particular template
         // 	$title = AkrecipesFrontendHelper::getCategoryNameByCategoryId($item->catid);
         // 	// Finally replace the data object with proper information
         // 	$item->catid = !empty($title) ? $title : $item->catid;
         // }
         if (isset($item->cuisines_id) && $item->cuisines_id != '') {
             if (is_object($item->cuisines_id)) {
                 $item->cuisines_id = ArrayHelper::fromObject($item->cuisines_id);
             }
             $values = is_array($item->cuisines_id) ? $item->cuisines_id : explode(',', $item->cuisines_id);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__akrecipes_cuisines`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->cuisines_id = !empty($textValue) ? implode(', ', $textValue) : $item->cuisines_id;
         }
         if (isset($item->meal_course_id) && $item->meal_course_id != '') {
             if (is_object($item->meal_course_id)) {
                 $item->meal_course_id = ArrayHelper::fromObject($item->meal_course_id);
             }
             $values = is_array($item->meal_course_id) ? $item->meal_course_id : explode(',', $item->meal_course_id);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__akrecipes_meal_course`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->meal_course_id = !empty($textValue) ? implode(', ', $textValue) : $item->meal_course_id;
         }
         if (isset($item->created_by)) {
             $item->user = AkrecipesHelper::getUserObject($item->created_by);
         }
     }
     return $items;
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:93,代码来源:recipes.php

示例5: getItems

 /**
  * Method to get an array of data items
  *
  * @return  mixed An array of data on success, false on failure.
  */
 public function getItems()
 {
     $items = parent::getItems();
     foreach ($items as $item) {
         if (isset($item->department) && $item->department != '') {
             if (is_object($item->department)) {
                 $item->department = ArrayHelper::fromObject($item->department);
             }
             $values = is_array($item->department) ? $item->department : explode(',', $item->department);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__eiko_organisationen`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->department = !empty($textValue) ? implode(', ', $textValue) : $item->department;
         }
         if (isset($item->ausruestung) && $item->ausruestung != '') {
             if (is_object($item->ausruestung)) {
                 $item->ausruestung = ArrayHelper::fromObject($item->ausruestung);
             }
             $values = is_array($item->ausruestung) ? $item->ausruestung : explode(',', $item->ausruestung);
             $textValue = array();
             foreach ($values as $value) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select($db->quoteName('name'))->from('`#__eiko_ausruestung`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
                 $db->setQuery($query);
                 $results = $db->loadObject();
                 if ($results) {
                     $textValue[] = $results->name;
                 }
             }
             $item->ausruestung = !empty($textValue) ? implode(', ', $textValue) : $item->ausruestung;
         }
     }
     return $items;
 }
开发者ID:AndreKoepke,项目名称:Einsatzkomponente,代码行数:48,代码来源:einsatzfahrzeuge.php


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