/** * Format Blog Category Listing * @return array */ public static function get_blogCatsData() { $data = dbquery_tree_full(DB_BLOG_CATS, 'blog_cat_id', 'blog_cat_parent', "" . (multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : '') . ""); foreach ($data as $index => $cat_data) { foreach ($cat_data as $blog_cat_id => $cat) { $data[$index][$blog_cat_id]['blog_cat_link'] = "<a href='" . INFUSIONS . "blog/blog.php?cat_id=" . $cat['blog_cat_id'] . "'>" . $cat['blog_cat_name'] . "</a>"; } } return $data; }
/** * Format Download Category Listing * @return array */ public static function get_downloadCatsData() { global $locale; $data = dbquery_tree_full(DB_DOWNLOAD_CATS, 'download_cat_id', 'download_cat_parent', "" . (multilang_table("BL") ? "WHERE download_cat_language='" . LANGUAGE . "'" : '') . ""); foreach ($data as $index => $cat_data) { foreach ($cat_data as $download_cat_id => $cat) { $data[$index][$download_cat_id]['download_cat_link'] = "<a href='" . DOWNLOADS . "downloads.php?cat_id=" . $cat['download_cat_id'] . "'>" . $cat['download_cat_name'] . "</a>"; } } return $data; }
function showsidelinks(array $options = array(), $id = 0) { global $userdata; static $data = array(); $settings = fusion_get_settings(); $acclevel = isset($userdata['user_level']) ? $userdata['user_level'] : 0; $res =& $res; if (empty($data)) { $data = dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat", "WHERE link_position <= 2" . (multilang_table("SL") ? " AND link_language='" . LANGUAGE . "'" : "") . " AND " . groupaccess('link_visibility') . " ORDER BY link_cat, link_order"); } if (!$id) { $res .= "<ul class='main-nav'>\n"; } else { $res .= "<ul class='sub-nav p-l-10' style='display: none;'>\n"; } foreach ($data[$id] as $link_id => $link_data) { $li_class = ""; if ($link_data['link_name'] != "---" && $link_data['link_name'] != "===") { $link_target = $link_data['link_window'] == "1" ? " target='_blank'" : ""; if (START_PAGE == $link_data['link_url']) { $li_class .= ($li_class ? " " : "") . "current-link"; } if (preg_match("!^(ht|f)tp(s)?://!i", $link_data['link_url'])) { $item_link = $link_data['link_url']; } else { $item_link = BASEDIR . $link_data['link_url']; } $link_icon = ""; if ($link_data['link_icon']) { $link_icon = "<i class='" . $link_data['link_icon'] . "'></i>"; } $res .= "<li" . ($li_class ? " class='" . $li_class . "'" : "") . ">\n"; $res .= "<a class='display-block p-5 p-l-0 p-r-0' href='{$item_link}' {$link_target}>\n"; $res .= $link_icon . $link_data['link_name']; $res .= "</a>\n"; if (isset($data[$link_id])) { $res .= showsidelinks($options, $link_data['link_id']); } $res .= "</li>\n"; } elseif ($link_data['link_cat'] > 0) { echo "<li class='divider'></li>"; } } $res .= "</ul>\n"; return $res; }
function article_listing() { global $aidlink, $locale; // Remodel display results into straight view instead category container sorting. // consistently monitor sql results rendertime. -- Do not Surpass 0.15 // all blog are uncategorized by default unless specified. $limit = 15; if (isset($_GET['filter_cid']) && isnum($_GET['filter_cid'])) { $total_rows = dbcount("(article_id)", DB_ARTICLES, "article_cat='" . intval($_GET['filter_cid']) . "' AND " . (multilang_table("AR") ? "article_language='" . LANGUAGE . "'" : "")); } else { $total_rows = dbcount("(article_id)", DB_ARTICLES, multilang_table("AR") ? "article_language='" . LANGUAGE . "'" : ""); } $rowstart = isset($_GET['rowstart']) && $_GET['rowstart'] <= $total_rows ? $_GET['rowstart'] : 0; // add a filter browser $catOpts = array("all" => $locale['articles_0023']); $categories = dbquery("select article_cat_id, article_cat_name\n\t\t\t\tfrom " . DB_ARTICLE_CATS . " " . (multilang_table("AR") ? "where article_cat_language='" . LANGUAGE . "'" : "") . ""); if (dbrows($categories) > 0) { while ($cat_data = dbarray($categories)) { $catOpts[$cat_data['article_cat_id']] = $cat_data['article_cat_name']; } } // prevent xss $catFilter = ""; if (isset($_GET['filter_cid']) && isnum($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { if ($_GET['filter_cid'] > 0) { $catFilter = "article_cat = '" . intval($_GET['filter_cid']) . "'"; } } $langFilter = multilang_table("AR") ? "article_language='" . LANGUAGE . "'" : ""; if ($catFilter && $langFilter) { $filter = $catFilter . " AND " . $langFilter; } else { $filter = $catFilter . $langFilter; } $result = dbquery("\n\tSELECT a.article_id, a.article_cat, a.article_subject, a.article_snippet, a.article_draft,\n\tcat.article_cat_id, cat.article_cat_name\n\tFROM " . DB_ARTICLES . " a\n\tLEFT JOIN " . DB_ARTICLE_CATS . " cat on cat.article_cat_id=a.article_cat\n\t" . ($filter ? "WHERE " . $filter : "") . "\n\tORDER BY article_draft DESC, article_datestamp DESC LIMIT {$rowstart}, {$limit}\n\t"); $rows = dbrows($result); echo "<div class='clearfix m-t-20'>\n"; echo "<span class='pull-right m-t-10'>" . sprintf($locale['articles_0024'], $rows, $total_rows) . "</span>\n"; if (!empty($catOpts) > 0) { echo "<div class='pull-left m-t-5 m-r-10'>" . $locale['articles_0025'] . "</div>\n"; echo "<div class='dropdown pull-left m-r-10' style='position:relative'>\n"; echo "<a class='dropdown-toggle btn btn-default btn-sm' data-toggle='dropdown'>\n<strong>\n"; if (isset($_GET['filter_cid']) && isset($catOpts[$_GET['filter_cid']])) { echo $catOpts[$_GET['filter_cid']]; } else { echo $locale['articles_0026']; } echo " <span class='caret'></span></strong>\n</a>\n"; echo "<ul class='dropdown-menu' style='max-height:280px; width:300px; overflow-y: scroll'>\n"; function admin_article_list(array $data = array(), $id = 0, $level = 0) { $opt_pattern = str_repeat("—", $level); if (!empty($data[$id])) { foreach ($data[$id] as $cat_id => $value) { $active = isset($_GET['filter_cid']) && $_GET['filter_cid'] == $value['article_cat_id'] ? TRUE : FALSE; echo "<li" . ($active ? " class='active'" : "") . ">\n<a href='" . clean_request("filter_cid=" . $value['article_cat_id'], array("section", "rowstart", "aid"), TRUE) . "'>\n"; echo $opt_pattern . " " . $value['article_cat_name']; echo "</a>\n</li>\n"; if (isset($data[$value['article_cat_id']])) { admin_article_list($data, $value['article_cat_id'], $level + 1); } } } } $category_dat = dbquery_tree_full(DB_ARTICLE_CATS, "article_cat_id", "article_cat_parent"); admin_article_list($category_dat); echo "</ul>\n"; echo "</div>\n"; } if ($total_rows > $rows) { echo "<div class='pull-right m-r-10 '>\n"; echo makepagenav($rowstart, $limit, $total_rows, 3, clean_request("", array("aid", "section"), TRUE) . "&"); echo "</div>\n"; } echo "</div>\n"; echo "<ul class='list-group m-10'>\n"; if ($rows > 0) { while ($data2 = dbarray($result)) { echo "<li class='list-group-item'>\n"; echo "<div class='clearfix'>\n"; echo "<div class='m-b-10 pull-right'><strong>" . $locale['articles_0340'] . ":</strong>\n"; echo "<a class='display-inline-block badge' style='width:auto;' href='" . FUSION_SELF . $aidlink . "&action=edit&cat_id=" . $data2['article_cat_id'] . "&section=article_category'>"; echo $data2['article_cat_name']; echo "</a>"; echo "</div>\n"; echo "<span class='strong text-dark'>" . $data2['article_subject'] . "</span>\n"; echo "</div>\n"; $articleText = strip_tags(parse_textarea($data2['article_snippet'])); echo fusion_first_words($articleText, '50'); echo "<div class='block m-t-10'>\n\t\t\t<a href='" . FUSION_SELF . $aidlink . "&action=edit&section=article_form&article_id=" . $data2['article_id'] . "'>" . $locale['edit'] . "</a> -\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&action=delete&section=article&article_id=" . $data2['article_id'] . "'\n\t\t\tonclick=\"return confirm('" . $locale['articles_0251'] . "');\">" . $locale['delete'] . "</a>\n"; echo "</div>\n"; echo "</li>\n"; } } else { echo "<div class='panel-body text-center'>\n"; echo $locale['articles_0343']; echo "</div>\n"; } echo "</ul>\n"; if ($total_rows > $rows) { echo makepagenav($rowstart, $limit, $total_rows, 3, clean_request("", array("aid", "section"), TRUE) . "&"); } }
/** * Displays News Category Listing */ function display_news_cat_listing() { global $aidlink; $locale = fusion_get_locale(); // need to paginate $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= dbcount("(news_cat_id)", DB_NEWS_CATS, "") ? intval($_GET['rowstart']) : 0; // Run functions $allowed_actions = array_flip(array("publish", "unpublish", "sticky", "unsticky", "delete")); if (isset($_POST['table_action']) && isset($allowed_actions[$_POST['table_action']])) { $input = explode(",", form_sanitizer($_POST['news_cat_id'], "", "news_cat_id")); if (!empty($input)) { foreach ($input as $news_cat_id) { // check input table if (dbcount("('news_cat_id')", DB_NEWS_CATS, "news_cat_id='" . intval($news_cat_id) . "'") && defender::safe()) { switch ($_POST['table_action']) { case "publish": dbquery("UPDATE " . DB_NEWS_CATS . " SET news_cat_draft='0' WHERE news_cat_id='" . intval($news_cat_id) . "'"); break; case "unpublish": dbquery("UPDATE " . DB_NEWS_CATS . " SET news_cat_draft='1' WHERE news_cat_id='" . intval($news_cat_id) . "'"); break; case "sticky": dbquery("UPDATE " . DB_NEWS_CATS . " SET news_cat_sticky='1' WHERE news_cat_id='" . intval($news_cat_id) . "'"); break; case "unsticky": dbquery("UPDATE " . DB_NEWS_CATS . " SET news_cat_sticky='0' WHERE news_cat_id='" . intval($news_cat_id) . "'"); break; case "delete": if (!dbcount("('news_id')", DB_NEWS, "news_cat='" . $news_cat_id . "'")) { $result = dbquery("SELECT news_cat_image FROM " . DB_NEWS_CATS . " WHERE news_cat_id='" . intval($news_cat_id) . "'"); if (dbrows($result) > 0) { $photo = dbarray($result); if (!empty($photo['news_cat_image']) && file_exists(IMAGES_NC . $photo['news_cat_image'])) { unlink(IMAGES_NC . $photo['news_cat_image']); } } dbquery("DELETE FROM " . DB_NEWS_CATS . " WHERE news_cat_id='" . intval($news_cat_id) . "'"); } else { addNotice("warning", "Cannot delete News category because there are News Items"); } break; default: addNotice("warning", "Category ID {$news_cat_id} is not valid and update aborted"); redirect(FUSION_REQUEST); } } } addNotice("success", "News category listing has been updated"); redirect(FUSION_REQUEST); } addNotice("warning", "No news category item selected. Please check a news item and try again"); redirect(FUSION_REQUEST); } if (isset($_POST['news_clear'])) { redirect(FUSION_SELF . $aidlink); } // Switch to post $sql_condition = ""; $search_string = array(); if (isset($_POST['p-submit-news_cat_name'])) { $search_string['news_cat_name'] = array("input" => form_sanitizer($_POST['news_cat_name'], "", "news_cat_name"), "operator" => "LIKE"); } if (!empty($_POST['news_cat_status']) && isnum($_POST['news_cat_status'])) { switch ($_POST['news_cat_status']) { case 1: // is a draft $search_string['news_cat_draft'] = array("input" => 1, "operator" => "="); break; case 2: // is a sticky $search_string['news_cat_sticky'] = array("input" => 1, "operator" => "="); break; } } if (!empty($_POST['news_cat_visibility'])) { $search_string['news_cat_visibility'] = array("input" => form_sanitizer($_POST['news_cat_visibility'], "", "news_cat_visibility"), "operator" => "="); } if (!empty($_POST['news_cat_language'])) { $search_string['news_cat_language'] = array("input" => form_sanitizer($_POST['news_cat_language'], "", "news_cat_language"), "operator" => "="); } if (!empty($search_string)) { foreach ($search_string as $key => $values) { $sql_condition .= " AND `{$key}` " . $values['operator'] . ($values['operator'] == "LIKE" ? "'%" : "'") . $values['input'] . ($values['operator'] == "LIKE" ? "%'" : "'"); } } $result = dbquery_tree_full(DB_NEWS_CATS, "news_cat_id", "news_cat_parent", "", "SELECT nc.*,\n count(n1.news_id) 'news_published',\n count(n2.news_id) 'news_draft',\n count(n3.news_id) 'news_sticky'\n FROM " . DB_NEWS_CATS . " nc\n LEFT JOIN " . DB_NEWS . " n1 ON n1.news_id=nc.news_cat_id AND n1.news_draft='0' AND (n1.news_start='0'|| n1.news_start<=NOW()) AND (n1.news_end='0'|| n1.news_end>=NOW())\n LEFT JOIN " . DB_NEWS . " n2 ON n2.news_id=nc.news_cat_id AND n2.news_draft='1'\n LEFT JOIN " . DB_NEWS . " n3 ON n2.news_id=nc.news_cat_id AND n3.news_sticky='1' AND (n3.news_start='0'|| n3.news_start<=NOW()) AND (n3.news_end='0'|| n3.news_end>=NOW())\n WHERE " . (multilang_table("NS") ? "news_cat_language='" . LANGUAGE . "'" : "") . "\n {$sql_condition}\n GROUP BY news_cat_id\n ORDER BY news_cat_parent ASC, news_cat_id ASC LIMIT " . intval($_GET['rowstart']) . ", 20"); ?> <div class="m-t-15"> <?php echo openform("news_filter", "post", FUSION_REQUEST); echo "<div class='clearfix'>\n"; echo "<div class='pull-right'>\n"; echo "<a class='btn btn-success btn-sm m-r-10' href='" . clean_request("ref=news_cat_form", array("ref"), FALSE) . "'>Add New</a>"; echo "<a class='btn btn-default btn-sm m-r-10' onclick=\"run_admin('publish');\"><i class='fa fa-check fa-fw'></i> Publish</a>"; echo "<a class='btn btn-default btn-sm m-r-10' onclick=\"run_admin('unpublish');\"><i class='fa fa-ban fa-fw'></i> Unpublish</a>"; echo "<a class='btn btn-default btn-sm m-r-10' onclick=\"run_admin('sticky');\"><i class='fa fa-sticky-note fa-fw'></i> Sticky</a>"; echo "<a class='btn btn-default btn-sm m-r-10' onclick=\"run_admin('unsticky');\"><i class='fa fa-sticky-note-o fa-fw'></i> Unsticky</a>"; echo "<a class='btn btn-default btn-sm m-r-10' onclick=\"run_admin('delete');\"><i class='fa fa-trash-o fa-fw'></i> Trash</a>"; echo "</div>\n"; ?> <script> function run_admin(action) { $('#table_action').val(action); $('#news_table').submit(); } </script> <?php $filter_values = array("news_cat_name" => !empty($_POST['news_cat_name']) ? form_sanitizer($_POST['news_cat_name'], "", "news_cat_name") : "", "news_cat_status" => !empty($_POST['news_cat_status']) ? form_sanitizer($_POST['news_cat_status'], "", "news_cat_status") : "", "news_cat_visibility" => !empty($_POST['news_cat_visibility']) ? form_sanitizer($_POST['news_cat_visibility'], "", "news_cat_visibility") : "", "news_cat_language" => !empty($_POST['news_cat_language']) ? form_sanitizer($_POST['news_cat_language'], "", "news_cat_language") : ""); $filter_empty = TRUE; foreach ($filter_values as $val) { if ($val) { $filter_empty = FALSE; } } echo "<div class='display-inline-block pull-left m-r-10' style='width:300px;'>\n"; echo form_text("news_cat_name", "", $filter_values['news_cat_name'], array("placeholder" => "News Category Name", "append_button" => TRUE, "append_value" => "<i class='fa fa-search'></i>", "append_form_value" => "search_news", "width" => "250px")); echo "</div>\n"; echo "<div class='display-inline-block'>"; echo "<a class='btn btn-sm " . ($filter_empty == FALSE ? "btn-info" : " btn-default'") . "' id='toggle_options' href='#'>Search Options\n <span id='filter_caret' class='fa " . ($filter_empty == FALSE ? "fa-caret-up" : "fa-caret-down") . "'></span></a>\n"; echo form_button("news_clear", "Clear", "clear"); echo "</div>\n"; echo "</div>\n"; add_to_jquery("\n \$('#toggle_options').bind('click', function(e) {\n \$('#news_filter_options').slideToggle();\n var caret_status = \$('#filter_caret').hasClass('fa-caret-down');\n if (caret_status == 1) {\n \$('#filter_caret').removeClass('fa-caret-down').addClass('fa-caret-up');\n \$(this).removeClass('btn-default').addClass('btn-info');\n } else {\n \$('#filter_caret').removeClass('fa-caret-up').addClass('fa-caret-down');\n \$(this).removeClass('btn-info').addClass('btn-default');\n }\n });\n\n // Select change\n \$('#news_status, #news_visibility, #news_category, #news_language, #news_author').bind('change', function(e){\n \$(this).closest('form').submit();\n });\n "); unset($filter_values['news_text']); echo "<div id='news_filter_options'" . ($filter_empty == FALSE ? "" : " style='display:none;'") . ">\n"; echo "<div class='display-inline-block'>\n"; echo form_select("news_cat_status", "", $filter_values['news_cat_status'], array("allowclear" => TRUE, "placeholder" => "- Select Status -", "options" => array(0 => "All Status", 1 => "Draft", 2 => "Sticky"))); echo "</div>\n"; echo "<div class='display-inline-block'>\n"; echo form_select("news_cat_visibility", "", $filter_values['news_cat_visibility'], array("allowclear" => TRUE, "placeholder" => "- Select Access -", "options" => fusion_get_groups())); echo "</div>\n"; echo "<div class='display-inline-block'>\n"; $language_opts = array(0 => "All Language"); $language_opts += fusion_get_enabled_languages(); echo form_select("news_cat_language", "", $filter_values['news_cat_language'], array("allowclear" => TRUE, "placeholder" => "- Select Language -", "options" => $language_opts)); echo "</div>\n"; echo "</div>\n"; echo closeform(); ?> </div> <?php echo openform("news_table", "post", FUSION_REQUEST); echo form_hidden("table_action", "", ""); display_news_category($result); echo closeform(); echo "<div class='text-center'><a class='btn btn-primary' href='" . ADMIN . "images.php" . $aidlink . "&ifolder=imagesnc'>" . $locale['news_0304'] . "</a><br /><br />\n</div>\n"; }
public function display_administration_form() { global $aidlink; pageAccess("SL"); $locale = fusion_get_locale("", LOCALE . LOCALESET . "admin/sitelinks.php"); if (isset($_POST['cancel'])) { redirect(FUSION_SELF . $aidlink); } $title = $locale['SL_0001']; if (isset($_GET['ref']) && $_GET['ref'] == "link_form") { $title = isset($_GET['link_id']) && $this->verify_sitelinks($_GET['link_id']) ? $locale['SL_0011'] : $locale['SL_0010']; } $master_title['title'][] = $title; $master_title['id'][] = "links"; $master_title['icon'][] = ''; $master_title['title'][] = $locale['SL_0041']; $master_title['id'][] = "settings"; $master_title['icon'][] = ''; $link_index = dbquery_tree(DB_SITE_LINKS, "link_id", "link_cat"); $link_data = dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat"); make_page_breadcrumbs($link_index, $link_data, "link_id", "link_name", "link_cat"); opentable($locale['SL_0012']); echo opentab($master_title, isset($_GET['section']) ? $_GET['section'] : "links", 'link', TRUE); if (isset($_GET['section']) && $_GET['section'] == "settings") { $this->display_sitelinks_settings(); } else { if (isset($_GET['ref'])) { switch ($_GET['ref']) { case "link_form": $this->display_sitelinks_form(); break; default: $this->display_sitelinks_list(); } } else { $this->display_sitelinks_list(); } } echo closetab(); closetable(); }
/** * Fetches Site Links Hierarchy Data - for a less support complexity * @param array $options * - join * - link_position (array) * - condition * - group * - order * @return array */ public static function get_SiteLinksData(array $options = array()) { $default_position = array(2, 3); $default_link_filter = array('join' => '', 'position_condition' => '(sl.link_position=' . ($options['link_position'] ? implode(' OR sl.link_position=', $options['link_position']) : implode(' OR sl.link_position=', $default_position)) . ')', 'condition' => (multilang_table("SL") ? " AND link_language='" . LANGUAGE . "'" : "") . " AND " . groupaccess('link_visibility'), 'group' => '', 'order' => "link_cat ASC, link_order ASC"); $options += $default_link_filter; $query_replace = ""; if (!empty($options)) { $query_replace = "SELECT sl.* " . (!empty($options['select']) ? ", " . $options['select'] : '') . " "; $query_replace .= "FROM " . DB_SITE_LINKS . " sl "; $query_replace .= $options['join'] . " "; $query_replace .= "WHERE " . $options['position_condition'] . $options['condition']; $query_replace .= (!empty($options['group']) ? " GROUP BY " . $options['group'] . " " : "") . " ORDER BY " . $options['order']; } return (array) dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat", "", $query_replace); }
public function load_fields() { $this->page = dbquery_tree_full($this->category_db, "field_cat_id", "field_parent", "ORDER BY field_cat_order ASC"); $result = dbquery("\n SELECT field.*,\n cat.field_cat_id, cat.field_cat_name, cat.field_parent, cat.field_cat_class,\n\t\troot.field_cat_id as page_id, root.field_cat_name as page_name, root.field_cat_db, root.field_cat_index FROM\n\t\t" . $this->field_db . " field\n\t\tLEFT JOIN " . $this->category_db . " cat on (cat.field_cat_id = field.field_cat)\n\t\tLEFT JOIN " . $this->category_db . " root on (root.field_cat_id = cat.field_parent)\n\t\tORDER BY cat.field_cat_order ASC, field.field_order ASC\n\t\t"); $this->max_rows = dbrows($result); if ($this->max_rows > 0) { while ($data = dbarray($result)) { $this->fields[$data['field_cat']][] = $data; } } }
/** * Displays Site Links Navigation Bar * @param string $sep - Custom seperator text * @param string $class - Class * @param array $options - Expansions 9.1 * @param int $id - 0 for root , Sitelink_ID to show child only * @return string */ function showsublinks($sep = "", $class = "", array $options = array(), $id = 0) { $pageInfo = pathinfo($_SERVER['SCRIPT_NAME']); $start_page = $pageInfo['dirname'] !== "/" ? ltrim($pageInfo['dirname'], "/") . "/" : ""; $site_path = ltrim(fusion_get_settings("site_path"), "/"); $start_page = str_replace($site_path, "", $start_page); $start_page .= $pageInfo['basename']; if (fusion_get_settings("site_seo") && defined('IN_PERMALINK') && !isset($_GET['aid'])) { global $filepath; $start_page = $filepath; } static $data = array(); $res =& $res; if (empty($data)) { $data = dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat", "WHERE link_position >= 2" . (multilang_table("SL") ? " AND link_language='" . LANGUAGE . "'" : "") . " AND " . groupaccess('link_visibility') . " ORDER BY link_cat, link_order"); } if ($id == 0) { $res = "<div id='pf-navbar' class='navbar navbar-default' role='navigation'>\n"; $res .= "<div class='navbar-header'>\n"; $res .= "<!---Menu Header Start--->\n"; $res .= "<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#phpfusion-menu' aria-expanded='false'>\n\t\t\t\t\t<span class='sr-only'>Toggle navigation</span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n \t\t\t</button>\n"; $res .= "<a class='navbar-brand visible-xs hidden-sm hidden-md hidden-lg' href='#'>" . fusion_get_settings("sitename") . "</a>\n"; $res .= "<!---Menu Header End--->\n"; $res .= "</div>\n"; $res .= "<div class='navbar-collapse collapse' id='phpfusion-menu'>\n"; $res .= "<ul " . (fusion_get_settings("bootstrap") ? "class='nav navbar-nav primary'" : "id='main-menu' class='primary sm sm-simple'") . ">\n"; $res .= "<!---Menu Item Start--->\n"; } //else { //$res .= "<ul".(fusion_get_settings("bootstrap") ? " class='dropdown-menu'" : "").">\n"; //} if (!empty($data)) { $i = 0; foreach ($data[$id] as $link_id => $link_data) { $li_class = $class; // Attempt to calculate a relative link $secondary_active = FALSE; if ($start_page !== $link_data['link_url']) { $link_instance = \PHPFusion\BreadCrumbs::getInstance(); $link_instance->showHome(FALSE); $reference = $link_instance->toArray(); if (!empty($reference)) { foreach ($reference as $refData) { if (!empty($refData['link']) && $link_data['link_url'] !== "index.php") { if (stristr($refData['link'], str_replace("index.php", "", $link_data['link_url']))) { $secondary_active = TRUE; } break; } } } } if ($link_data['link_name'] != "---" && $link_data['link_name'] != "===") { $link_target = $link_data['link_window'] == "1" ? " target='_blank'" : ""; if ($i == 0 && $id > 0) { $li_class .= ($li_class ? " " : "") . "first-link"; } if ($start_page == $link_data['link_url'] || $secondary_active == TRUE || $start_page == fusion_get_settings("opening_page") && $i == 0 && $id === 0) { $li_class .= ($li_class ? " " : "") . "current-link active"; } if (preg_match("!^(ht|f)tp(s)?://!i", $link_data['link_url'])) { $itemlink = $link_data['link_url']; } else { $itemlink = BASEDIR . $link_data['link_url']; } $has_child = false; $l_1 = ""; $l_2 = ""; if (isset($data[$link_id])) { $has_child = true; $l_1 = "class='dropdown-toggle' data-toggle='dropdown' "; $l_2 = " <i class='caret'></i>\n"; $li_class .= " dropdown"; } $res .= "<li" . ($li_class ? " class='" . $li_class . "'" : "") . ">" . $sep . "\n"; $res .= "<a " . $l_1 . "href='" . $itemlink . "'" . $link_target . ">" . $link_data['link_name'] . $l_2 . "</a>\n"; if ($has_child) { $res .= "<ul" . (fusion_get_settings("bootstrap") ? " class='dropdown-menu'" : "") . ">\n"; $res .= "<li>" . $sep . "\n"; $res .= "<a href='" . $itemlink . "'" . $link_target . ">" . $link_data['link_name'] . "</a>\n"; $res .= "</li>\n"; $res .= showsublinks($sep, $class, $options, $link_data['link_id']); $res .= "</ul>\n"; } $res .= "</li>\n"; } elseif ($link_data['link_cat'] > 0) { echo "<li class='divider'></li>"; } $i++; } } if ($id == 0) { $res .= "<!---Menu Item End--->\n"; $res .= "</ul>\n"; $res .= "</div>\n</div>\n"; //} else { //$res .= "</ul>\n"; //} } /** Smart Menus */ /* add_to_jquery(" $('li.dropdown').hover( function(e) { $(this).addClass('open'); }, function(e) { $(this).removeClass('open'); } ); "); */ return $res; }
public function set_Fields() { // get the page first. $this->page = dbquery_tree_full($this->category_db, 'field_cat_id', 'field_parent', "ORDER BY field_cat_order ASC"); // there is only 2 layer in fields $result = dbquery("SELECT field.*, cat.field_cat_id, cat.field_cat_name, cat.field_parent, cat.field_cat_class,\n\t\troot.field_cat_id as page_id, root.field_cat_name as page_name, root.field_cat_db, root.field_cat_index FROM\n\t\t" . $this->field_db . " field\n\t\tLEFT JOIN " . $this->category_db . " cat on (cat.field_cat_id = field.field_cat)\n\t\tLEFT JOIN " . $this->category_db . " root on (root.field_cat_id = cat.field_parent)\n\t\tORDER BY cat.field_cat_order ASC, field.field_order ASC\n\t\t"); $this->max_rows = dbrows($result); if ($this->max_rows > 0) { while ($data = dbarray($result)) { $this->fields[$data['field_cat']][] = $data; } } }