Beispiel #1
0
/**
* Creates a new or edits and existing user record
* @param int The id of the record, 0 if a new entry
* @param string The current GET/POST option
*/
function editContact($id, $option)
{
    global $database, $my;
    global $mosConfig_absolute_path;
    $row = new mosContact($database);
    // load the row from the db table
    $row->load($id);
    if ($id) {
        // do stuff for existing records
        $row->checkout($my->id);
    } else {
        // do stuff for new records
        $row->imagepos = 'top';
        $row->ordering = 0;
        $row->published = 1;
    }
    $lists = array();
    // build the html select list for ordering
    $query = "SELECT ordering AS value, name AS text" . "\n FROM #__contact_details" . "\n WHERE published >= 0" . "\n AND catid = '{$row->catid}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1);
    // build list of users
    $lists['user_id'] = mosAdminMenus::UserSelect('user_id', $row->user_id, 1);
    // build list of categories
    $lists['catid'] = mosAdminMenus::ComponentCategory('catid', 'com_contact_details', intval($row->catid));
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoradioList('published', '', $row->published);
    // build the html radio buttons for default
    $lists['default_con'] = mosHTML::yesnoradioList('default_con', '', $row->default_con);
    // get params definitions
    $file = $mosConfig_absolute_path . '/administrator/components/com_contact/contact_items.xml';
    $params =& new mosAdminParameters($row->params, $file, 'component');
    HTML_contact::editcontact($row, $lists, $option, $params);
}
/**
* Compiles information to add or edit a section
* @param database A database connector object
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editSection($uid = 0, $scope = '', $option)
{
    global $database, $my, $mainframe;
    $row = new mosSection($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        $msg = 'The section ' . $row->title . ' is currently being edited by another administrator';
        mosRedirect('index2.php?option=' . $option . '&scope=' . $row->scope . '&mosmsg=' . $msg);
    }
    $selected_folders = NULL;
    if ($uid) {
        $row->checkout($my->id);
        if ($row->id > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . "\n AND ( type = 'content_archive_section' OR type = 'content_blog_section' OR type = 'content_section' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_section':
                        $menus[$i]->type = 'Section Table';
                        break;
                    case 'content_blog_section':
                        $menus[$i]->type = 'Section Blog';
                        break;
                    case 'content_archive_section':
                        $menus[$i]->type = 'Section Blog Archive';
                        break;
                }
            }
        } else {
            $menus = array();
        }
        // handling for MOSImage directories
        if (trim($row->params)) {
            // get params definitions
            $params = new mosParameters($row->params, $mainframe->getPath('com_xml', 'com_sections'), 'component');
            $temps = $params->get('imagefolders', '');
            $temps = explode(',', $temps);
            foreach ($temps as $temp) {
                $selected_folders[] = mosHTML::makeOption($temp, $temp);
            }
        } else {
            $selected_folders[] = mosHTML::makeOption('*1*');
        }
    } else {
        $row->scope = $scope;
        $row->published = 1;
        $menus = array();
        // handling for MOSImage directories
        $selected_folders[] = mosHTML::makeOption('*1*');
    }
    // build the html select list for section types
    $types[] = mosHTML::makeOption('', 'Select Type');
    $types[] = mosHTML::makeOption('content_section', 'Section List');
    $types[] = mosHTML::makeOption('content_blog_section', 'Section Blog');
    $types[] = mosHTML::makeOption('content_archive_section', 'Section Archive Blog');
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__sections" . "\n WHERE scope=" . $database->Quote($row->scope) . " ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0);
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    // list of folders in images/stories/
    $imgFiles = recursive_listdir(COM_IMAGE_BASE);
    $len = strlen(COM_IMAGE_BASE);
    // handling for MOSImage directories
    $folders[] = mosHTML::makeOption('*1*', 'All');
    $folders[] = mosHTML::makeOption('*0*', 'None');
    $folders[] = mosHTML::makeOption('*#*', '---------------------');
    $folders[] = mosHTML::makeOption('/');
    foreach ($imgFiles as $file) {
        $folders[] = mosHTML::makeOption(substr($file, $len));
    }
    $lists['folders'] = mosHTML::selectList($folders, 'folders[]', 'class="inputbox" size="17" multiple="multiple"', 'value', 'text', $selected_folders);
    sections_html::edit($row, $option, $lists, $menus);
}
Beispiel #3
0
/**
* Compiles information to add or edit a category
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editCategory($uid = 0, $section = '')
{
    global $database, $my, $adminLanguage;
    global $mosConfig_absolute_path, $mosConfig_live_site;
    $type = mosGetParam($_REQUEST, 'type', '');
    $redirect = mosGetParam($_POST, 'section', '');
    $row = new mosCategory($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        mosRedirect('index2.php?option=categories&section=' . $row->section, $adminLanguage->A_COMP_CATEG_MESSAGE . " " . $row->title . " " . $adminLanguage->A_COMP_CATEG_MESSAGE2);
    }
    if ($uid) {
        // existing record
        $row->checkout($my->id);
        // code for Link Menu
        if ($row->section > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . $row->id . "\n AND ( type = 'content_archive_category' OR type = 'content_blog_category' OR type = 'content_category' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_category':
                        $menus[$i]->type = $adminLanguage->A_COMP_CATEG_TABLE;
                        break;
                    case 'content_blog_category':
                        $menus[$i]->type = $adminLanguage->A_COMP_CATEG_BLOG;
                        break;
                    case 'content_archive_category':
                        $menus[$i]->type = $adminLanguage->A_COMP_CATEG_BLOG_ARCHIVE;
                        break;
                }
            }
        } else {
            $menus = array();
        }
    } else {
        // new record
        $row->section = $section;
        $row->published = 1;
        $menus = NULL;
    }
    // make order list
    $order = array();
    $database->setQuery("SELECT COUNT(*) FROM #__categories WHERE section='{$row->section}'");
    $max = intval($database->loadResult()) + 1;
    for ($i = 1; $i < $max; $i++) {
        $order[] = mosHTML::makeOption($i);
    }
    // build the html select list for sections
    if ($section == 'content') {
        $query = "SELECT s.id AS value, s.title AS text" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering";
        $database->setQuery($query);
        $sections = $database->loadObjectList();
        $lists['section'] = mosHTML::selectList($sections, 'section', 'class="inputbox" size="1"', 'value', 'text');
    } else {
        if ($type == 'other') {
            $section_name = 'N/A';
        } else {
            $temp = new mosSection($database);
            $temp->load($row->section);
            $section_name = $temp->name;
        }
        $lists['section'] = '<input type="hidden" name="section" value="' . $row->section . '" />' . $section_name;
    }
    // build the html select list for category types
    $types[] = mosHTML::makeOption('', $adminLanguage->A_COMP_CATEG_SELECT_TYPE);
    $types[] = mosHTML::makeOption('content_category', $adminLanguage->A_COMP_CATEG_TABLE);
    $types[] = mosHTML::makeOption('content_blog_category', $adminLanguage->A_COMP_CATEG_BLOG);
    $types[] = mosHTML::makeOption('content_archive_category', $adminLanguage->A_COMP_CATEG_BLOG_ARCHIVE);
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__categories" . "\n WHERE section = '{$row->section}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0, 0);
    // Imagelist
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    categories_html::edit($row, $section, $lists, $redirect, $menus);
}
Beispiel #4
0
function editBanner($bannerid, $option)
{
    global $database, $my;
    $lists = array();
    $row = new mosBanner($database);
    $row->load($bannerid);
    if ($bannerid) {
        $row->checkout($my->id);
    }
    // Build Client select list
    $sql = "SELECT cid as value, name as text FROM #__bannerclient";
    $database->setQuery($sql);
    if (!$database->query()) {
        echo $database->stderr();
        return;
    }
    $clientlist[] = mosHTML::makeOption('0', 'Select Client');
    $clientlist = array_merge($clientlist, $database->loadObjectList());
    $lists['cid'] = mosHTML::selectList($clientlist, 'cid', 'class="inputbox" size="1"', 'value', 'text', $row->cid);
    // Imagelist
    $javascript = 'onchange="changeDisplayImage();"';
    $directory = '/images/banners';
    $lists['imageurl'] = mosAdminMenus::Images('imageurl', $row->imageurl, $javascript, $directory);
    // make the select list for the image positions
    $yesno[] = mosHTML::makeOption('0', T_('No'));
    $yesno[] = mosHTML::makeOption('1', T_('Yes'));
    $lists['showBanner'] = mosHTML::selectList($yesno, 'showBanner', 'class="inputbox" size="1"', 'value', 'text', $row->showBanner);
    HTML_banners::bannerForm($row, $lists, $option);
}
Beispiel #5
0
/**
* Compiles information to add or edit a section
* @param database A database connector object
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editSection($uid = 0, $scope = '', $option)
{
    global $database, $my, $adminLanguage;
    global $mosConfig_absolute_path, $mosConfig_live_site;
    $row = new mosSection($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        $msg = $adminLanguage->A_COMP_SECT_THE . " " . $row->title . " " . $adminLanguage->A_COMP_ANOTHER_ADMIN;
        mosRedirect('index2.php?option=' . $option . '&scope=' . $row->scope . '&mosmsg=' . $msg);
    }
    if ($uid) {
        $row->checkout($my->id);
        if ($row->id > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . $row->id . "\n AND ( type = 'content_archive_section' OR type = 'content_blog_section' OR type = 'content_section' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_section':
                        $menus[$i]->type = 'Section Table';
                        break;
                    case 'content_blog_section':
                        $menus[$i]->type = 'Section Blog';
                        break;
                    case 'content_archive_section':
                        $menus[$i]->type = 'Section Blog Archive';
                        break;
                }
            }
        } else {
            $menus = array();
        }
    } else {
        $row->scope = $scope;
        $row->published = 1;
        $menus = array();
    }
    // build the html select list for section types
    $types[] = mosHTML::makeOption('', $adminLanguage->A_COMP_CATEG_SELECT_TYPE);
    $types[] = mosHTML::makeOption('content_section', $adminLanguage->A_COMP_SECT_LIST);
    $types[] = mosHTML::makeOption('content_blog_section', $adminLanguage->A_COMP_SECT_BLOG);
    $types[] = mosHTML::makeOption('content_archive_section', $adminLanguage->A_COMP_SECT_ARCHIVE_BLOG);
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__sections" . "\n WHERE scope='{$row->scope}' ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0);
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    sections_html::edit($row, $option, $lists, $menus);
}
/**
* Compiles information to add or edit a category
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editCategory($uid = 0, $section = '')
{
    global $database, $my, $mainframe;
    $type = strval(mosGetParam($_REQUEST, 'type', ''));
    $redirect = strval(mosGetParam($_REQUEST, 'section', 'content'));
    // check for existance of any sections
    $query = "SELECT COUNT( id )" . "\n FROM #__sections" . "\n WHERE scope = 'content'";
    $database->setQuery($query);
    $sections = $database->loadResult();
    if (!$sections && $type != 'other') {
        echo "<script> alert('You need to have at least one Section before you can create a Category'); window.history.go(-1); </script>\n";
        exit;
    }
    $row = new mosCategory($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        mosRedirect('index2.php?option=categories&section=' . $row->section, 'The category ' . $row->title . ' is currently being edited by another administrator');
    }
    $lists['links'] = 0;
    $menus = NULL;
    $selected_folders = NULL;
    if ($uid) {
        // existing record
        $row->checkout($my->id);
        // code for Link Menu
        switch ($row->section) {
            case 'com_weblinks':
                $and = "\n AND type = 'weblink_category_table'";
                $link = 'Table - Weblink Category';
                break;
            case 'com_newsfeeds':
                $and = "\n AND type = 'newsfeed_category_table'";
                $link = 'Table - Newsfeeds Category';
                break;
            case 'com_contact_details':
                $and = "\n AND type = 'contact_category_table'";
                $link = 'Table - Contacts Category';
                break;
            default:
                $and = '';
                $link = '';
                break;
        }
        // content
        if ($row->section > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . "\n AND ( type = 'content_archive_category' OR type = 'content_blog_category' OR type = 'content_category' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_category':
                        $menus[$i]->type = 'Table - Content Category';
                        break;
                    case 'content_blog_category':
                        $menus[$i]->type = 'Blog - Content Category';
                        break;
                    case 'content_archive_category':
                        $menus[$i]->type = 'Blog - Content Category Archive';
                        break;
                }
            }
            $lists['links'] = 1;
            // handling for MOSImage directories
            if (trim($row->params)) {
                // get params definitions
                $params = new mosParameters($row->params, $mainframe->getPath('com_xml', 'com_categories'), 'component');
                $temps = $params->get('imagefolders', '');
                $temps = explode(',', $temps);
                foreach ($temps as $temp) {
                    $selected_folders[] = mosHTML::makeOption($temp, $temp);
                }
            } else {
                $selected_folders[] = mosHTML::makeOption('*2*');
            }
        } else {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . (int) $row->id . $and;
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                $menus[$i]->type = $link;
            }
            $lists['links'] = 1;
        }
    } else {
        // new record
        $row->section = $section;
        $row->published = 1;
        $menus = NULL;
        // handling for MOSImage directories
        if ($row->section == 'content') {
            $selected_folders[] = mosHTML::makeOption('*2*');
        }
    }
    // make order list
    $order = array();
    $query = "SELECT COUNT(*)" . "\n FROM #__categories" . "\n WHERE section = " . $database->Quote($row->section);
    $database->setQuery($query);
    $max = intval($database->loadResult()) + 1;
    for ($i = 1; $i < $max; $i++) {
        $order[] = mosHTML::makeOption($i);
    }
    // build the html select list for sections
    if ($section == 'content') {
        $query = "SELECT s.id AS value, s.title AS text" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering";
        $database->setQuery($query);
        $sections = $database->loadObjectList();
        $lists['section'] = mosHTML::selectList($sections, 'section', 'class="inputbox" size="1"', 'value', 'text');
    } else {
        if ($type == 'other') {
            $section_name = 'N/A';
        } else {
            $temp = new mosSection($database);
            $temp->load($row->section);
            $section_name = $temp->name;
        }
        $lists['section'] = '<input type="hidden" name="section" value="' . $row->section . '" />' . $section_name;
    }
    // build the html select list for category types
    $types[] = mosHTML::makeOption('', 'Select Type');
    if ($row->section == 'com_contact_details') {
        $types[] = mosHTML::makeOption('contact_category_table', 'Contact Category Table');
    } else {
        if ($row->section == 'com_newsfeeds') {
            $types[] = mosHTML::makeOption('newsfeed_category_table', 'Newsfeed Category Table');
        } else {
            if ($row->section == 'com_weblinks') {
                $types[] = mosHTML::makeOption('weblink_category_table', 'Weblink Category Table');
            } else {
                $types[] = mosHTML::makeOption('content_category', 'Content Category Table');
                $types[] = mosHTML::makeOption('content_blog_category', 'Content Category Blog');
                $types[] = mosHTML::makeOption('content_archive_category', 'Content Category Archive Blog');
            }
        }
    }
    // if
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__categories" . "\n WHERE section = " . $database->Quote($row->section) . "\n ORDER BY ordering";
    $lists['ordering'] = stripslashes(mosAdminMenus::SpecificOrdering($row, $uid, $query));
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0, 0);
    // Imagelist
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    // handling for MOSImage directories
    if ($row->section > 0 || $row->section == 'content') {
        // list of folders in images/stories/
        $imgFiles = recursive_listdir(COM_IMAGE_BASE);
        $len = strlen(COM_IMAGE_BASE);
        $folders[] = mosHTML::makeOption('*2*', 'Use Section settings');
        $folders[] = mosHTML::makeOption('*#*', '---------------------');
        $folders[] = mosHTML::makeOption('*1*', 'All');
        $folders[] = mosHTML::makeOption('*0*', 'None');
        $folders[] = mosHTML::makeOption('*#*', '---------------------');
        $folders[] = mosHTML::makeOption('/');
        foreach ($imgFiles as $file) {
            $folders[] = mosHTML::makeOption(substr($file, $len));
        }
        $lists['folders'] = mosHTML::selectList($folders, 'folders[]', 'class="inputbox" size="17" multiple="multiple"', 'value', 'text', $selected_folders);
    }
    categories_html::edit($row, $lists, $redirect, $menus);
}
Beispiel #7
0
/**
* Compiles information to add or edit a section
* @param database A database connector object
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editSection($uid = 0, $scope = '', $option)
{
    global $database, $my;
    $row = new mosSection($database);
    // load the row from the db table
    $row->load($uid);
    $row->title = htmlspecialchars(str_replace('&amp;', '&', $row->title));
    $row->name = htmlspecialchars(str_replace('&amp;', '&', $row->name));
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        $msg = sprintf(T_('The section %s is currently being edited by another administrator'), $row->title);
        mosRedirect('index2.php?option=' . $option . '&scope=' . $row->scope . '&mosmsg=' . $msg);
    }
    if ($uid) {
        $row->checkout($my->id);
        if ($row->id > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . $row->id . "\n AND ( type = 'content_archive_section' OR type = 'content_blog_section' OR type = 'content_section' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_section':
                        $menus[$i]->type = T_('Section Table');
                        break;
                    case 'content_blog_section':
                        $menus[$i]->type = T_('Section Blog');
                        break;
                    case 'content_archive_section':
                        $menus[$i]->type = T_('Section Blog Archive');
                        break;
                }
            }
        } else {
            $menus = array();
        }
    } else {
        $row->scope = $scope;
        $row->published = 1;
        $menus = array();
    }
    // build the html select list for section types
    $types[] = mosHTML::makeOption('', T_('Select Type'));
    $types[] = mosHTML::makeOption('content_section', T_('Section List'));
    $types[] = mosHTML::makeOption('content_blog_section', T_('Section Blog'));
    $types[] = mosHTML::makeOption('content_archive_section', T_('Section Archive Blog'));
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__sections" . "\n WHERE scope='{$row->scope}' ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0);
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    sections_html::edit($row, $option, $lists, $menus);
}
Beispiel #8
0
/**
* Compiles information to add or edit a category
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
* @param string The name of the current user
*/
function editCategory($uid = 0, $section = '')
{
    global $database, $my;
    $type = mosGetParam($_REQUEST, 'type', '');
    $redirect = mosGetParam($_REQUEST, 'section', 'content');
    $row = new mosCategory($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        mosRedirect('index2.php?option=categories&section=' . $row->section, sprintf(T_('The category %s is currently being edited by another administrator'), $row->title));
    }
    if ($uid) {
        // existing record
        $row->checkout($my->id);
        // code for Link Menu
        if ($row->section > 0) {
            $query = "SELECT *" . "\n FROM #__menu" . "\n WHERE componentid = " . $row->id . "\n AND ( type = 'content_archive_category' OR type = 'content_blog_category' OR type = 'content_category' )";
            $database->setQuery($query);
            $menus = $database->loadObjectList();
            $count = count($menus);
            for ($i = 0; $i < $count; $i++) {
                switch ($menus[$i]->type) {
                    case 'content_category':
                        $menus[$i]->type = T_('Category Table');
                        break;
                    case 'content_blog_category':
                        $menus[$i]->type = T_('Category Blog');
                        break;
                    case 'content_archive_category':
                        $menus[$i]->type = T_('Category Blog Archive');
                        break;
                }
            }
        } else {
            $menus = array();
        }
    } else {
        // new record
        $row->section = $section;
        $row->published = 1;
        $menus = NULL;
    }
    // make order list
    $order = array();
    $database->setQuery("SELECT COUNT(*) FROM #__categories WHERE section='{$row->section}'");
    $max = intval($database->loadResult()) + 1;
    for ($i = 1; $i < $max; $i++) {
        $order[] = mosHTML::makeOption($i);
    }
    // build the html select list for sections
    if ($section == 'content') {
        $query = "SELECT s.id AS value, s.title AS text" . "\n FROM #__sections AS s" . "\n ORDER BY s.ordering";
        $database->setQuery($query);
        $sections = $database->loadObjectList();
        $lists['section'] = mosHTML::selectList($sections, 'section', 'class="inputbox" size="1"', 'value', 'text');
    } else {
        if ($type == 'other') {
            $section_name = 'N/A';
        } else {
            $temp = new mosSection($database);
            $temp->load($row->section);
            $section_name = $temp->name;
        }
        $lists['section'] = '<input type="hidden" name="section" value="' . $row->section . '" />' . $section_name;
    }
    // build the html select list for category types
    $types[] = mosHTML::makeOption('', T_('Select Type'));
    if ($row->section == 'com_contact_details') {
        $types[] = mosHTML::makeOption('contact_category_table', T_('Contact Category Table'));
    } else {
        if ($row->section == 'com_newsfeeds') {
            $types[] = mosHTML::makeOption('newsfeed_category_table', T_('News Feed Category Table'));
        } else {
            if ($row->section == 'com_weblinks') {
                $types[] = mosHTML::makeOption('weblink_category_table', T_('Web Link Category Table'));
            } else {
                $types[] = mosHTML::makeOption('content_category', T_('Content Category Table'));
                $types[] = mosHTML::makeOption('content_blog_category', T_('Content Category Blog'));
                $types[] = mosHTML::makeOption('content_archive_category', T_('Content Category Archive Blog'));
            }
        }
    }
    // if
    $lists['link_type'] = mosHTML::selectList($types, 'link_type', 'class="inputbox" size="1"', 'value', 'text');
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__categories" . "\n WHERE section = '{$row->section}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query);
    // build the select list for the image positions
    $active = $row->image_position ? $row->image_position : 'left';
    $lists['image_position'] = mosAdminMenus::Positions('image_position', $active, NULL, 0, 0);
    // Imagelist
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    categories_html::edit($row, $lists, $redirect, $menus);
}