Skip to content
This repository was archived by the owner on Jun 4, 2021. It is now read-only.

Module_Messages

Nikolay Galkin edited this page Jun 7, 2013 · 3 revisions

НЕ РЕАЛИЗОВАН

Требования

  • новое сообщение
  • входящие
  • оправленные
  • черновики
  • шаблоны
  • корзина
  • поиск (не прочитанные, ...)

Сущность

  • id
  • message
  • from_user_id
  • to_user_id
  • date_sent
  • theme
  • category (sent, draft, template)
  • id_read (true,false)
  • status_from (0 - есть, 1 - в корзине, 2 - удалено)
  • status_to (0 - есть, 1 - в корзине, 2 - удалено)

WYSIWYG

В сообщении можно использовать HTML, по этой причине лучше добавить возможность подключить WYSIWYG редактор

Использование

Перед началом нужно загрузить сам tinyMCE.js и jQuery.js

$this->headScript()->prependFile($this->baseUrl('scripts/tiny_mce/tiny_mce.js'));

Как хелпер вьюхи:

echo $this->formTinyMCE('сomment', 'ula la', array(
    'label' => 'Your comment:',
    'cols'  => '50',
    'rows'  => '5',
    'class' => 'mceSimple',
    'tinyMCE' => array(
        'mode' => "textareas",
        'theme' => "simple",
    ),
));

Как элемент формы:

$comment = new Core_Form_Element_TinyMCE('comment', array(
    'label' => 'Your comment:',
    'cols'  => '50',
    'rows'  => '5',
    'required' => true,
    'filters' => array('StringTrim'),
    'tinyMCE' => array(
        'mode' => "textareas",
        'theme' => "simple",
    ),
));
$this->addElement($comment);

Принцип работы:

'tinyMCE' => array(
    'mode' => "textareas",
    'theme' => "simple",
);

Результатом будет:

<script type="text/javascript">
    tinyMCE.init({
        "mode":"textareas",
        "theme":"simple"
    });
</script>

Для более крутых извращений:

'tinyMCE' => array(
    'mode' => "textareas",
    'theme' => "advanced",
    'theme_advanced_buttons1' => "mybutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter, ...",
    'theme_advanced_buttons2' => "",
    'theme_advanced_buttons3' => "",
    'theme_advanced_toolbar_location' => "top",
    'theme_advanced_toolbar_align' => "left",
    'theme_advanced_statusbar_location' => "bottom",
    'plugins' => 'inlinepopups',
)

Все настройки делаются через атрибут элемента tinyMCE, которые потом все приводятся к JSON

Clone this wiki locally