function parent_list($parent)
{
    global $admin, $database, $template, $results_array;
    $options = '';
    $query = "SELECT * FROM " . TABLE_PREFIX . "pages WHERE parent = '{$parent}' ORDER BY position ASC";
    $get_pages = $database->query($query);
    while ($page = $get_pages->fetchRow()) {
        if ($admin->page_is_visible($page) == false) {
            continue;
        }
        // If the current page cannot be parent, then its children neither
        $list_next_level = true;
        // Stop users from adding pages with a level of more than the set page level limit
        if ($page['level'] + 1 < PAGE_LEVEL_LIMIT) {
            // Get user perms
            $admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
            $admin_users = explode(',', str_replace('_', '', $page['admin_users']));
            $in_group = FALSE;
            foreach ($admin->get_groups_id() as $cur_gid) {
                if (in_array($cur_gid, $admin_groups)) {
                    $in_group = TRUE;
                }
            }
            if ($in_group or is_numeric(array_search($admin->get_user_id(), $admin_users))) {
                $can_modify = true;
            } else {
                $can_modify = false;
            }
            // Title -'s prefix
            $title_prefix = '';
            for ($i = 1; $i <= $page['level']; $i++) {
                $title_prefix .= ' - ';
            }
            $options .= "<option value={$page['page_id']}>{$title_prefix}{$page['page_title']}</option>";
        }
        if ($list_next_level) {
            $options .= parent_list($page['page_id']);
        }
    }
    return $options;
}
Exemple #2
0
function parent_list($parent)
{
    global $admin, $database, $template, $results_array, $field_set;
    $sql = 'SELECT * FROM `' . TABLE_PREFIX . 'pages` WHERE `parent` = ' . $parent . ' ORDER BY `position` ASC';
    $get_pages = $database->query($sql);
    while (false !== ($page = $get_pages->fetchRow(MYSQL_ASSOC))) {
        if ($admin->page_is_visible($page) == false) {
            continue;
        }
        // if parent = 0 set flag_icon
        $template->set_var('FLAG_ROOT_ICON', ' none ');
        if ($page['parent'] == 0 && $field_set) {
            $template->set_var('FLAG_ROOT_ICON', 'url(' . THEME_URL . '/images/flags/' . strtolower($page['language']) . '.png)');
        }
        // If the current page cannot be parent, then its children neither
        $list_next_level = true;
        // Stop users from adding pages with a level of more than the set page level limit
        if ($page['level'] + 1 < PAGE_LEVEL_LIMIT) {
            // Get user perms
            $admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
            $admin_users = explode(',', str_replace('_', '', $page['admin_users']));
            $in_group = FALSE;
            foreach ($admin->get_groups_id() as $cur_gid) {
                if (in_array($cur_gid, $admin_groups)) {
                    $in_group = TRUE;
                }
            }
            if ($in_group or is_numeric(array_search($admin->get_user_id(), $admin_users))) {
                $can_modify = true;
            } else {
                $can_modify = false;
            }
            // Title -'s prefix
            $title_prefix = '';
            for ($i = 1; $i <= $page['level']; $i++) {
                $title_prefix .= ' - ';
            }
            $template->set_var(array('ID' => $page['page_id'], 'TITLE' => $title_prefix . $page['menu_title'], 'MENU-TITLE' => $title_prefix . $page['menu_title'], 'PAGE-TITLE' => $title_prefix . $page['page_title'], 'FLAG_ICON' => ' none '));
            if ($results_array['parent'] == $page['page_id']) {
                $template->set_var('SELECTED', ' selected="selected"');
            } elseif ($results_array['page_id'] == $page['page_id']) {
                $template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
                $list_next_level = false;
            } elseif ($can_modify != true) {
                $template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
            } else {
                $template->set_var('SELECTED', '');
            }
            $template->parse('page_list2', 'page_list_block2', true);
        }
        if ($list_next_level) {
            parent_list($page['page_id']);
        }
    }
}
function parent_list($parent)
{
    global $admin, $database, $template, $field_set;
    $query = "SELECT * FROM `" . TABLE_PREFIX . "pages` WHERE `parent` = '{$parent}' AND `visibility` !='deleted' ORDER BY `position` ASC";
    $get_pages = $database->query($query);
    while ($page = $get_pages->fetchRow(MYSQLI_ASSOC)) {
        if ($admin->page_is_visible($page) == false) {
            continue;
        }
        // if parent = 0 set flag_icon
        $template->set_var('FLAG_ROOT_ICON', ' none ');
        if ($page['parent'] == 0 && $field_set) {
            $template->set_var('FLAG_ROOT_ICON', 'url(' . THEME_URL . '/images/flags/' . strtolower($page['language']) . '.png)');
        }
        // Stop users from adding pages with a level of more than the set page level limit
        if ($page['level'] <= PAGE_LEVEL_LIMIT + 1) {
            // Get user perms
            $admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
            $admin_users = explode(',', str_replace('_', '', $page['admin_users']));
            $in_group = FALSE;
            foreach ($admin->get_groups_id() as $cur_gid) {
                if (in_array($cur_gid, $admin_groups)) {
                    $in_group = TRUE;
                }
            }
            if ($in_group || is_numeric(array_search($admin->get_user_id(), $admin_users))) {
                $can_modify = true;
            } else {
                $can_modify = false;
            }
            // Title -'s prefix
            $title_prefix = '';
            for ($i = 1; $i <= $page['level']; $i++) {
                $title_prefix .= ' - - &nbsp;';
            }
            $template->set_var(array('ID' => $page['page_id'], 'TITLE' => $title_prefix . $page['menu_title'], 'MENU-TITLE' => $title_prefix . $page['menu_title'], 'PAGE-TITLE' => $title_prefix . $page['page_title']));
            if ($can_modify == true) {
                $template->set_var('DISABLED', '');
            } else {
                $template->set_var('DISABLED', ' disabled="disabled" class="disabled"');
            }
            $template->parse('page_list2', 'page_list_block2', true);
        }
        parent_list($page['page_id']);
    }
}
 function parent_list($parent)
 {
     global $admin, $database, $template;
     $query = "SELECT * FROM " . TABLE_PREFIX . "pages WHERE parent = '{$parent}' AND visibility!='deleted' ORDER BY position ASC";
     $get_pages = $database->query($query);
     while ($page = $get_pages->fetchRow()) {
         // Stop users from adding pages with a level of more than the set page level limit
         if ($page['level'] + 1 < PAGE_LEVEL_LIMIT) {
             // Get user perms
             $admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
             $admin_users = explode(',', str_replace('_', '', $page['admin_users']));
             if (is_numeric(array_search($admin->get_group_id(), $admin_groups)) or is_numeric(array_search($admin->get_user_id(), $admin_users))) {
                 $can_modify = true;
             } else {
                 $can_modify = false;
             }
             // Title -'s prefix
             $title_prefix = '';
             for ($i = 1; $i <= $page['level']; $i++) {
                 $title_prefix .= ' - ';
             }
             $template->set_var(array('ID' => $page['page_id'], 'TITLE' => $title_prefix . $page['page_title']));
             if ($can_modify == true) {
                 $template->set_var('DISABLED', '');
             } else {
                 $template->set_var('DISABLED', ' disabled');
             }
             $template->parse('page_list2', 'page_list_block2', true);
         }
         parent_list($page['page_id']);
     }
 }