Exemplo n.º 1
0
function frs_show_release_popup2($group_id, $name = 'release_id', $checked_val = "xzxz")
{
    /*
    	return a pop-up select box of releases for the project
    */
    $frsrf = new FRSReleaseFactory();
    if (!$group_id) {
        return $GLOBALS['Language']->getText('file_file_utils', 'g_id_err');
    } else {
        $hp =& Codendi_HTMLPurifier::instance();
        $res = $frsrf->getFRSReleasesInfoListFromDb($group_id);
        $p = array();
        foreach ($res as $release) {
            $p[$release['package_name']][$release['release_id']] = $release['release_name'];
        }
        $select = '<select name="' . $name . '">';
        foreach ($p as $package_name => $releases) {
            $select .= '<optgroup label="' . $package_name . '">';
            foreach ($releases as $id => $name) {
                $select .= '<option value="' . $id . '" ' . ($id == $checked_val ? 'selected="selected"' : '') . '>' . $hp->purify($name) . '</option>';
            }
            $select .= '</optgroup>';
        }
        $select .= '</select>';
        return $select;
    }
}