示例#1
0
function configure_frontend($option)
{
    global $my, $booklibrary_configuration, $acl, $database;
    global $mosConfig_absolute_path;
    $yesno[] = mosHTML::makeOption('1', _BOOKLIBRARY_YES);
    $yesno[] = mosHTML::makeOption('0', _BOOKLIBRARY_NO);
    $gtree[] = mosHTML::makeOption('-2', 'Everyone');
    $gtree = get_group_children_tree_bl();
    $lists = array();
    $f = "";
    $s = explode(',', $booklibrary_configuration['reviews']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['reviews']['show'] = mosHTML::RadioList($yesno, 'reviews_show', 'class="inputbox"', $booklibrary_configuration['reviews']['show'], 'value', 'text');
    $lists['reviews']['registrationlevel'] = mosHTML::selectList($gtree, 'reviews_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $f = "";
    $s = explode(',', $booklibrary_configuration['litpage']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $f = "";
    $s = explode(',', $booklibrary_configuration['lendrequest']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['lendstatus']['show'] = mosHTML::RadioList($yesno, 'lendstatus_show', 'class="inputbox"', $booklibrary_configuration['lendstatus']['show'], 'value', 'text');
    $lists['lendrequest']['registrationlevel'] = mosHTML::selectList($gtree, 'lendrequest_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $f = "";
    $s = explode(',', $booklibrary_configuration['ebooks']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['ebooks']['registrationlevel'] = mosHTML::selectList($gtree, 'ebooks_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $lists['ebooks']['show'] = mosHTML::RadioList($yesno, 'ebooks_show', 'class="inputbox"', $booklibrary_configuration['ebooks']['show'], 'value', 'text');
    $f = "";
    $s = explode(',', $booklibrary_configuration['price']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['price']['show'] = mosHTML::RadioList($yesno, 'price_show', 'class="inputbox"', $booklibrary_configuration['price']['show'], 'value', 'text');
    $lists['price']['registrationlevel'] = mosHTML::selectList($gtree, 'price_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    //********   begin add button 'buy now'   ************************/
    $ctree[] = mosHTML::makeOption('-2', 'All Categories');
    $id = 0;
    $list = CAT_Utils::categoryArray();
    $cat = new mainBooklibraryCategories($database);
    //for 1.6
    $cat->load($id);
    $this_treename = '';
    $options = array();
    foreach ($list as $item) {
        if ($this_treename) {
            if ($item->id != $cat->id && strpos($item->treename, $this_treename) === false) {
                $options[] = mosHTML::makeOption($item->id, $item->treename);
            }
        } else {
            if ($item->id != $cat->id) {
                $options[] = mosHTML::makeOption($item->id, $item->treename);
            } else {
                $this_treename = "{$item->treename}/";
            }
        }
    }
    //$ctree = array_merge($ctree, $options);
    if (count($options) > 0) {
        $ctree = array_merge($ctree, $options);
    }
    $f = "";
    $s = explode(',', $booklibrary_configuration['buy_now']['allow']['categories']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['buy_now']['show'] = mosHTML::RadioList($yesno, 'buy_now_show', 'class="inputbox"', $booklibrary_configuration['buy_now']['show'], 'value', 'text');
    $lists['buy_now']['allow']['categories'] = mosHTML::selectList($ctree, 'buy_now_allow_categories[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    //*************   end add button 'buy now'   ************************/
    $query = 'show columns from #__booklibrary';
    $database->setQuery($query);
    $columns = $database->loadObjectList();
    $col_list[] = mosHTML::makeOption('title', 'title');
    $col_list[] = mosHTML::makeOption('authors', 'authors');
    $col_list[] = mosHTML::makeOption('rating', 'rating');
    $col_list[] = mosHTML::makeOption('hits', 'hits');
    $lists['category']['default_sort'] = mosHTML::selectList($col_list, 'category_default_sort', '', 'value', 'text', $booklibrary_configuration['category']['default_sort']);
    $lists['foto']['high'] = '<input type="text" name="foto_high" value="' . $booklibrary_configuration['foto']['high'] . '" class="inputbox" size="4" maxlength="4" title="" />';
    $lists['foto']['width'] = '<input type="text" name="foto_width" value="' . $booklibrary_configuration['foto']['width'] . '" class="inputbox" size="4" maxlength="4" title="" />';
    $lists['page']['items'] = '<input type="text" name="page_items" value="' . $booklibrary_configuration['page']['items'] . '" class="inputbox" size="3" maxlength="3" title="" />';
    $lists['license']['show'] = mosHTML::RadioList($yesno, 'license_show', 'class="inputbox"', $booklibrary_configuration['license']['show'], 'value', 'text');
    $txt = $booklibrary_configuration['license']['text'];
    //add for show in category picture
    $lists['cat_pic']['show'] = mosHTML::RadioList($yesno, 'cat_pic_show', 'class="inputbox"', $booklibrary_configuration['cat_pic']['show'], 'value', 'text');
    //add for show subcategory
    $lists['subcategory']['show'] = mosHTML::RadioList($yesno, 'subcategory_show', 'class="inputbox"', $booklibrary_configuration['subcategory']['show'], 'value', 'text');
    $component_path = JPath::clean(JPATH_SITE . '/components/com_booklibrary/views/all_categories/tmpl');
    $component_layouts = array();
    $options = array();
    if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^_]*\\.php$', false, true))) {
        foreach ($component_layouts as $i => $file) {
            $select_file_name = pathinfo($file);
            $select_file_name = $select_file_name['filename'];
            $all_categories[] = JHtml::_('select.option', $select_file_name, $select_file_name);
        }
    }
    $lists['all_categories'] = mosHTML::selectList($all_categories, 'all_categories', 'size="1" ', 'value', 'text', $booklibrary_configuration['all_categories']);
    $component_path = JPath::clean(JPATH_SITE . '/components/com_booklibrary/views/alone_category/tmpl');
    $component_layouts = array();
    $options = array();
    if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^_]*\\.php$', false, true))) {
        foreach ($component_layouts as $i => $file) {
            $select_file_name = pathinfo($file);
            $select_file_name = $select_file_name['filename'];
            $view_type[] = JHtml::_('select.option', $select_file_name, $select_file_name);
        }
    }
    $lists['view_type'] = mosHTML::selectList($view_type, 'view_type', 'size="1" ', 'value', 'text', $booklibrary_configuration['view_type']);
    // ---------Layouts for search-------------
    $component_path = JPath::clean(JPATH_SITE . '/components/com_booklibrary/views/show_search_book/tmpl');
    $component_layouts = array();
    $options = array();
    if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^_]*\\.php$', false, true))) {
        foreach ($component_layouts as $i => $file) {
            $select_file_name = pathinfo($file);
            $select_file_name = $select_file_name['filename'];
            $search_lay[] = JHtml::_('select.option', $select_file_name, $select_file_name);
        }
    }
    $lists['search_lay'] = mosHTML::selectList($search_lay, 'search_lay', 'size="1" ', 'value', 'text', $booklibrary_configuration['search_lay']);
    //************************/
    // ----------end------------
    $component_path = JPath::clean(JPATH_SITE . '/components/com_booklibrary/views/view_book/tmpl');
    $component_layouts = array();
    $options = array();
    if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^_]*\\.php$', false, true))) {
        foreach ($component_layouts as $i => $file) {
            $select_file_name = pathinfo($file);
            $select_file_name = $select_file_name['filename'];
            $view_book[] = JHtml::_('select.option', $select_file_name, $select_file_name);
        }
    }
    $lists['view_book'] = mosHTML::selectList($view_book, 'view_book', 'size="1" ', 'value', 'text', $booklibrary_configuration['view_book']);
    //---------------------------------
    $money_ditlimer = array();
    $money_ditlimer[] = JHtml::_('select.option', ".", "Point (12.134.123,12)");
    $money_ditlimer[] = JHtml::_('select.option', ",", "Comma (12,134,123.12)");
    $money_ditlimer[] = JHtml::_('select.option', "space", "Space (12 134 123,12)");
    $money_ditlimer[] = JHtml::_('select.option', "other", "Youre ditlimer: ");
    $price_unit_show[] = mosHTML::makeOption('1', _BOOKLIBRARY_PRICE_UNIT_SHOW_AFTER);
    $price_unit_show[] = mosHTML::makeOption('0', _BOOKLIBRARY_PRICE_UNIT_SHOW_BEFORE);
    $selecter = '';
    switch ($booklibrary_configuration['price_format']) {
        case '.':
            $selecter = '.';
            break;
        case ',':
            $selecter = ',';
            break;
        case '&nbsp;':
            $selecter = 'space';
            break;
        default:
            $selecter = 'other';
    }
    // 1 - affter 0 - beffore
    $lists['price_unit_show'] = mosHTML::RadioList($price_unit_show, 'price_unit_show', 'class="inputbox"', $booklibrary_configuration['price_unit_show'], 'value', 'text');
    $lists['money_ditlimer'] = mosHTML::selectList($money_ditlimer, 'money_select', 'size="1"
                                                   onchange="set_pricetype(this)"', 'value', 'text', $selecter);
    $lists['date_format'] = '<input type="text" name="date_format" value="' . $booklibrary_configuration['date_format'] . '" class="inputbox"  title="" />';
    $lists['datetime_format'] = '<input type="text" name="datetime_format" value="' . $booklibrary_configuration['datetime_format'] . '" class="inputbox" title="" />';
    //----------------------
    $lists['allowed_exts'] = '<input type="text" name="allowed_exts" value="' . $booklibrary_configuration['allowed_exts'] . '" class="inputbox" size="50" maxlength="1500" title=""/>';
    $lists['allowed_exts_img'] = '<input type="text" name="allowed_exts_img" value="' . $booklibrary_configuration['allowed_exts_img'] . '" class="inputbox" size="50" maxlength="1500" title=""/>';
    //----------------------
    HTML_booklibrary::showConfiguration_frontend($lists, $option, $txt);
}