Ejemplo n.º 1
0
 /**
  * Confirm with user.
  *
  * Shows a confirmation form.
  *
  * @return void
  */
 function areYouSureForm()
 {
     // @fixme if we ajaxify the confirmation form, skip the preview on ajax hits
     $profile = new ArrayWrapper(array($this->profile));
     $preview = new ProfileList($profile, $this);
     $preview->show();
     $id = $this->profile->id;
     $this->elementStart('form', array('id' => 'block-' . $id, 'method' => 'post', 'class' => 'form_settings form_entity_block', 'action' => common_local_url('block')));
     $this->elementStart('fieldset');
     $this->hidden('token', common_session_token());
     $this->element('legend', _('Block user'));
     $this->element('p', null, _('Are you sure you want to block this user? ' . 'Afterwards, they will be unsubscribed from you, ' . 'unable to subscribe to you in the future, and ' . 'you will not be notified of any @-replies from them.'));
     $this->element('input', array('id' => 'blockto-' . $id, 'name' => 'profileid', 'type' => 'hidden', 'value' => $id));
     foreach ($this->args as $k => $v) {
         if (substr($k, 0, 9) == 'returnto-') {
             $this->hidden($k, $v);
         }
     }
     $this->submit('form_action-no', _m('BUTTON', 'No'), 'submit form_action-primary', 'no', _('Do not block this user'));
     $this->submit('form_action-yes', _m('BUTTON', 'Yes'), 'submit form_action-secondary', 'yes', _('Block this user'));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
Ejemplo n.º 2
0
 /**
  * Whips up a query to get a list of profiles based on the provided
  * people tag and page, initalizes a ProfileList widget, and displays
  * it to the user.
  *
  * @return nothing
  */
 function showContent()
 {
     $profile = new Profile();
     $offset = ($this->page - 1) * PROFILES_PER_PAGE;
     $limit = PROFILES_PER_PAGE + 1;
     if (common_config('db', 'type') == 'pgsql') {
         $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $lim = ' LIMIT ' . $offset . ', ' . $limit;
     }
     // XXX: memcached this
     $qry = 'SELECT profile.* ' . 'FROM profile JOIN profile_tag ' . 'ON profile.id = profile_tag.tagger ' . 'WHERE profile_tag.tagger = profile_tag.tagged ' . "AND tag = '%s' " . 'ORDER BY profile_tag.modified DESC%s';
     $profile->query(sprintf($qry, $this->tag, $lim));
     $pl = new ProfileList($profile, null, $this);
     $cnt = $pl->show();
     $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->page, 'peopletag', array('tag' => $this->tag));
 }
Ejemplo n.º 3
0
 function showContent()
 {
     // XXX: Note I'm doing it this two-stage way because a raw query
     // with a JOIN was *not* working. --Zach
     $featured_nicks = common_config('nickname', 'featured');
     if (count($featured_nicks) > 0) {
         $quoted = array();
         foreach ($featured_nicks as $nick) {
             $quoted[] = "'{$nick}'";
         }
         $user = new User();
         $user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
         $user->limit(($this->page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
         $user->orderBy(common_database_tablename('user') . '.nickname ASC');
         $user->find();
         $profile_ids = array();
         while ($user->fetch()) {
             $profile_ids[] = $user->id;
         }
         $profile = new Profile();
         $profile->whereAdd(sprintf('profile.id IN (%s)', implode(',', $profile_ids)));
         $profile->orderBy('nickname ASC');
         $cnt = $profile->find();
         if ($cnt > 0) {
             $featured = new ProfileList($profile, $this);
             $featured->show();
         }
         $profile->free();
         $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->page, 'featured');
     }
 }
Ejemplo n.º 4
0
 function showContent()
 {
     $offset = ($this->page - 1) * PROFILES_PER_PAGE;
     $limit = PROFILES_PER_PAGE + 1;
     $cnt = 0;
     $members = $this->group->getMembers($offset, $limit);
     if ($members) {
         $member_list = new ProfileList($members, null, $this);
         $cnt = $member_list->show();
     }
     $members->free();
     $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->page, 'groupmembers', array('nickname' => $this->group->nickname));
 }