123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class MessageForm extends Form
- {
-
- var $to = null;
-
- var $content = null;
-
- function __construct($out=null, $to=null, $content=null)
- {
- parent::__construct($out);
- $this->to = $to;
- $this->content = $content;
- }
-
- function id()
- {
- return 'form_notice-direct';
- }
-
- function formClass()
- {
- return 'form_notice ajax-notice';
- }
-
- function action()
- {
- return common_local_url('newmessage');
- }
-
- function formLegend()
- {
-
- $this->out->element('legend', null, _('Send a direct notice'));
- }
-
- function formData()
- {
- $user = common_current_user();
- $mutual_users = $user->mutuallySubscribedUsers();
- $mutual = array();
-
-
-
- $mutual[0] = _('Select recipient:');
- while ($mutual_users->fetch()) {
- if ($mutual_users->id != $user->id) {
- $mutual[$mutual_users->id] = $mutual_users->nickname;
- }
- }
- $mutual_users->free();
- unset($mutual_users);
- if (count($mutual) == 1) {
-
- $mutual[0] = _('No mutual subscribers.');
- }
-
- $this->out->dropdown('to', _('To'), $mutual, null, false,
- ($this->to) ? $this->to->id : null);
- $this->out->element('textarea', array('class' => 'notice_data-text',
- 'cols' => 35,
- 'rows' => 4,
- 'name' => 'content'),
- ($this->content) ? $this->content : '');
- $contentLimit = Message::maxContent();
- if ($contentLimit > 0) {
- $this->out->element('span',
- array('class' => 'count'),
- $contentLimit);
- }
- }
-
- function formActions()
- {
- $this->out->element('input', array('id' => 'notice_action-submit',
- 'class' => 'submit',
- 'name' => 'message_send',
- 'type' => 'submit',
-
- 'value' => _m('Send button for sending notice', 'Send')));
- }
-
- function show()
- {
- $this->elementStart('div', 'input_forms');
- $this->elementStart(
- 'div',
- array(
- 'id' => 'input_form_direct',
- 'class' => 'input_form current nonav'
- )
- );
- parent::show();
- $this->elementEnd('div');
- $this->elementEnd('div');
- }
- }
|