function ShowSubsForFavorites($structure = 0, $parent_section = 0, $catid = 0, $phase = 0) { global $db, $perm, $ADMIN_TEMPLATE; static $count, $init, $sub_admin; if (!$init) { // разделы, для к-ых пол-тель является админом $allow_id = $perm->GetAllowSub($catid, MASK_ADMIN, false, true, false); $qry_where = is_array($allow_id) ? " `Subdivision_ID` IN(" . join(',', (array) $allow_id) . ") " : " 1"; $sub_admin = (array) $db->get_col("SELECT `Subdivision_ID`\n FROM `Subdivision`\n WHERE " . $qry_where); $init = true; } echo "<ul" . (!$parent_section ? " id='siteTree'" : "") . " style='margin-left: 5px; padding-left: 0;'>\n"; foreach ($structure as $id => $row) { if ($row["Parent_Sub_ID"] == $parent_section) { $count++; if (!$row["Parent_Sub_ID"]) { $count = 0; } if (in_array($row['Subdivision_ID'], $sub_admin)) { echo "<li class='menu_left_sub'>\n\n <i class='nc-icon nc--folder " . (!$row['Checked'] ? "nc--disabled" : "") . "'></i>\n\n <span class='node_id'>" . $row['Subdivision_ID'] . "</span> " . ($row["Favorite"] ? " " : "<a href=# onclick=\"add_to_favorites({$row['Subdivision_ID']}, " . ($phase + 1) . "); return false;\" style='" . (!$row['Checked'] ? "color:#cccccc;" : "") . "'>") . "" . $row['Subdivision_Name'] . "</a>\n"; } else { //нет доступа - просто показываем echo "<li class='menu_left_sub'><i class='nc-icon nc--folder " . (!$row['Checked'] ? "nc--disabled" : "") . "'></i>\n <span class='node_id'>" . $row['Subdivision_ID'] . "</span> " . $row['Subdivision_Name'] . "\n"; } ShowSubsForFavorites($structure, $id, 0, $phase); $count--; } } echo "</ul>\n"; unset($structure); }
# покажем список рубрик BeginHtml($Title2, $Title2, "http://" . $DOC_DOMAIN . "/management/favorites/"); $UI_CONFIG = new ui_config_favorite('list'); ShowFavorites(); //echo "<a href=# onclick=\"window.open('".$ADMIN_PATH."subdivision/favorites.php?phase=4','LIST','top=50, left=100,directories=no,height=600,location=no,menubar=no,resizable=no,scrollbars=yes,status=yes,toolbar=no,width=400');return false;\"><b>".CONTROL_CONTENT_SUBDIVISION_FUNCS_ADDSECTION."</b></a>"; break; case 4: case 2: // покажем список разделов всего сайта для добавления в избранное $structure = GetSubsForFavorites(0, "get_children", $catid); print "<html>\n\t\t <title>" . SECTION_CONTROL_CONTENT_FAVORITES . "</title>\n\t\t <head>\n\t\t <link type='text/css' rel='Stylesheet' href='" . $ADMIN_TEMPLATE . "css/admin.css'>\n\t\t " . nc_css() . "\n\t\t <script>\n\n\t\t function add_to_favorites(sub_id, phase)\n {\n"; print "opener.frames['mainViewIframe'].location.href='" . $ADMIN_PATH . "subdivision/favorites.php?phase='+phase+'&subid='+sub_id;"; print "\n}\n\n\t\t </script>\n\t\t </head>\n\t\t <body style='overflow-y: visible;'>"; echo "<div id='menu_left' style='padding: 15px;'>\n <div class='menu_left_block' style='overflow: visible;'>"; ShowCataloguesForFavorites($catid, $phase); ShowSubsForFavorites($structure, 0, $catid, $phase); echo "</div></div>"; echo "</body></html>"; break; case 3: //Добавление в избранное if ($perm->isSubdivisionAdmin($subid)) { AddFavorites($subid); } header("Location: http://" . $HTTP_HOST . "" . $ADMIN_PATH . ""); break; case 5: //Добавление в избранное if ($perm->isSubdivisionAdmin($subid)) { AddFavorites($subid); }