Exemplo n.º 1
0
 /**
  * Content area of the page
  *
  * Shows a form for uploading an avatar.
  *
  * @return void
  */
 function showContent()
 {
     $user = common_current_user();
     $profile = $user->getProfile();
     $this->elementStart('form', array('method' => 'post', 'id' => 'form_settings_profile', 'class' => 'form_settings', 'action' => common_local_url('profilesettings')));
     $this->elementStart('fieldset');
     // TRANS: Profile settings form legend.
     $this->element('legend', null, _('Profile information'));
     $this->hidden('token', common_session_token());
     // too much common patterns here... abstractable?
     $this->elementStart('ul', 'form_data');
     if (Event::handle('StartProfileFormData', array($this))) {
         $this->elementStart('li');
         // TRANS: Field label in form for profile settings.
         $this->input('nickname', _('Nickname'), $this->arg('nickname') ? $this->arg('nickname') : $profile->nickname, _('1-64 lowercase letters or numbers, no punctuation or spaces.'));
         $this->elementEnd('li');
         $this->elementStart('li');
         // TRANS: Field label in form for profile settings.
         $this->input('fullname', _('Full name'), $this->arg('fullname') ? $this->arg('fullname') : $profile->fullname);
         $this->elementEnd('li');
         $this->elementStart('li');
         // TRANS: Field label in form for profile settings.
         $this->input('homepage', _('Homepage'), $this->arg('homepage') ? $this->arg('homepage') : $profile->homepage, _('URL of your homepage, blog, or profile on another site.'));
         $this->elementEnd('li');
         $this->elementStart('li');
         $maxBio = Profile::maxBio();
         if ($maxBio > 0) {
             // TRANS: Tooltip for field label in form for profile settings. Plural
             // TRANS: is decided by the number of characters available for the
             // TRANS: biography (%d).
             $bioInstr = sprintf(_m('Describe yourself and your interests in %d character.', 'Describe yourself and your interests in %d characters.', $maxBio), $maxBio);
         } else {
             // TRANS: Tooltip for field label in form for profile settings.
             $bioInstr = _('Describe yourself and your interests.');
         }
         // TRANS: Text area label in form for profile settings where users can provide
         // TRANS: their biography.
         $this->textarea('bio', _('Bio'), $this->arg('bio') ? $this->arg('bio') : $profile->bio, $bioInstr);
         $this->elementEnd('li');
         $this->elementStart('li');
         // TRANS: Field label in form for profile settings.
         $this->input('location', _('Location'), $this->arg('location') ? $this->arg('location') : $profile->location, _('Where you are, like "City, State (or Region), Country".'));
         $this->elementEnd('li');
         if (common_config('location', 'share') == 'user') {
             $this->elementStart('li');
             // TRANS: Checkbox label in form for profile settings.
             $this->checkbox('sharelocation', _('Share my current location when posting notices'), $this->arg('sharelocation') ? $this->arg('sharelocation') : $user->shareLocation());
             $this->elementEnd('li');
         }
         Event::handle('EndProfileFormData', array($this));
         $this->elementStart('li');
         // TRANS: Field label in form for profile settings.
         $this->input('tags', _('Tags'), $this->arg('tags') ? $this->arg('tags') : implode(' ', $user->getSelfTags()), _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated.'));
         $this->elementEnd('li');
         $this->elementStart('li');
         $language = common_language();
         // TRANS: Dropdownlist label in form for profile settings.
         $this->dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language.'), false, $language);
         $this->elementEnd('li');
         $timezone = common_timezone();
         $timezones = array();
         foreach (DateTimeZone::listIdentifiers() as $k => $v) {
             $timezones[$v] = $v;
         }
         $this->elementStart('li');
         // TRANS: Dropdownlist label in form for profile settings.
         $this->dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->checkbox('autosubscribe', _('Automatically subscribe to whoever ' . 'subscribes to me (best for non-humans)'), $this->arg('autosubscribe') ? $this->boolean('autosubscribe') : $user->autosubscribe);
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->dropdown('subscribe_policy', _('Subscription policy'), array(User::SUBSCRIBE_POLICY_OPEN => _('Let anyone follow me'), User::SUBSCRIBE_POLICY_MODERATE => _('Ask me first')), _('Whether other users need your permission to follow your updates.'), false, empty($user->subscribe_policy) ? User::SUBSCRIBE_POLICY_OPEN : $user->subscribe_policy);
         $this->elementEnd('li');
     }
     $this->elementStart('li');
     $this->checkbox('private_stream', _('Make updates visible only to my followers'), $this->arg('private_stream') ? $this->boolean('private_stream') : $user->private_stream);
     $this->elementEnd('li');
     $this->elementEnd('ul');
     // TRANS: Button to save input in profile settings.
     $this->submit('save', _m('BUTTON', 'Save'));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
Exemplo n.º 2
0
 /**
  * Data elements of the form
  *
  * @return void
  */
 function formData()
 {
     $this->out->elementStart('fieldset', array('id' => 'settings_admin_general'));
     $this->out->element('legend', null, _('General'));
     $this->out->elementStart('ul', 'form_data');
     $this->li();
     $this->input('name', _('Site name'), _('The name of your site, like "Yourcompany Microblog"'));
     $this->unli();
     $this->li();
     $this->input('broughtby', _('Brought by'), _('Text used for credits link in footer of each page'));
     $this->unli();
     $this->li();
     $this->input('broughtbyurl', _('Brought by URL'), _('URL used for credits link in footer of each page'));
     $this->unli();
     $this->li();
     $this->input('email', _('Email'), _('Contact email address for your site'));
     $this->unli();
     $this->out->elementEnd('ul');
     $this->out->elementEnd('fieldset');
     $this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
     $this->out->element('legend', null, _('Local'));
     $this->out->elementStart('ul', 'form_data');
     $timezones = array();
     foreach (DateTimeZone::listIdentifiers() as $k => $v) {
         $timezones[$v] = $v;
     }
     asort($timezones);
     $this->li();
     $this->out->dropdown('timezone', _('Default timezone'), $timezones, _('Default timezone for the site; usually UTC.'), true, $this->value('timezone'));
     $this->unli();
     $this->li();
     $this->out->dropdown('language', _('Default language'), get_nice_language_list(), _('Site language when autodetection from browser settings is not available'), false, $this->value('language'));
     $this->unli();
     $this->out->elementEnd('ul');
     $this->out->elementEnd('fieldset');
     $this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
     $this->out->element('legend', null, _('Limits'));
     $this->out->elementStart('ul', 'form_data');
     $this->li();
     $this->input('textlimit', _('Text limit'), _('Maximum number of characters for notices.'));
     $this->unli();
     $this->li();
     $this->input('dupelimit', _('Dupe limit'), _('How long users must wait (in seconds) to post the same thing again.'));
     $this->unli();
     $this->out->elementEnd('ul');
     $this->out->elementEnd('fieldset');
 }
 /**
  * Content area of the page
  *
  * Shows a form for uploading an avatar.
  *
  * @return void
  */
 function showContent()
 {
     $user = common_current_user();
     $profile = $user->getProfile();
     $this->elementStart('form', array('method' => 'post', 'id' => 'form_settings_profile', 'class' => 'form_settings', 'action' => common_local_url('profilesettings')));
     $this->elementStart('fieldset');
     $this->element('legend', null, _('Profile information'));
     $this->hidden('token', common_session_token());
     // too much common patterns here... abstractable?
     $this->elementStart('ul', 'form_data');
     if (Event::handle('StartProfileFormData', array($this))) {
         $this->elementStart('li');
         $this->input('nickname', _('Nickname'), $this->arg('nickname') ? $this->arg('nickname') : $profile->nickname, _('1-64 lowercase letters or numbers, no punctuation or spaces'));
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->input('fullname', _('Full name'), $this->arg('fullname') ? $this->arg('fullname') : $profile->fullname);
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->input('homepage', _('Homepage'), $this->arg('homepage') ? $this->arg('homepage') : $profile->homepage, _('URL of your homepage, blog, or profile on another site'));
         $this->elementEnd('li');
         $this->elementStart('li');
         $maxBio = Profile::maxBio();
         if ($maxBio > 0) {
             $bioInstr = sprintf(_('Describe yourself and your interests in %d chars'), $maxBio);
         } else {
             $bioInstr = _('Describe yourself and your interests');
         }
         $this->textarea('bio', _('Bio'), $this->arg('bio') ? $this->arg('bio') : $profile->bio, $bioInstr);
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->input('location', _('Location'), $this->arg('location') ? $this->arg('location') : $profile->location, _('Where you are, like "City, State (or Region), Country"'));
         $this->elementEnd('li');
         if (common_config('location', 'share') == 'user') {
             $this->elementStart('li');
             $this->checkbox('sharelocation', _('Share my current location when posting notices'), $this->arg('sharelocation') ? $this->arg('sharelocation') : $user->shareLocation());
             $this->elementEnd('li');
         }
         Event::handle('EndProfileFormData', array($this));
         $this->elementStart('li');
         $this->input('tags', _('Tags'), $this->arg('tags') ? $this->arg('tags') : implode(' ', $user->getSelfTags()), _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
         $this->elementEnd('li');
         $this->elementStart('li');
         $language = common_language();
         $this->dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), false, $language);
         $this->elementEnd('li');
         $timezone = common_timezone();
         $timezones = array();
         foreach (DateTimeZone::listIdentifiers() as $k => $v) {
             $timezones[$v] = $v;
         }
         $this->elementStart('li');
         $this->dropdown('timezone', _('Timezone'), $timezones, _('What timezone are you normally in?'), true, $timezone);
         $this->elementEnd('li');
         $this->elementStart('li');
         $this->checkbox('autosubscribe', _('Automatically subscribe to whoever ' . 'subscribes to me (best for non-humans)'), $this->arg('autosubscribe') ? $this->boolean('autosubscribe') : $user->autosubscribe);
         $this->elementEnd('li');
     }
     $this->elementEnd('ul');
     $this->submit('save', _('Save'));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }