本文整理汇总了PHP中tree::getPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP tree::getPosition方法的具体用法?PHP tree::getPosition怎么用?PHP tree::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tree
的用法示例。
在下文中一共展示了tree::getPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
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();
}
示例2: position
public function position($id = '', $template = '')
{
$id = empty($id) ? $this->id : $id;
$nodes = $this->getAll();
$tree = new tree($nodes);
$position = $tree->getPosition($id);
if (empty($template)) {
return $position;
}
$str = '';
if (is_array($position)) {
foreach ($position as $pos) {
@extract($pos);
eval("\$temp = \"{$template}\";");
$str .= $temp;
}
}
return $str;
}
示例3: actionIndex
public function actionIndex($type = 'all', $folderid = 0)
{
$file = zotop::model('system.file');
$folder = zotop::model('system.folder');
if (!empty($type) && $type != 'all') {
$where = array('file.type', '=', $type);
}
$files = $file->db()->select('file.*', 'user.name as user_name', 'user.username as user_username')->join('user', 'user.id', 'file.userid')->where($where)->orderby('file.createtime', 'desc')->getPage();
//zotop::dump($file->db()->Sql());
$types = $file->types();
$pagination = new pagination();
$pagination->page = $files['page'];
$pagination->pagesize = $files['pagesize'];
$pagination->total = $files['total'];
$p = $pagination->render();
$totalsize = $file->totalsize($where);
$totalcount = $file->count();
$folders = $folder->getAll();
$tree = new tree($folders, 0);
$position = $tree->getPosition($folderid);
foreach ($position as $p) {
$pos[zotop::url('system/file/index/' . $type . '/' . $p['id'])] = $p['title'];
}
$page = new page();
$page->set('title', zotop::t('文件管理'));
$page->set('position', array(zotop::url('system/file') => zotop::t('文件管理'), zotop::url('system/file/' . $type . '/0') => zotop::t('全部文件')) + (array) $pos + array('列表'));
$page->set('navbar', $this->navbar());
$page->set('page', $files['page']);
$page->set('pagesize', $files['pagesize']);
$page->set('total', $files['total']);
$page->set('files', $files['data']);
$page->set('totalsize', $totalsize);
$page->set('totalcount', $totalcount);
$page->set('pagination', $p);
$page->set('types', $types);
$page->set('type', $type);
$page->set('folderid', $folderid);
$page->display();
}