當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Term::children方法代碼示例

本文整理匯總了PHP中Term::children方法的典型用法代碼示例。如果您正苦於以下問題:PHP Term::children方法的具體用法?PHP Term::children怎麽用?PHP Term::children使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Term的用法示例。


在下文中一共展示了Term::children方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findTermsRecursive

 /**
  * find terms recursive
  * 
  * @param Term $parent
  */
 protected function findTermsRecursive($parent, $level = 0, $path = '/', $state = Term::STATE_ACTIVE, $orderBy = 'ordering')
 {
     $data = $parent->attributes;
     $data['level'] = $level++;
     $vob = Vocabulary::model()->findByPk($parent->v_id);
     if (is_object($vob)) {
         $propertyClassName = $vob->propertyClassName;
         if (!empty($propertyClassName)) {
             $model = new $propertyClassName();
             $property = $model->findByAttributes(array('term_id' => $parent->id, 'status' => $state));
             if (is_object($property)) {
                 $properties = $property->attributes;
                 unset($properties['id'], $properties['status'], $properties['creation_datetime'], $properties['last_update'], $properties['created_by'], $properties['updated_by'], $properties['term_id']);
                 $data['properties'] = $properties;
             }
         }
     }
     $children = $parent->children(array('order' => $orderBy, 'condition' => 'children.state=:state', 'params' => array(':state' => $state)));
     if (is_array($children) && count($children)) {
         $data['children'] = array();
         foreach ($children as $term) {
             Yii::trace('findTermsRecursive in ' . $orderBy, 'system.db.abc');
             $data['children'][] = $this->findTermsRecursive($term, $level, '/', $state, $orderBy);
         }
     }
     return $data;
 }
開發者ID:hung5s,項目名稱:yap,代碼行數:32,代碼來源:TaxonomyApi.php


注:本文中的Term::children方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。