Exemplo n.º 1
0
/**
* @desc Muestra la lista de foros existentes
*/
function bx_show_forums()
{
    global $xoopsModule, $xoopsSecurity;
    $catid = rmc_server_var($_REQUEST, 'catid', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("bxpress_forums");
    if ($catid > 0) {
        $sql .= " WHERE cat='{$catid}'";
    }
    $sql .= " ORDER BY cat,`order`";
    $result = $db->query($sql);
    $categos = array();
    $forums = array();
    while ($row = $db->fetchArray($result)) {
        $forum = new bXForum();
        $forum->assignVars($row);
        // Cargamos la categoría
        if (isset($categos[$forum->category()])) {
            $catego = $categos[$forum->category()];
        } else {
            $categos[$forum->category()] = new bXCategory($forum->category());
            $catego = $categos[$forum->category()];
        }
        // Asignamos los valores
        $forums[] = array('id' => $forum->id(), 'title' => $forum->name(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'catego' => $catego->title(), 'active' => $forum->active(), 'attach' => $forum->attachments(), 'order' => $forum->order());
    }
    bXFunctions::menu_bar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Forums Management', 'bxpress'));
    xoops_cp_header();
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/foros/standalone/1/');
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'bxpress');
    RMTemplate::get()->add_head('<script type="text/javascript">
        var bx_select_message = "' . __('You must select one forum at least in order to run this action!', 'bxpress') . '";
        var bx_message = "' . __('Do you really want to delete selected forums?\\n\\nAll posts sent in this forum will be deleted also!', 'bxpress') . '";
    </script>');
    include RMTemplate::get()->get_template('admin/forums_forums.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Exemplo n.º 2
0
/**
* @desc Muestra la lista de foros existentes
*/
function bx_show_forums()
{
    global $xoopsModule, $xoopsSecurity;
    $catid = RMHttpRequest::request('catid', 'integer', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("mod_bxpress_forums");
    if ($catid > 0) {
        $sql .= " WHERE cat='{$catid}'";
    }
    $sql .= " ORDER BY cat,`order`";
    $result = $db->query($sql);
    $categos = array();
    $forums = array();
    while ($row = $db->fetchArray($result)) {
        $forum = new bXForum();
        $forum->assignVars($row);
        // Cargamos la categoría
        if (isset($categos[$forum->category()])) {
            $catego = $categos[$forum->category()];
        } else {
            $categos[$forum->category()] = new bXCategory($forum->category());
            $catego = $categos[$forum->category()];
        }
        // Asignamos los valores
        $forums[] = array('id' => $forum->id(), 'title' => $forum->name(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'catego' => $catego->title(), 'active' => $forum->active(), 'attach' => $forum->attachments(), 'order' => $forum->order());
    }
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Forums', 'bxpress'));
    xoops_cp_header();
    RMTemplate::get()->add_help(__('Forums Help', 'bxpress'), 'http://www.redmexico.com.mx/docs/bxpress-forums/foros/standalone/1/');
    RMTemplate::get()->add_script('admin.js', 'bxpress');
    RMTemplate::get()->add_head_script('var bx_select_message = "' . __('You must select one forum at least in order to run this action!', 'bxpress') . '";
        var bx_message = "' . __('Do you really want to delete selected forums?\\n\\nAll posts sent in this forum will be deleted also!', 'bxpress') . '";');
    include RMTemplate::get()->get_template('admin/forums-forums.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Exemplo n.º 3
0
 public function delete()
 {
     foreach ($this->getPosts() as $post) {
         $post->delete();
     }
     $forum = new bXForum($this->forum());
     $forum->setTopics($forum->topics() - 1 > 0 ? $forum->topics() - 1 : 0);
     $forum->save();
     return $this->deleteFromTable();
 }