コード例 #1
0
ファイル: connect.php プロジェクト: gillima/phplist3
function listSelectHTML($current, $fieldname, $subselect, $alltab = '')
{
    $GLOBALS['systemTimer']->interval();
    $categoryhtml = ListofLists($current, $fieldname, $subselect);
    $tabno = 1;
    $listindex = $listhtml = '';
    $some = count($categoryhtml);
    if (!empty($alltab)) {
        #&& $some > 1) {
        #   unset($categoryhtml['all']);
        ### @@@TODO this has a weird effect when categories are numbers only eg years, because PHP renumbers them to 0,1,2
        #   array_unshift($categoryhtml,$alltab);
    }
    if ($some > 0) {
        foreach ($categoryhtml as $category => $content) {
            if ($category == 'all') {
                $category = '@';
            }
            if ($some > 1) {
                ## don't show tabs, when there's just one
                $listindex .= sprintf('<li><a href="#%s%d">%s</a></li>', $fieldname, $tabno, $category);
            }
            if ($fieldname == 'targetlist') {
                // Add select all checkbox in every category to select all lists in that category.
                if ($category == 'selected') {
                    $content = sprintf('<li class="selectallcategory"><input type="checkbox" name="all-lists-' . $fieldname . '-cat-' . str_replace(' ', '-', strtolower($category)) . '" checked="checked">' . s('Select all') . '</li>') . $content;
                } elseif ($category != '@') {
                    $content = sprintf('<li class="selectallcategory"><input type="checkbox" name="all-lists-' . $fieldname . '-cat-' . str_replace(' ', '-', strtolower($category)) . '">' . s('Select all') . '</li>') . $content;
                }
            }
            $listhtml .= sprintf('<div class="%s" id="%s%d"><ul>%s</ul></div>', str_replace(' ', '-', strtolower($category)), $fieldname, $tabno, $content);
            ++$tabno;
        }
    }
    $html = '<div class="tabbed"><ul>' . $listindex . '</ul>';
    $html .= $listhtml;
    $html .= '</div><!-- end of tabbed -->';
    ## close tabbed
    if (!$some) {
        $html = s('There are no lists available');
    }
    # file_put_contents('/tmp/timer.log','ListSelectHTML '.$GLOBALS['systemTimer']->interval(). "\n",FILE_APPEND);
    return $html;
}
コード例 #2
0
ファイル: connect.php プロジェクト: dehvCurtis/phplist
function listSelectHTML($current, $fieldname, $subselect, $alltab = '')
{
    $categoryhtml = ListofLists($current, $fieldname, $subselect);
    $tabno = 1;
    $listindex = $listhtml = '';
    $some = sizeof($categoryhtml);
    if (!empty($alltab)) {
        #&& $some > 1) {
        #   unset($categoryhtml['all']);
        ### @@@TODO this has a weird effect when categories are numbers only eg years, because PHP renumbers them to 0,1,2
        #   array_unshift($categoryhtml,$alltab);
    }
    if ($some > 0) {
        foreach ($categoryhtml as $category => $content) {
            if ($category == 'all') {
                $category = '@';
            }
            if ($some > 1) {
                ## don't show tabs, when there's just one
                $listindex .= sprintf('<li><a href="#%s%d">%s</a></li>', $fieldname, $tabno, $category);
            }
            $listhtml .= sprintf('<div id="%s%d"><ul>%s</ul></div>', $fieldname, $tabno, $content);
            $tabno++;
        }
    }
    $html = '<div class="tabbed"><ul>' . $listindex . '</ul>';
    $html .= $listhtml;
    $html .= '</div><!-- end of tabbed -->';
    ## close tabbed
    if (!$some) {
        $html = $GLOBALS['I18N']->get('There are no lists available');
    }
    return $html;
}