codingfarm/the-forum-bundle

There is no license information available for the latest version (dev-master) of this package.

Installs: 46

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 4

Forks: 1

Open Issues: 0

Language:JavaScript

Type:symfony-bundle

dev-master 2013-07-29 13:32 UTC

This package is not auto-updated.

Last update: 2024-04-13 10:55:20 UTC


README

Requirements:

Основные возможности и концепции

Форум жестко не привязан к имеющейся системе авторизации, имеется зависимость только от Symfony\Component\Security\Core\User\UserInterface, так что вы можете использовать любую реализацию, FOSUserBundle - поддерживается.

Форум имеет три основных сущности:

  • Категория
  • Топик
  • Пост

Инсталяция

Step 1: Download CFTheForumBundle using composer

Add CFTheBundle in your composer.json:

{
    "require": {
        "codingfarm/the-forum-bundle": "dev-master"
    }
}

Now tell composer to download the bundle by running the command:

$ php composer.phar update codingfarm/the-forum-bundle

Composer will install the bundle to your project's vendor/codingfarm/the-forum-bundle/ directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new CF\TheForumBundle\CFTheForumBundle(),
    );
}

Step 3: Configuration

# app/config/config.yml

cf_the_forum:
    db_driver: orm
    image:
        upload_dir: /uploads/forum/
        max_height: 400
        max_width: 700
    video:
        width: 459
        height: 341
    video_url_services:
        - forum.services.video.youtube
        - forum.services.video.rutube
        - forum.services.video.smotri
        - forum.services.video.vimeo
        - forum.services.video.ttk
    class:
        model:
            post: Application\ForumBundle\Entity\Post
            topic: Application\ForumBundle\Entity\Topic
            category: Application\ForumBundle\Entity\Category
        bridge:
            user_meta: Application\ForumBundle\Bridge\UserMeta
        permissions:
            service_class: Application\ForumBundle\Services\ForumPermissions
    bbcode_filters:
        - forum.bbcode_filter.main
        - forum.bbcode_filter.image
        - forum.bbcode_filter.video
        - forum.bbcode_filter.url

Step 4: Implement model classes

Bridge

This class needed to provide the project specific user's data - name, avatar,...

use CF\TheForumBundle\Bridge\UserMeta as AbstractUserMeta;

class UserMeta extends AbstractUserMeta
{

    /**
     * Return the name of the user
     *
     * @param $user
     *
     * @return string
     */
    public function getUsername($user)
    {
        return $user->getUsername();
    }

    /**
     * Return the picture's url of user's avatar
     *
     * @param $user
     *
     * @return string (/img/avatars/default.gif)
     */
    public function getUserAvatar($user)
    {
        // return $user->getAvatarSrc();
        return '/img/avatars/default.gif';
    }
}