Exemple #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));
 }
Exemple #2
0
            <td>
                <a href="javascript:;" class="cat_btn" data-url="<?php 
    echo $this->createUrl('catalog/children', array('id' => $row['id']));
    ?>
">+</a>                
                <a href="<?php 
    echo $this->createUrl('update', array('id' => $row['id']));
    ?>
">
                    <?php 
    echo $row['catalog_name'];
    ?>
                </a>        
            </td>     
            <td><?php 
    echo ModelType::getTypeName($row['type']);
    ?>
</td> 
            <td><?php 
    echo date('Y-m-d H:i', $row['create_time']);
    ?>
</td>
            <td><?php 
    echo date('Y-m-d H:i', $row['update_time']);
    ?>
</td>
            <td>
                <a href="<?php 
    echo $this->createUrl('update', array('id' => $row['id']));
    ?>
"><img src="<?php