當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。