示例#1
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);
}