2011-03-07 04:09:24 +09:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* StatusNet, the distributed open-source microblogging tool
|
|
|
|
*
|
|
|
|
* Base class for all actions (~views)
|
|
|
|
*
|
|
|
|
* PHP version 5
|
|
|
|
*
|
|
|
|
* LICENCE: This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @category Action
|
|
|
|
* @package StatusNet
|
|
|
|
* @author Evan Prodromou <evan@status.net>
|
|
|
|
* @author Sarven Capadisli <csarven@status.net>
|
|
|
|
* @copyright 2008 StatusNet, Inc.
|
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
|
|
* @link http://status.net/
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2019-08-23 02:06:14 +09:00
|
|
|
require_once INSTALLDIR . '/lib/widget.php';
|
2011-03-07 04:09:24 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for all actions
|
|
|
|
*
|
|
|
|
* This is the base class for all actions in the package. An action is
|
|
|
|
* more or less a "view" in an MVC framework.
|
|
|
|
*
|
|
|
|
* Actions are responsible for extracting and validating parameters; using
|
|
|
|
* model classes to read and write to the database; and doing ouput.
|
|
|
|
*
|
|
|
|
* @category Output
|
|
|
|
* @package StatusNet
|
|
|
|
* @author Evan Prodromou <evan@status.net>
|
|
|
|
* @author Sarven Capadisli <csarven@status.net>
|
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
|
|
* @link http://status.net/
|
|
|
|
*
|
|
|
|
* @see HTMLOutputter
|
|
|
|
*/
|
|
|
|
class PeopletagGroupNav extends Widget
|
|
|
|
{
|
|
|
|
var $action = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construction
|
|
|
|
*
|
|
|
|
* @param Action $action current action, used for output
|
|
|
|
*/
|
2014-09-13 04:13:01 +09:00
|
|
|
function __construct(Action $action=null)
|
2011-03-07 04:09:24 +09:00
|
|
|
{
|
|
|
|
parent::__construct($action);
|
|
|
|
$this->action = $action;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the menu
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function show()
|
|
|
|
{
|
|
|
|
$user = null;
|
|
|
|
|
2015-09-28 06:46:30 +09:00
|
|
|
// FIXME: we should probably pass this in and check when PeopletagGroupNav is actually loaded etc.
|
2011-03-07 04:09:24 +09:00
|
|
|
|
|
|
|
$action = $this->action->trimmed('action');
|
2011-09-30 01:29:12 +09:00
|
|
|
|
|
|
|
if (common_config('singleuser', 'enabled')) {
|
|
|
|
$nickname = User::singleUserNickname();
|
|
|
|
} else {
|
|
|
|
$nickname = $this->action->arg('tagger');
|
|
|
|
}
|
|
|
|
|
2011-03-07 04:09:24 +09:00
|
|
|
$tag = $this->action->trimmed('tag');
|
|
|
|
|
|
|
|
if ($nickname) {
|
2013-08-18 20:04:58 +09:00
|
|
|
$user = User::getKV('nickname', $nickname);
|
2011-03-07 04:09:24 +09:00
|
|
|
$user_profile = $user->getProfile();
|
|
|
|
|
|
|
|
if ($tag) {
|
|
|
|
$tag = Profile_list::pkeyGet(array('tagger' => $user->id,
|
|
|
|
'tag' => $tag));
|
|
|
|
} else {
|
|
|
|
$tag = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$user_profile = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->out->elementStart('ul', array('class' => 'nav'));
|
|
|
|
|
2016-03-21 19:17:25 +09:00
|
|
|
if (Event::handle('StartPeopletagGroupNav', array($this))
|
|
|
|
&& $tag instanceof Profile_list && $user_profile instanceof Profile) {
|
2011-03-07 04:09:24 +09:00
|
|
|
// People tag timeline
|
2015-09-28 06:46:30 +09:00
|
|
|
$this->out->menuItem(common_local_url('showprofiletag', array('nickname' => $user_profile->nickname,
|
2011-03-07 04:09:24 +09:00
|
|
|
'tag' => $tag->tag)),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item in list navigation panel.
|
2011-04-13 17:15:25 +09:00
|
|
|
_m('MENU','List'),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item title in list navigation panel.
|
|
|
|
// TRANS: %1$s is a list, %2$s is a nickname.
|
2011-04-13 17:15:25 +09:00
|
|
|
sprintf(_('%1$s list by %2$s.'), $tag->tag,
|
2011-03-07 04:09:24 +09:00
|
|
|
(($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
|
|
|
|
$action == 'showprofiletag', 'nav_timeline_peopletag');
|
|
|
|
|
|
|
|
// Tagged
|
|
|
|
$this->out->menuItem(common_local_url('peopletagged', array('tagger' => $user->nickname,
|
|
|
|
'tag' => $tag->tag)),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item in list navigation panel.
|
2011-04-13 17:15:25 +09:00
|
|
|
_m('MENU','Listed'),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item title in list navigation panel.
|
|
|
|
// TRANS: %1$s is a list, %2$s is a nickname.
|
2011-04-13 17:15:25 +09:00
|
|
|
sprintf(_('%1$s list by %2$s.'), $tag->tag,
|
2011-03-07 04:09:24 +09:00
|
|
|
(($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
|
|
|
|
$action == 'peopletagged', 'nav_peopletag_tagged');
|
|
|
|
|
|
|
|
// Subscribers
|
|
|
|
$this->out->menuItem(common_local_url('peopletagsubscribers', array('tagger' => $user->nickname,
|
|
|
|
'tag' => $tag->tag)),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item in list navigation panel.
|
2011-04-11 02:59:55 +09:00
|
|
|
_m('MENU','Subscribers'),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item title in list navigation panel.
|
|
|
|
// TRANS: %1$s is a list, %2$s is a nickname.
|
2011-04-13 17:15:25 +09:00
|
|
|
sprintf(_('Subscribers to %1$s list by %2$s.'), $tag->tag,
|
2011-03-07 04:09:24 +09:00
|
|
|
(($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
|
|
|
|
$action == 'peopletagsubscribers', 'nav_peopletag_subscribers');
|
|
|
|
|
|
|
|
$cur = common_current_user();
|
|
|
|
if (!empty($cur) && $user_profile->id == $cur->id) {
|
|
|
|
// Edit
|
|
|
|
$this->out->menuItem(common_local_url('editpeopletag', array('tagger' => $user->nickname,
|
|
|
|
'tag' => $tag->tag)),
|
2011-04-18 03:08:03 +09:00
|
|
|
// TRANS: Menu item in list navigation panel.
|
2011-04-11 02:59:55 +09:00
|
|
|
_m('MENU','Edit'),
|
2011-04-15 22:07:35 +09:00
|
|
|
// TRANS: Menu item title in list navigation panel.
|
|
|
|
// TRANS: %s is a list.
|
2011-04-13 17:15:25 +09:00
|
|
|
sprintf(_('Edit %s list by you.'), $tag->tag,
|
2011-03-07 04:09:24 +09:00
|
|
|
(($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
|
|
|
|
$action == 'editpeopletag', 'nav_peopletag_edit');
|
|
|
|
}
|
|
|
|
|
|
|
|
Event::handle('EndPeopletagGroupNav', array($this));
|
|
|
|
}
|
|
|
|
$this->out->elementEnd('ul');
|
|
|
|
}
|
|
|
|
}
|