Esempio n. 1
0
 public function run()
 {
     $parent_id = Yii::app()->request->getParam('id');
     $children = Catalog::getChildren($parent_id);
     if ($children) {
         foreach ($children as $k => $v) {
             $result[$k] = array('id' => $v['id'], 'parent_id' => $v['parent_id'], 'name' => $v['catalog_name'], 'type' => ModelType::getTypeName($v['type']), 'layer' => $v['layer'], 'sort_order' => $v['sort_order'], 'create_time' => date('Y-m-d H:i', $v['create_time']), 'update_time' => date('Y-m-d H:i', $v['update_time']), 'children_url' => $this->controller->createUrl('catalog/children', array('id' => $v['id'])), 'update_url' => $this->controller->createUrl('catalog/update', array('id' => $v['id'])), 'delete_url' => $this->controller->createUrl('catalog/batch', array('command' => 'delete', 'id' => $v['id'])));
         }
     } else {
         $result = array();
     }
     exit(CJSON::encode($result));
 }
Esempio n. 2
0
 /**
  * 获取分类下子分类
  * 
  * @return array
  */
 private function _getCatalogChildren()
 {
     $parent_id = intval(Yii::app()->request->getParam('catalog_id'));
     return Catalog::getChildren($parent_id, true, $this->controller->_type_ids['post']);
 }