当前位置: 首页>>代码示例>>PHP>>正文


PHP Tree::add_row方法代码示例

本文整理汇总了PHP中Tree::add_row方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::add_row方法的具体用法?PHP Tree::add_row怎么用?PHP Tree::add_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree::add_row方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Tree

 /**
  * Get menu from database, and generate html nested list
  *
  * @param int $group_id
  * @param string $attr
  * @return string
  */
 function popoji_menu($group_id, $attr = '', $attrs = '', $attrss = '', $opt = '')
 {
     $tree = new Tree();
     $sql = sprintf('SELECT * FROM %s WHERE group_id = %s ORDER BY %s, %s', MENU_TABLE, $group_id, MENU_PARENT, MENU_POSITION);
     $menu = $this->db->GetAll($sql);
     $str = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
     $strlink = preg_replace("/\\/index\\.php\$/", "", $str);
     foreach ($menu as $row) {
         $httpdtc = substr($row[MENU_URL], 0, 7);
         $httpdtcs = substr($row[MENU_URL], 0, 8);
         if ($row[MENU_PARENT] == 0) {
             if ($row[MENU_CLASS] == "") {
                 if ($httpdtc == "http://" or $httpdtcs == "https://") {
                     $label = '<a href="' . $row[MENU_URL] . '">';
                 } else {
                     $label = '<a href="' . $strlink . '/' . $row[MENU_URL] . '">';
                 }
             } else {
                 if ($httpdtc == "http://" or $httpdtcs == "https://") {
                     $label = '<a ' . $attrs . ' href="' . $row[MENU_URL] . '">';
                 } else {
                     $label = '<a ' . $attrs . ' href="' . $strlink . '/' . $row[MENU_URL] . '">';
                 }
             }
         } else {
             if ($row[MENU_CLASS] == "") {
                 if ($httpdtc == "http://" or $httpdtcs == "https://") {
                     $label = '<a href="' . $row[MENU_URL] . '">';
                 } else {
                     $label = '<a href="' . $strlink . '/' . $row[MENU_URL] . '">';
                 }
             } else {
                 if ($httpdtc == "http://" or $httpdtcs == "https://") {
                     $label = '<a ' . $attrs . ' href="' . $row[MENU_URL] . '">';
                 } else {
                     $label = '<a ' . $attrs . ' href="' . $strlink . '/' . $row[MENU_URL] . '">';
                 }
             }
         }
         $label .= $row[MENU_TITLE];
         $label .= '</a>';
         $li_attr = '';
         if ($row[MENU_CLASS]) {
             $li_attr = ' class="' . $row[MENU_CLASS] . '"';
         }
         $tree->add_row($row[MENU_ID], $row[MENU_PARENT], $li_attr, $label);
     }
     $menu = $tree->generate_list($attr, $attrss, $opt);
     return $menu;
 }
开发者ID:nazara13,项目名称:phpindonesia.or.id-profile,代码行数:57,代码来源:po-classmenu.php

示例2: menuManager

 public function menuManager($id_group = 1)
 {
     $db = $this->di['db']->sql(DB_DEFAULT);
     $sql = sprintf('SELECT * FROM %s WHERE %s = %s ORDER BY %s, %s', MENU_TABLE, MENU_GROUP, $id_group, MENU_PARENT, MENU_POSITION);
     $menu = $db->sql_fetch_yield($sql);
     $data['menu_ul'] = '<ul id="easymm"></ul>';
     if ($menu) {
         //include _DOC_ROOT . 'includes/tree.php';
         $tree = new Tree();
         foreach ($menu as $row) {
             $tree->add_row($row[MENU_ID], $row[MENU_PARENT], ' id="menu-' . $row[MENU_ID] . '" class="sortable"', $this->get_label($row));
         }
         $data['menu_ul'] = $tree->generate_list('id="easymm"');
     }
     $data['group_id'] = $id_group;
     $data['group_title'] = $db->sql_fetch_all(sprintf('SELECT %s FROM %s WHERE %s = %s', MENUGROUP_TITLE, MENUGROUP_TABLE, MENUGROUP_ID, $id_group))[0];
     $data['menu_groups'] = $db->sql_fetch_all(sprintf('SELECT %s, %s FROM %s', MENUGROUP_ID, MENUGROUP_TITLE, MENUGROUP_TABLE))[0];
     return $data;
 }
开发者ID:glial,项目名称:glial,代码行数:19,代码来源:Menu.php

示例3: menumanager

 /**
  * Show menu manager
  */
 public function menumanager()
 {
     $group_id = 1;
     if (isset($_GET['group_id'])) {
         $group_id = (int) $_GET['group_id'];
     }
     $menu = $this->get_menu($group_id);
     $data['menu_ul'] = '<ul id="easymm"></ul>';
     if ($menu) {
         include '../../po-component/po-menumanager/includes/tree.php';
         $tree = new Tree();
         foreach ($menu as $row) {
             $tree->add_row($row[MENU_ID], $row[MENU_PARENT], ' id="menu-' . $row[MENU_ID] . '" class="sortable"', $this->get_label($row));
         }
         $data['menu_ul'] = $tree->generate_list('id="easymm"');
     }
     $data['group_id'] = $group_id;
     $data['group_title'] = $this->get_menu_group_title($group_id);
     $data['menu_groups'] = $this->get_menu_groups();
     $this->view('menu', $data);
 }
开发者ID:rad4n,项目名称:erekutoro,代码行数:24,代码来源:class.php

示例4: actionWebsite

 public function actionWebsite()
 {
     $group_id = 1;
     if (isset($_GET['group_id'])) {
         $group_id = (int) $_GET['group_id'];
     }
     $menu = Menu::model()->get_menu($group_id);
     $data['menu_ul'] = '<ul id="easymm"></ul>';
     if ($menu) {
         include 'includes/tree.php';
         $tree = new Tree();
         foreach ($menu as $row) {
             $tree->add_row($row[MENU_ID], $row[MENU_PARENT], ' id="menu-' . $row[MENU_ID] . '" class="sortable"', Menu::model()->get_label($row));
         }
         $data['menu_ul'] = $tree->generate_list('id="easymm"');
     }
     $data['group_id'] = $group_id;
     $data['group_title'] = Menu::model()->get_menu_group_title($group_id);
     $data['menu_groups'] = Menu::model()->get_menu_groups();
     //$this->view('menu', $data);
     $this->render('website', $data);
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:22,代码来源:StudentsController.php


注:本文中的Tree::add_row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。