本文整理汇总了PHP中Tree::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::init方法的具体用法?PHP Tree::init怎么用?PHP Tree::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$result = $this->terms_obj->order(array("listorder" => "asc"))->select();
/* $tree = new PathTree();
$tree->icon = array(' │ ', ' ├─ ', ' └─ ');
$tree->nbsp = '---';
$tree->init($result);
$tree=$tree->get_tree();
$this->assign("terms",$tree); */
$tree = new \Tree();
$tree->icon = array(' │ ', ' ├─ ', ' └─ ');
$tree->nbsp = ' ';
foreach ($result as $r) {
$r['str_manage'] = '<a href="' . U("AdminTerm/add", array("parent" => $r['term_id'])) . '">添加子类</a> | <a href="' . U("AdminTerm/edit", array("id" => $r['term_id'])) . '">修改</a> | <a class="J_ajax_del" href="' . U("AdminTerm/delete", array("id" => $r['term_id'])) . '">删除</a> ';
$url = U('portal/list/index', array('id' => $r['term_id']));
$r['url'] = $url;
$r['taxonomys'] = $this->taxonomys[$r['taxonomy']];
$r['id'] = $r['term_id'];
$r['parentid'] = $r['parent'];
$array[] = $r;
}
$tree->init($array);
$str = "<tr>\r\n\t\t\t\t\t<td><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input input-order'></td>\r\n\t\t\t\t\t<td>\$id</td>\r\n\t\t\t\t\t<td>\$spacer <a href='\$url' target='_blank'>\$name</a></td>\r\n\t \t\t\t<td>\$taxonomys</td>\r\n\t\t\t\t\t<td align='center'><a href='\$url' target='_blank'>访问</a></td>\r\n\t\t\t\t\t<td>\$str_manage</td>\r\n\t\t\t\t</tr>";
$taxonomys = $tree->get_tree(0, $str);
$this->assign("taxonomys", $taxonomys);
$this->display();
//$this->display();
}
示例2: index
public function index()
{
$sort = $this->_get("sort", 'trim', 'ordid');
$order = $this->_get("order", 'trim', 'ASC');
$tree = new Tree();
$tree->icon = array('│ ', '├─ ', '└─ ');
$tree->nbsp = ' ';
$result = $this->_mod->order($sort . ' ' . $order)->where(array('tokenTall' => $this->getTokenTall()))->select();
$array = array();
foreach ($result as $r) {
$r['str_img'] = $r['img'] ? '<span class="img_border"><img src="' . attach($r['img'], 'item_cate') . '" style="width:26px; height:26px;" class="J_preview" data-bimg="' . attach($r['img'], 'item_cate') . '" /></span>' : '';
$r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__STATIC__/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_index'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="is_index" data-value="' . $r['is_index'] . '" src="__STATIC__/images/admin/toggle_' . ($r['is_index'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_type'] = $r['type'] ? '<span class="gray">' . L('item_cate_type_tag') . '</span>' : L('item_cate_type_cat');
$r['str_manage'] = '<a href="javascript:;" class="J_showdialog" data-uri="' . U('item_cate/add', array('pid' => $r['id'])) . '" data-title="' . L('add_item_cate') . '" data-id="add" data-width="520" data-height="360">' . L('add_item_subcate') . '</a> |
<a href="javascript:;" class="J_showdialog" data-uri="' . U('item_cate/edit', array('id' => $r['id'])) . '" data-title="' . L('edit') . ' - ' . $r['name'] . '" data-id="edit" data-width="520" data-height="360">' . L('edit') . '</a> |
<a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="' . U('item_cate/delete', array('id' => $r['id'])) . '" data-msg="' . sprintf(L('confirm_delete_one'), $r['name']) . '">' . L('delete') . '</a>';
$r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
$r['is_allcate'] = $r['name'] == '全部商品' ? 'allcate' : 'cate&cid=' . $r['id'];
$array[] = $r;
}
$str = "<tr id='node-\$id' \$parentid_node>\n <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\n <td align='center'>\$id</td>\n <td>\$spacer<span data-tdtype='view' data-field='name' data-id='\$id' class='tdview' style='color:\$fcolor'>\$name</span></td>\n <td align='left'>" . $_SERVER['HTTP_HOST'] . "/weTall/index.php?m=book&a=\$is_allcate&tokenTall=" . $this->getTokenTall() . "</td>\n \t\t<td align='center'>\$str_img</td>\n <td align='center'>\$str_type</td>\n <td align='center'><span data-tdtype='view' data-field='ordid' data-id='\$id' class='tdview'>\$ordid</span></td>\n <td align='center'>\$str_index</td>\n <td align='center'>\$str_status</td>\n <td align='center'>\$str_manage</td>\n </tr>";
$tree->init($array);
$list = $tree->get_tree(0, $str);
$this->assign('list', $list);
//bigmenu (标题,地址,弹窗ID,宽,高)
$big_menu = array('title' => L('add_item_cate'), 'iframe' => U('item_cate/add'), 'id' => 'add', 'width' => '520', 'height' => '360');
$this->assign('big_menu', $big_menu);
$this->assign('list_table', true);
$this->display();
}
示例3: edit
function edit()
{
if (IS_POST) {
$post = I('post.');
$data['parent'] = $post['parent'];
$data['title'] = $post['title'];
$data['listorder'] = $post['listorder'];
$map['user_id'] = $this->uid;
$map['id'] = $post['id'];
if ($this->categories->where($map)->save($data) !== false) {
$this->success('类别修改成功!');
} else {
$this->error('类别修改失败!');
}
} else {
$id = I('id');
$map_categories['id'] = $id;
$map_categories['user_id'] = $this->uid;
$data = $this->categories->where($map_categories)->field(true)->find();
if ($data == null) {
$this->error('没有这个类别!');
}
$map['user_id'] = $this->uid;
$list = $this->categories->where($map)->order('listorder')->select();
import('@.Rover.Tree');
$tree = new Tree();
$tree->init($list);
$str = "<option \$css value=\$id \$selected>\$spacer\$title</option>";
$selected = $tree->get_tree(0, $str, $data['parent']);
$this->assign('selected', $selected);
$this->assign('data', $data);
$this->display('mod');
}
}
示例4: index
public function index()
{
$sort = $this->_get("sort", 'trim', 'ordid');
$order = $this->_get("order", 'trim', 'ASC');
$tree = new Tree();
$tree->icon = array('│ ', '├─ ', '└─ ');
$tree->nbsp = ' ';
$result = $this->_mod->where(array('lang' => $this->lang))->order($sort, $order)->select();
$array = array();
foreach ($result as $r) {
$r['str_type'] = L('type_' . $r['type']);
$r['str_manage'] = '<a href="' . U('home/content/index', array('cid' => $r['id'])) . '" target="_blank">' . L('lable_browse') . '</a> |
' . ($r['type'] == 0 ? '<a href="' . U('content/index', array('cat_id' => $r['id'])) . '">' . L('tabs_content') . '</a> | ' : '') . '
<a href="' . U('category/add', array('pid' => $r['id'])) . '">' . L('lable_addsoncate') . '</a> |
<a href="' . U('category/edit', array('id' => $r['id'])) . '">' . L('lable_edit') . '</a> |
<a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="' . U('category/delete', array('id' => $r['id'])) . '" data-msg="' . sprintf(L('confirm_delete_one'), $r['name']) . '分类下的文章也会删除">' . L('lable_del') . '</a>';
$r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
$array[] = $r;
}
$str = "<tr id='node-\$id' \$parentid_node>\n <td class='text-c'>\$id</td>\n\t\t\t\t\t\t\t\t<td class='text-c'><span data-tdtype='edit' data-field='ordid' data-id='\$id' class='tdedit'>\$ordid</span></td>\n <td>\$spacer<span data-tdtype='edit' data-field='name' data-id='\$id' class='tdedit'>\$name</span></td>\n\t\t\t\t\t\t\t\t<td align='center' class='type_\$type'>\$str_type</td>\n <td class='text-c'>\$str_manage</td>\n </tr>";
$tree->init($array);
$list = $tree->get_tree(0, $str);
$this->assign('curr_name', 'index');
$this->assign('list', $list);
$this->assign('list_table', true);
$this->display();
}
示例5: info
public function info()
{
$infoid = I('get.infoid');
$this->assign('infoid', $infoid);
//获取车型列表
$info_db = D('Info');
$infoList = $info_db->getInfoList();
$this->assign('infoList', $infoList);
//题图
$topPicList = getPicMetaArr($infoid, 91);
//print_r($topPicList);exit;
$this->assign('topPicList', $topPicList);
$classself_db = D('ClassSelf');
$data_class = array();
$data_class = $classself_db->getClassSelfList($infoid);
foreach ($data_class as $key => &$row) {
if ($row['classid'] == 91) {
unset($data_class[$key]);
}
if ($row['parentid'] == 91) {
unset($data_class[$key]);
}
$row['cid'] = $row['id'];
$row['id'] = $row['classid'];
}
$tree = new \Tree();
$tree->init($data_class);
$menuList = $tree->get_tree_array(0);
$this->assign('menuList', $menuList);
$this->display(":info");
}
示例6: index
/**
* 模型管理首页
*/
public function index()
{
$_SESSION['admin_menu_index'] = "Model/index";
$result = $this->model_model->select();
import("Tree");
$tree = new \Tree();
$tree->icon = array(' │ ', ' ├─ ', ' └─ ');
$tree->nbsp = ' ';
$newmenus = array();
foreach ($result as $m) {
$newmenus[$m['id']] = $m;
}
foreach ($result as $n => $r) {
$result[$n]['str_manage'] = '<a href="' . U("model/lists", array("model" => $r['name'])) . '">数据</a> |<a href="' . U("model/edit", array("id" => $r['id'], "menuid" => $_GET['menuid'])) . '">修改</a> | <a class="J_ajax_del" href="' . U("Model/del", array("id" => $r['id'])) . '">删除</a> |<a href="' . U('Attribute/index?model_id=' . $r['id']) . '" >字段管理</a>';
$result[$n]['status'] = $r['status'] ? "显示" : "隐藏";
if (APP_DEBUG) {
$result[$n]['app'] = $r['app'] . "/" . $r['model'] . "/" . $r['action'];
}
}
$tree->init($result);
$str = "<tr id='node-\$id' \$parentid_node>\n <td>\$id</td>\n <td>\$title</td>\n <td>\$name</td>\n <td>\$create_time</td>\n <td>\$str_manage</td>\n </tr>";
$categorys = $tree->get_tree(0, $str);
$this->assign("categorys", $categorys);
$this->display();
}
示例7: cate_url
public function cate_url()
{
$sort = $this->_get("sort", 'trim', 'ordid');
$order = $this->_get("order", 'trim', 'ASC');
$tree = new Tree();
$tree->icon = array('│ ', '├─ ', '└─ ');
$tree->nbsp = ' ';
$result = $this->_mod->order($sort . ' ' . $order)->where("token ='" . session('token') . "'")->select();
$array = array();
foreach ($result as $r) {
$r['str_img'] = $r['img'] ? '<span class="img_border"><img src="' . attach($r['img'], '' . session('token') . '/item_cate') . '" style="width:26px; height:26px;" class="J_preview" data-bimg="' . attach($r['img'], '' . session('token') . '/item_cate') . '" /></span>' : '';
$r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__STATIC__/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_index'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="is_index" data-value="' . $r['is_index'] . '" src="__STATIC__/images/admin/toggle_' . ($r['is_index'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_type'] = $r['type'] ? '<span class="gray">' . L('item_cate_type_tag') . '</span>' : L('item_cate_type_cat');
// <a href="'.U('item_cate/tag_list',array('cate_id'=>$r['id'])).'">'.L('tag').'</a> |
$r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
$array[] = $r;
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?token=' . session('token') . '&m=book&a=cate&cateid=';
$str = "<tr id='node-\$id' \$parentid_node>\n <td align='center' style='display:none;'><input type='checkbox' value='\$id' class='J_checkitem'></td>\n <td align='left' style='display:none;'>\$id</td>\n <td>\$spacer<span style='color:\$fcolor'>\$name</span></td>\n <td align='left'>" . $url . "\$id</td>\n\n </tr>";
$tree->init($array);
$list = $tree->get_tree(0, $str);
$this->assign('list', $list);
//bigmenu (标题,地址,弹窗ID,宽,高)
$this->assign('list_table', true);
$this->display();
}
示例8: index
public function index()
{
$sort = $this->_get("sort", 'trim', 'ordid');
$order = $this->_get("order", 'trim', 'ASC');
$tree = new Tree();
$tree->icon = array('│ ', '├─ ', '└─ ');
$tree->nbsp = ' ';
$result = $this->_mod->order($sort . ' ' . $order)->select();
$array = array();
foreach ($result as $r) {
$r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__STATIC__/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_manage'] = '<a href="javascript:;" class="J_showdialog" data-uri="' . U('items_cate/add', array('pid' => $r['id'])) . '" data-title="' . L('add_item_cate') . '" data-id="add" data-width="520" data-height="20">' . L('add_item_subcate') . '</a> |
<a href="javascript:;" class="J_showdialog" data-uri="' . U('items_cate/edit', array('id' => $r['id'])) . '" data-title="' . L('edit') . ' - ' . $r['name'] . '" data-id="edit" data-width="500" data-height="20">' . L('edit') . '</a> |
<a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="' . U('items_cate/delete', array('id' => $r['id'])) . '" data-msg="' . sprintf(L('confirm_delete_one'), $r['name']) . '">' . L('delete') . '</a>';
$r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
$array[] = $r;
}
$str = "<tr id='node-\$id' \$parentid_node>\n <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\n <td align='center'>\$id</td>\n <td>\$spacer<span data-tdtype='edit' data-field='name' data-id='\$id' class='tdedit' style='color:\$fcolor'>\$name</span></td>\n <td align='center'><span data-tdtype='edit' data-field='ordid' data-id='\$id' class='tdedit'>\$ordid</span></td>\n <td align='center'>\$str_status</td>\n <td align='center'>\$str_manage</td>\n </tr>";
$tree->init($array);
$list = $tree->get_tree(0, $str);
$this->assign('list', $list);
//bigmenu (标题,地址,弹窗ID,宽,高)
$big_menu = array('title' => L('add_item_cate'), 'iframe' => U('items_cate/add'), 'id' => 'add', 'width' => '520', 'height' => '80');
$this->assign('big_menu', $big_menu);
$this->assign('list_table', true);
$this->display();
}
示例9: info
public function info($type = 'admin')
{
parent::info();
$cid = intval($this->input->get_post('cid'));
$options = array();
if ($cid > 0) {
$options['where'] = array('cid' => $cid);
}
$item = $this->model->getOne($options, true);
$this->parameters->fromArray(json_to_array($item['params']));
$item['params'] = $this->parameters;
$parents = array('顶级栏目');
$where = array();
if ($this->user_info->key != 'root') {
$where = array('status >=' => 0);
}
$item['type'] = $item['type'] ? $item['type'] : $type;
$options = array('type' => $item['type'], 'where' => $where, 'order' => " order_id desc,cid desc");
$tree = new Tree();
$tree->init($this->model->getAll2Array($options));
foreach ($tree->getValueOptions() as $k => $tmp) {
$parents[$k] = $tmp['title'];
}
$data = array('parents' => $parents, 'item' => $item);
$this->_template('admin/setting/columinfo', $data);
}
示例10: index
public function index()
{
$tree = new Tree();
$tree->icon = array('│ ', '├─ ', '└─ ');
$tree->nbsp = ' ';
$result = $this->_mod->select();
$array = array();
foreach ($result as $arr) {
$arr['status'] = '<i data-editid="' . $arr['id'] . '" data-editype="single" data-editfield="status" data-toggle="AJAXedit" data-editurl="' . U('admin/ajax_edit') . '" class="' . ($arr['status'] == 0 ? 'icon-remove' : 'icon-ok') . '" data-value="' . $arr['status'] . '"></i>';
$arr['mangers'] = '<a class="editing" data-id="' . $arr['id'] . '" href="#editing" data-orgurl="' . U('admin/edit') . '" data-url="' . U('admin/edit', array('id' => $arr['id'])) . '" data-toggle="modal">' . L('edit') . '</a>
<a data-toggle="AJAXdelete" data-url="' . U('admin/delete', array('id' => $arr['id'])) . '" >' . L('del') . '</a>
';
$arr['p_node'] = $arr['pid'] ? ' class="child-node-' . $arr['pid'] . '"' : '';
$array[] = $arr;
}
$auth = array();
$auth = session('admin');
if ($auth['role_id'] > 1) {
$str = "<tr id='node-\$id' \$p_node >\r\n <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\r\n <td align='center'>\$id</td>\r\n <td>\$spacer<span data-toggle='AJAXedit' data-value='\$name' data-editype='word' data-editurl='" . U('admin/ajax_edit') . "' data-editfield='name' data-editid='\$id'>\$username</span></td>\r\n <td>\$status</td>\r\n \t<td>\$mangers</td>\r\n </tr>";
} else {
}
$str = "<tr id='node-\$id' \$p_node >\r\n <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\r\n <td align='center'>\$id</td>\r\n <td>\$spacer<span data-toggle='AJAXedit' data-value='\$name' data-editype='word' data-editurl='" . U('admin/ajax_edit') . "' data-editfield='name' data-editid='\$id'>\$username</span></td>\r\n <td>\$status</td>\r\n \t<td>\$mangers</td>\r\n </tr>";
$tree->init($array);
$list = $tree->get_tree(0, $str);
$this->assign('list', $list);
$add_menu = array('title' => L('admin_add'), 'url' => U('admin/add'), 'id' => 'admin_add', 'width' => '500', 'height' => '350', 'btn' => 'save', 'getajax' => U('admin/ajax_getroles'));
$this->assign('add_menu', $add_menu);
$this->display();
}
示例11: index
function index()
{
if (IS_POST) {
$where = '';
if ($_POST['term'] != 0) {
$where .= 'position_cg = ' . $_POST['term'];
}
if ($_POST['start_time'] != '') {
//strtotime()datime格式转换成时间戳
if ($where == '') {
$where .= "updated_at > '" . date('Y-m-d H:i:s', strtotime($_POST['start_time'])) . "'";
} else {
$where .= " AND updated_at > '" . date('Y-m-d H:i:s', strtotime($_POST['start_time'])) . "'";
}
}
if ($_POST['end_time'] != '') {
if ($where == '') {
$where .= "updated_at < '" . date('Y-m-d H:i:s', strtotime($_POST['end_time'])) . "'";
} else {
$where .= " AND updated_at < '" . date('Y-m-d H:i:s', strtotime($_POST['end_time'])) . "'";
}
}
if ($_POST['keyword'] != '') {
if ($where == '') {
$where .= "title like '%" . $_POST['keyword'] . "%'";
} else {
$where .= " and title like '%" . $_POST['keyword'] . "%'";
}
}
}
if ($_GET['p'] == '') {
$_GET['p'] = 1;
}
//分类树
import("Tree");
$tree = new \Tree();
$result = $this->category_model->where('progenitor = 9130971')->select();
foreach ($result as $r) {
$array[] = $r;
}
$str = "<option value='\$id' >\$spacer \$name</option>";
$tree->init($array);
$select_categorys = $tree->get_tree(0, $str);
$this->assign("select_categorys", $select_categorys);
$result = $this->resume_model->where($where)->page($_GET['p'] . ',20')->order('updated_at desc')->select();
foreach ($result as &$v) {
$v['position_cg'] = $this->get_category_name($v['position_cg']);
}
$count = $this->resume_model->count();
$Page = new \Think\Page($count, 20);
$show = $Page->show();
$this->assign('Page', $show);
$this->assign('posts', $result);
$this->display();
}
示例12: _after_select
protected function _after_select(&$resultSet, $options)
{
$resultSet = PositionCategory::getSubCatesInArr(PositionCategory::sort(null, 'order', SORT_ASC));
if (ACTION_NAME == 'index') {
$str = "<tr class='tr'>\r\n\t\t\t\t <td align='center'><input type='text' value='\$order' size='3' name='order[\$id]'></td>\r\n\t\t\t\t <td align='center'>\$id</td>\r\n\t\t\t\t <td >\$spacer \$name</td>\r\n\t\t\t\t <td align='center'>\$status_html</td>\r\n\t\t\t\t\t<td align='center'>\r\n\t\t\t\t\t\t\$submenu | \$edit | \$delete\r\n\t\t\t\t\t</td>\r\n\t\t\t\t </tr>";
$Tree = new Tree();
$Tree->icon = array(' │ ', ' ├─ ', ' └─ ');
$Tree->nbsp = ' ';
$Tree->init($resultSet);
$html_tree = $Tree->get_tree(0, $str);
$resultSet['html_tree'] = $html_tree;
}
}
示例13: index
public function index()
{
$sort = $this->_get("sort", 'trim', 'ordid');
$order = $this->_get("order", 'trim', 'ASC');
$tree = new Tree();
$tree->icon = array('│ ', '├─ ', '└─ ');
$tree->nbsp = ' ';
$result = M('item_cate')->order($sort . ' ' . $order)->select();
$map = array();
$UserDB = D('item_cate');
$count = $UserDB->where($map)->count();
$Page = new Page($count, 1808);
// 实例化分页类 传入总记录数
// 进行分页数据查询 注意page方法的参数的前面部分是当前的页数使用 $_GET[p]获取
$nowPage = isset($_GET['p']) ? $_GET['p'] : 1;
$show = $Page->show();
// 分页显示输出
$result = $UserDB->where($map)->order('ordid ASC')->limit($Page->firstRow . ',' . $Page->listRows)->select();
$this->assign('page', $show);
// 赋值分页输出
//var_dump($result);die();
$array = array();
foreach ($result as $r) {
$r['str_img'] = $r['img'] ? '<span class="img_border"><img src="' . attach($r['img'], 'item_cate') . '" style="width:26px; height:26px;" class="J_preview" data-bimg="' . attach($r['img'], 'item_cate') . '" /></span>' : '';
$r['str_status'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="status" data-value="' . $r['status'] . '" src="__ROOT__/weTall/static/images/admin/toggle_' . ($r['status'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_index'] = '<img data-tdtype="toggle" data-id="' . $r['id'] . '" data-field="is_index" data-value="' . $r['is_index'] . '" src="__ROOT__/weTall/static/images/admin/toggle_' . ($r['is_index'] == 0 ? 'disabled' : 'enabled') . '.gif" />';
$r['str_type'] = $r['type'] ? '<span class="gray">标签分类</span>' : "商品分类";
$r['str_manage'] = '<a href="javascript:;" class="J_showdialog" data-uri="/weTall/index.php?g=Admin&m=item_cate&a=add&pid=' . $r['id'] . '" data-title="添加子分类" data-id="add" data-width="520" data-height="360">' . "添加子分类" . '</a> |
<a href="javascript:;" class="J_showdialog" data-uri="/weTall/index.php?g=Admin&m=item_cate&a=edit&id=' . $r['id'] . '" data-title="编辑 - ' . $r['name'] . '" data-id="edit" data-width="520" data-height="360">' . "编辑" . '</a> |
<a href="javascript:;" class="J_confirmurl" data-acttype="ajax" data-uri="/weTall/index.php?g=Admin&m=item_cate&a=delete&id=' . $r['id'] . '" data-msg="' . sprintf("确定删除吗?", $r['name']) . '">' . "删除" . '</a>';
// <a href="'.U('item_cate/tag_list',array('cate_id'=>$r['id'])).'">'.L('tag').'</a> |
$r['parentid_node'] = $r['pid'] ? ' class="child-of-node-' . $r['pid'] . '"' : '';
$array[] = $r;
}
// var_dump($array);die();
$str = "<tr id='node-\$id' \$parentid_node>\r\n <td align='center'><input type='checkbox' value='\$id' class='J_checkitem'></td>\r\n <td align='center'>\$id</td>\r\n <td>\$spacer<span data-tdtype='edit' data-field='name' data-id='\$id' class='tdedit' style='color:\$fcolor'>\$name</span></td>\r\n <td align='center'>\$str_img</td>\r\n <td align='center'>\$str_type</td>\r\n <td align='center'><span data-tdtype='edit' data-field='ordid' data-id='\$id' class='tdedit'>\$ordid</span></td>\r\n <td align='center'>\$str_index</td>\r\n <td align='center'>\$str_status</td>\r\n <td align='center'>\$str_manage</td>\r\n </tr>";
//$this->show($str);
$tree->init($array);
$list = $tree->get_tree(0, $str);
$this->assign('list', $list);
//bigmenu (标题,地址,弹窗ID,宽,高)
$big_menu = array('title' => L('add_item_cate'), 'iframe' => U('item_cate/add'), 'id' => 'add', 'width' => '520', 'height' => '360');
$this->assign('big_menu', $big_menu);
$this->assign('list_table', true);
$this->display();
}
示例14: _before_edit
public function _before_edit()
{
$id = $this->_get('id', 'intval');
$info = $this->_mod->find($id);
$this->assign('info', $info);
$tree = new Tree();
$result = $this->_mod->select();
$array = array();
foreach ($result as $r) {
$r['selected'] = $r['id'] == $info['pid'] ? 'selected' : '';
$array[] = $r;
}
$str = "<option value='\$id' \$selected>\$spacer \$name</option>";
$tree->init($array);
$select_menus = $tree->get_tree(0, $str);
$this->assign('select_menus', $select_menus);
}
示例15: add
function add()
{
if (IS_POST) {
$post = I('post.');
$this->_check_form($post);
$data['uname'] = pdm_encode($post['uname'], $this->auth_code);
$data['pwd'] = pdm_encode($post['pwd'], $this->auth_code);
$data['category_id'] = $post['category_id'];
$data['user_id'] = $this->uid;
$data['add_time'] = NOW_TIME;
$data['add_ip'] = get_client_ip(1);
$data['note'] = $post['note'];
$data['title'] = $post['title'];
if ($this->password->add($data) !== false) {
$map_categories['id'] = $post['category_id'];
$map_categories['user_id'] = $this->uid;
$data_categories['sum'] = array('exp', 'sum+1');
$this->categories->where($map_categories)->save($data_categories);
$this->success('密码添加成功!', pdm_ux('index'));
} else {
$this->error('密码添加失败!');
}
} else {
$get = I('get.');
if ($get['sign'] != '') {
$map_history['id'] = pdm_code($get['sign'], 'DECODE');
$map_history['user_id'] = $this->uid;
$data_history = $this->history->where($map_history)->field('uname,pwd')->find();
if ($data_history == null) {
$this->error('参数不正确!');
}
$data['uname'] = pdm_decode($data_history['uname'], $this->auth_code);
$data['pwd'] = pdm_decode($data_history['pwd'], $this->auth_code);
}
$map['user_id'] = $this->uid;
$list = $this->categories->where($map)->order('listorder')->select();
import('@.Rover.Tree');
$tree = new Tree();
$tree->init($list);
$str = "<option \$css value=\$id \$selected>\$spacer\$title</option>";
$selected = $tree->get_tree(0, $str, $get['typeid']);
$this->assign('selected', $selected);
$this->assign('data', $data);
$this->display('mod');
}
}