function bb_forum_form($forum_id = 0)
{
    $forum_id = (int) $forum_id;
    if ($forum_id && !($forum = bb_get_forum($forum_id))) {
        return;
    }
    $forum_name = '';
    $forum_slug = '';
    $forum_description = '';
    $forum_position = '';
    if ($forum_id) {
        $forum_name = get_forum_name($forum_id);
        $forum_slug = apply_filters('editable_slug', $forum->forum_slug);
        $forum_description = get_forum_description($forum_id);
        $forum_position = get_forum_position($forum_id);
        $legend = __('Edit Forum');
        $submit = __('Save Changes');
        $action = 'update';
    } else {
        $legend = __('Add Forum');
        $submit = __('Add Forum');
        $action = 'add';
    }
    $forum_options = array('forum_name' => array('title' => __('Name'), 'value' => $forum_name), 'forum_slug' => array('title' => __('Slug'), 'value' => $forum_slug), 'forum_desc' => array('title' => __('Description'), 'value' => $forum_description, 'class' => 'long'), 'forum_parent' => array('title' => __('Parent'), 'type' => 'select', 'options' => bb_get_forum_dropdown(array('cut_branch' => $forum_id, 'id' => 'forum_parent', 'none' => true, 'selected' => $forum_id ? get_forum_parent($forum_id) : 0, 'disable_categories' => 0, 'options_only' => true))), 'forum_order' => array('title' => __('Position'), 'value' => $forum_position, 'class' => 'short'), 'forum_is_category' => array('title' => __('Category'), 'type' => 'checkbox', 'options' => array(1 => array('label' => __('Make this forum a category'), 'value' => bb_get_forum_is_category($forum_id))), 'note' => __('Categories are forums where new topics cannot be created. Categories usually contain a group of sub-forums.')));
    if (!$forum_id) {
        unset($forum_options['forum_slug']);
        unset($forum_options['forum_order']);
    }
    ?>
<form class="settings" method="post" id="<?php 
    echo $action;
    ?>
-forum" action="<?php 
    bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
    ?>
" class="add:forum-list: forum-form">
	<fieldset>
		<legend><?php 
    echo $legend;
    ?>
</legend>
<?php 
    foreach ($forum_options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
		<fieldset class="submit">
<?php 
    if ($forum_id) {
        ?>
			<input type="hidden" name="forum_id" value="<?php 
        echo $forum_id;
        ?>
" />
<?php 
    }
    ?>
			<?php 
    bb_nonce_field('order-forums', 'order-nonce');
    ?>
			<?php 
    bb_nonce_field($action . '-forum');
    ?>
			<input type="hidden" name="action" value="<?php 
    echo $action;
    ?>
" />
			<input class="submit" type="submit" name="submit" value="<?php 
    echo $submit;
    ?>
" />
		</fieldset>
	</fieldset>
</form>
<?php 
}
Exemplo n.º 2
0
<div class="bcomb"><?php echo gf_get_forum_bread_crumb();?></div>

<div id="discussions">
<?php if ( gf_has_forums() ) : ?>
<h2><?php _e('Forums','gf'); ?></h2>
<table id="forumlist">

<tr>
	<th><?php _e('Main Theme','gf'); ?></th>
	<th><?php _e('Topics','gf'); ?></th>
	<th><?php _e('Posts','gf'); ?></th>
</tr>
<?php while ( gf_forum() ) : ?>
<?php global $gf_forums_loop,$gf_current_forum;?>
<?php if (bb_get_forum_is_category()) : ?>
<tr<?php gf_forum_class('bb-category'); ?>>
	<td colspan="3"><?php gf_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_permalink(); ?>"><?php forum_name(); ?></a>
	<br />
	<?php forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
</tr>
<?php continue; endif; ?>
<tr<?php gf_forum_class(); ?>>
	<td><?php gf_forum_pad( '<div class="nest">' ); ?><a href="<?php gf_forum_permalink(); ?>"><?php gf_forum_name(); ?></a>
	<br />
	<?php gf_forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
	<td class="num"><?php echo gf_get_forum_topic_count($gf_current_forum->forum_id); ?></td>
        <td class="num"><?php echo gf_get_forum_posts_count($gf_current_forum->forum_id); ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php endif; // gf_forums() ?>
Exemplo n.º 3
0
    _e('Main Theme');
    ?>
</th>
	<th><?php 
    _e('Topics');
    ?>
</th>
	<th><?php 
    _e('Posts');
    ?>
</th>
</tr>

<?php 
    while (bb_forum()) {
        if (bb_get_forum_is_category()) {
            ?>
<tr<?php 
            bb_forum_class('bb-category');
            ?>
>
	<td colspan="3"><?php 
            bb_forum_pad('<div class="nest">');
            ?>
<a href="<?php 
            forum_link();
            ?>
"><?php 
            forum_name();
            ?>
</a><?php 
Exemplo n.º 4
0
<div class="forums">
<!--list forums-->
	<?php if ( gf_has_forums('child_of='.gf_get_root_forum_id()) ) : ?>
	<h2><?php _e('Manage Forums','gf'); ?></h2>
	<ul id="forumlist">
	<?php while ( gf_forum() ) : ?>
	<?php global $gf_forums_loop,$gf_current_forum;//print_r($bb_forums_loop);echo "breakkkk<br/><br />";?>
		<?php if (bb_get_forum_is_category()) : ?>
		<li <?php gf_forum_class('bb-category'); ?>>
			<?php gf_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a>
			<br /><?php forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?>
		<div class="row-actions"><a href="<?php echo gf_get_forum_permalink($gf_current_forum->forum_id);?>"><?php _e("View","gf");?></a>|<a href="<?php echo gf_get_forum_edit_link($gf_current_forum->forum_id);?>"><?php _e("Edit","gf");?></a>|<a href="<?php echo gf_get_forum_delete_link($gf_current_forum->forum_id);?>"><?php _e("Delete","gf");?></a></div>	
		</li>
<?php continue; endif; ?>
	<li <?php gf_forum_class(); ?>>
		<?php gf_forum_pad( '<div class="nest">' ); ?><a href="<?php gf_forum_permalink(); ?>"><?php gf_forum_name(); ?></a>
		<br />
		<?php gf_forum_description( array( 'before' => '<small> &#8211; ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?>
	<div class="row-actions"><a href="<?php echo gf_get_forum_permalink($gf_current_forum->forum_id);?>"><?php _e("View","gf");?></a>|<a href="<?php echo gf_get_forum_edit_link($gf_current_forum->forum_id);?>"><?php _e("Edit","gf");?></a>|<a href="<?php echo gf_get_forum_delete_link($gf_current_forum->forum_id);?>"><?php _e("Delete","gf");?></a></div>	
	</li>
<?php endwhile; ?>
</ul>
<?php endif; //gf_forums() ?>
<!-- Load the Create forum form--> 
<?php locate_template(array("gf/admin/create-forum.php"),true);?>
</div>