Пример #1
0
 public function actionIndex($parentid = 0)
 {
     $folder = zotop::model('system.folder');
     if (form::isPostBack()) {
         $post = form::post();
         foreach ((array) $post['id'] as $i => $id) {
             $folder->update(array('order' => $i + 1), $id);
         }
         if (!$folder->error()) {
             msg::success('保存成功', zotop::url('system/folder/index'));
         }
         msg::error($folder->msg());
     }
     $folders = $folder->getAll();
     $tree = new tree($folders, 0);
     $rows = $tree->getChild($parentid);
     $position = $tree->getPosition($parentid);
     foreach ($position as $p) {
         $pos[zotop::url('system/folder/index/' . $p['id'])] = $p['title'];
     }
     $page = new page();
     $page->set('title', zotop::t('文件管理'));
     $page->set('navbar', $this->navbar($parentid));
     $page->set('position', array(zotop::url('system/file') => zotop::t('文件管理'), zotop::url('system/folder') => zotop::t('分类管理')) + (array) $pos + array('列表'));
     $page->set('folders', $folders);
     $page->set('rows', $rows);
     $page->set('hash', $hash);
     $page->display();
 }