Example #1
0
/**
 * Show all catalogue
 *
 */
function ShowCatalogueList()
{
    global $db;
    global $EDIT_DOMAIN, $HTTP_ROOT_PATH, $DOMAIN_NAME, $ADMIN_PATH, $ADMIN_TEMPLATE, $SUB_FOLDER;
    $nc_core = nc_Core::get_object();
    $all_sites = $nc_core->catalogue->get_all();
    if (!empty($all_sites)) {
        $td = "<td>";
        echo "\n\t\t<form method='post' action='index.php'>\n\n\t\t<table border='0' cellpadding='0' cellspacing='0' width='99%' class='border-bottom'>\n\t\t<tr>\n\t\t<td>ID</td>\n\t\t<td width='60%'>" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_SITE . "</td>\n\t\t<td>" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_SUBSECTIONS . "</td>\n\t\t<td>\n\t\t  <div class='icons icon_prior' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_PRIORITY . "'></div></td>\n\t\t<td>" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_GOTO . "</td>\n\t\t<td>\n\t\t  <div class='icons icon_delete' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_DELETE . "'></div></td>\n \t\t</tr>";
        foreach ($all_sites as $site) {
            print "<tr>";
            print $td . (!$site['Checked'] ? "<font>" : "<font>") . $site['Catalogue_ID'] . "</font></td>";
            print $td . "<a href='{$ADMIN_PATH}subdivision/full.php?CatalogueID={$site['Catalogue_ID']}'>" . (!$site['Checked'] ? "<font color='cccccc'>" : "<font>") . $site['Catalogue_Name'] . "</a></font></td>";
            print $td . "<a href='" . $ADMIN_PATH . "subdivision/?CatalogueID=" . $site['Catalogue_ID'] . "'>" . (!$site['Checked'] ? "<font color=cccccc>" : "") . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_LIST . " (" . HighLevelChildrenNumber($site['Catalogue_ID']) . ")</a></td>\n";
            print "<td>" . nc_admin_input_simple("Priority" . $site['Catalogue_ID'], $site['Priority'] ? $site['Priority'] : 0, 3, "class='s' maxlength='5'") . "</td>\n";
            print "<td>";
            //setup
            print "<a href=index.php?phase=2&CatalogueID=" . $site['Catalogue_ID'] . "&type=2><div class='icons icon_settings" . (!$site['Checked'] ? "_disabled" : "") . "' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_TOOPTIONS . "'></div></a>";
            //edit
            print !GetSubClassCount($site['Title_Sub_ID']) ? "<img src=" . $ADMIN_PATH . "images/emp.gif width=18 height=18 style='margin:0px 2px 0px 2px;'>" : "<a target=_blank href=http://" . $EDIT_DOMAIN . $SUB_FOLDER . $HTTP_ROOT_PATH . "?catalogue=" . $site['Catalogue_ID'] . "&sub=" . $site['Title_Sub_ID'] . (nc_strlen(session_id()) > 0 ? "&" . session_name() . "=" . session_id() . "" : "") . "><div class='icons icon_pencil" . (!$site['Checked'] ? "_disabled" : "") . "' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_EDIT . "'></div></a>";
            //browse
            print "<a href=http://" . ($site['Domain'] ? strchr($site['Domain'], ".") ? $site['Domain'] : $site['Domain'] . "." . $DOMAIN_NAME : $DOMAIN_NAME) . $SUB_FOLDER . (nc_strlen(session_id()) > 0 ? "?" . session_name() . "=" . session_id() . "" : "") . " target=_blank><div class='icons icon_preview" . (!$site['Checked'] ? "_disabled" : "") . "' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_SHOW . "'></div></a>";
            print "</td>";
            print "<td>" . nc_admin_checkbox_simple("Delete" . $site['Catalogue_ID'], $site['Catalogue_ID']) . "</td>\n";
            print "</tr>\n";
        }
        echo "\n \t\t</table>\n\t\t<br />\n    " . $nc_core->token->get_input() . "\n \t\t<input type=hidden name=phase value='4' />\n \t\t<input class='hidden' type='submit' />\n \t\t</form>\n\t  ";
    } else {
        echo CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_NONE . "<br /><br />";
    }
    return 0;
}
Example #2
0
function ShowFavorites()
{
    global $db, $UI_CONFIG, $nc_core;
    global $EDIT_DOMAIN, $HTTP_ROOT_PATH, $DOMAIN_NAME;
    global $loc, $perm, $ADMIN_PATH, $ADMIN_TEMPLATE, $SUB_FOLDER;
    $favorites = GetFavorites('OBJECT');
    if ($favorites) {
        $totrows = $db->num_rows;
        ?>
        <form method='post' action='favorites.php'>
            <table border='0' cellpadding='0' cellspacing='0' width='100%'>
                <tr>
                    <td>
                        <table class='admin_table' width='100%'>
                            <tr>
                                <th>ID</th>
								<th width='100%'><?php 
        echo CONTROL_CONTENT_SUBDIVISION_FUNCS_SECTION;
        ?>
</th>
								<th><?php 
        echo CONTROL_CONTENT_SUBDIVISION_FUNCS_SUBSECTIONS;
        ?>
</th>
								<th class='align-center'><?php 
        echo CONTROL_CONTENT_SUBDIVISION_FUNCS_GOTO;
        ?>
</th>
								<td class='align-center'><div class='icons icon_delete' title='<?php 
        echo CONTROL_CONTENT_SUBDIVISION_FUNCS_DELETE;
        ?>
'></div></td>
							</tr>

		<?php 
        $temp_group = "";
        foreach ($favorites as $Array) {
            if ($temp_group != $Array->Catalogue_ID) {
                print "<tr><td'><br></td><td colspan=5><a href=" . $ADMIN_PATH . "subdivision/full.php?CatalogueID=" . $Array->Catalogue_ID . " title='" . CONTROL_CONTENT_CATALOUGE_ONESITE . "'>" . (!$Array->CatalogueChecked ? "" : "") . $Array->Catalogue_Name . (!$Array->CatalogueChecked ? "" : "") . "</a></td></tr>";
            }
            print "<tr>\n                     <td>" . $Array->Subdivision_ID . "</td>\n                     <td><a href=\"index.php?phase=4&SubdivisionID=" . $Array->Subdivision_ID . "\">" . (!$Array->SubChecked ? "" : "") . $Array->Subdivision_Name . "</a></td>\n                     <td><a href=index.php?phase=1&ParentSubID=" . $Array->Subdivision_ID . ">" . (!$Array->SubChecked ? "" : "") . (!ChildrenNumber($Array->Subdivision_ID) ? CONTROL_CONTENT_SUBDIVISION_FUNCS_NONE : CONTROL_CONTENT_SUBDIVISION_FUNCS_LIST . " (" . ChildrenNumber($Array->Subdivision_ID) . ")") . "</a></td>\n                     <td align=center nowrap><a href=index.php?phase=5&SubdivisionID=" . $Array->Subdivision_ID . "><div class='icons icon_settings' title='" . CONTROL_CONTENT_SUBDIVISION_FUNCS_TOOPTIONS . "'></div></a>" . (!GetSubClassCount($Array->Subdivision_ID) ? "<img src=" . $ADMIN_TEMPLATE . "img/px.gif width=16 height=16 style='margin:0px 2px 0px 2px;'>" : "<a target=_blank href=http://" . $EDIT_DOMAIN . $HTTP_ROOT_PATH . "?catalogue=" . $Array->Catalogue_ID . "&sub=" . $Array->Subdivision_ID . (session_id() ? "?" . session_name() . "=" . session_id() : "") . "><div class='icons icon_pencil' title='" . CONTROL_CONTENT_SUBDIVISION_FUNCS_TOEDIT . "'></div></a>") . "<a href=" . nc_subdivision_preview_link($Array) . " target=_blank><div class='icons icon_preview' title='" . CONTROL_CONTENT_SUBDIVISION_FUNCS_TOVIEW . "'></div></a></td>\n                     <td align=center>" . nc_admin_checkbox_simple("Delete[" . $Array->Subdivision_ID . "]", $Array->Subdivision_ID) . "</td>\n\n                   </tr>\n";
            $temp_group = $Array->Catalogue_ID;
        }
        ?>
                                                                        </table>
                                                                        </td>
                                                                        </tr>
                                                                        </table>
                                                                        <input type='hidden' name='phase' value='6'>
                                                                        <input type='submit' class='hidden'>
                                                                        <?php 
        echo $nc_core->token->get_input();
        ?>
                                                                        </form>
                                                                        <?php 
        $UI_CONFIG->actionButtons[] = array("id" => "delete", "caption" => NETCAT_ADMIN_DELETE_SELECTED, "action" => "mainView.submitIframeForm()", "align" => "left", "red_border" => true);
    } else {
        nc_print_status(CONTROL_CONTENT_SUBDIVISION_FUNCS_NOONEFAVORITES, 'info');
    }
    $UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => CONTROL_CONTENT_SUBDIVISION_FUNCS_ADDSECTION, "action" => "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')");
}
Example #3
0
function write_sub($ParentSubID, $CatalogueID, $count = 1)
{
    global $db, $nc_core;
    global $DOMAIN_NAME, $HTTP_ROOT_PATH, $EDIT_DOMAIN, $DOMAIN_NAME, $SUB_FOLDER, $ADMIN_PATH, $ADMIN_TEMPLATE;
    global $perm;
    $CatalogueID = intval($CatalogueID);
    $ParentSubID = intval($ParentSubID);
    static $security_limit, $initialized;
    if (!$initialized) {
        $initialized = true;
        $allow_id = $perm->GetAllowSub($CatalogueID, MASK_ADMIN | MASK_MODERATE);
        $security_limit = is_array($allow_id) && !$perm->isGuest() ? " Subdivision_ID IN (" . join(', ', (array) $allow_id) . ")" : " 1";
    }
    $Result = $db->get_results("SELECT a.Subdivision_ID,a.Subdivision_Name,a.Priority,a.Checked,a.Hidden_URL,b.Domain,a.Catalogue_ID,a.ExternalURL FROM Subdivision AS a, Catalogue AS b\n    WHERE a.Catalogue_ID=b.Catalogue_ID AND a.Catalogue_ID=" . $CatalogueID . "\n    AND a.Parent_Sub_ID='" . $ParentSubID . "' AND " . $security_limit . " ORDER BY a.Priority", ARRAY_N);
    if (empty($Result)) {
        return "";
    }
    $cat_fields = $nc_core->catalogue->get_all();
    foreach ($cat_fields as $kc => $vc) {
        foreach ($vc as $ks => $vs) {
            if ($ks == 'Title_Sub_ID' || $ks == 'E404_Sub_ID') {
                $subs_serv[] = $vs;
            }
        }
    }
    foreach ($Result as $Array) {
        $result .= "<tr>";
        $result .= "<td class='name " . ($Array[3] ? "active" : "unactive") . "' style='padding-left: " . ($count + 15) . "px;'>\n            <img src='" . $ADMIN_PATH . "images/arrow_sec.gif' width='14' height='10' alt='' title=''><span>" . $Array[0] . ". </span>\n            <a href='" . $ADMIN_PATH . "subdivision/index.php?phase=5&SubdivisionID={$Array[0]}&view=edit'>" . $Array[1] . "</a>\n            </td>";
        // edit
        $result .= "<td class='nc--compact'>";
        if (GetSubClassCount($Array[0])) {
            $cc_id = $db->get_var("SELECT Sub_Class_ID FROM Sub_Class WHERE Subdivision_ID = '" . $Array[0] . "'");
            $result .= "<a href='http://" . $EDIT_DOMAIN . $SUB_FOLDER . $HTTP_ROOT_PATH . "?inside_admin=1&cc=" . $cc_id . (strlen(session_id()) > 0 ? "&" . session_name() . "=" . session_id() . "" : "") . "'><i class='nc-icon nc--edit nc--hovered' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWMENU_A_EDIT . "'></i></a>";
        }
        $result .= "</td>";
        // view
        $show_url_arr = array("Hidden_URL" => $Array[4], "Domain" => $Array[5], "ExternalURL" => $Array[7], "Subdivision_ID" => $Array[0]);
        $result .= "<td class='nc--compact'><a href='" . nc_subdivision_preview_link($show_url_arr) . "' target='_blank'><i class='nc-icon nc--arrow-right nc--hovered' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWMENU_A_VIEW . "'></i></a></td>";
        // add
        $result .= "<td class='nc--compact'><a href='" . $ADMIN_PATH . "subdivision/index.php?phase=2&ParentSubID=" . $Array[0] . "'><i class='nc-icon nc--folder-add nc--hovered' title='" . CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_A_ADDSUBSECTION . "'></i></a></td>";
        // settings
        $result .= "<td class='nc--compact'><a href='" . $ADMIN_PATH . "subdivision/index.php?view=edit&phase=5&SubdivisionID=" . $Array[0] . "'><i class='nc-icon nc--settings nc--hovered' title='" . CONTROL_CONTENT_SUBDIVISION_FUNCS_TOOPTIONS . "'></i></a></td>";
        // checkbox
        $disabled = in_array($Array[0], $subs_serv) ? " disabled='disabled'" : '';
        $result .= "<td class='nc--compact nc-padding-10 nc-text-center'><input name='Delete" . $Array[0] . "' value='" . $Array[0] . "' type='checkbox'" . $disabled . "></td>";
        $result .= "</tr>";
        $result .= write_sub($Array[0], $CatalogueID, $count + 20);
    }
    return $result;
}