예제 #1
0
파일: Index.php 프로젝트: visapi/amun
 public function onLoad()
 {
     parent::onLoad();
     // get user details
     $account = $this->getHandler('AmunService\\User\\Account')->getOneById($this->user->getId(), array('id', 'status', 'name', 'gender', 'thumbnailUrl', 'timezone', 'updated', 'date', 'countryTitle'), Sql::FETCH_OBJECT);
     $this->template->assign('account', $account);
     // check whether remote profile
     if ($account->status == Account\Record::REMOTE) {
         header('HTTP/1.1 301 Moved Permanently');
         header('Location: ' . $account->profileUrl);
         exit;
     }
     // get acctivites
     $activities = $this->getActivities();
     $this->template->assign('activities', $activities);
     // load groups
     $groups = $this->getHandler('AmunService\\User\\Friend\\Group')->getAll(array(), 0, 16, 'id', Sql::SORT_DESC, new Condition(array('userId', '=', $this->user->getId())));
     $this->template->assign('groups', $groups);
     // form url
     $activityUrl = $this->config['psx_url'] . '/' . $this->config['psx_dispatch'] . 'api/user/activity';
     $receiverUrl = $this->config['psx_url'] . '/' . $this->config['psx_dispatch'] . 'api/user/activity/receiver';
     $this->template->assign('activityUrl', $activityUrl);
     $this->template->assign('receiverUrl', $receiverUrl);
     // template
     $this->htmlCss->add('my');
     $this->htmlJs->add('amun');
     $this->htmlJs->add('my');
     $this->htmlContent->add(Html\Content::META, Atom\Writer::link($this->page->getTitle(), $this->config['psx_url'] . '/' . $this->config['psx_dispatch'] . 'api/my/activity/' . $this->user->getName() . '?format=atom'));
 }
예제 #2
0
 public function onLoad()
 {
     parent::onLoad();
     // friend request count
     $con = new Condition();
     $con->add('friendId', '=', $this->user->getId());
     $con->add('status', '=', Friend\Record::REQUEST);
     $requestCount = $this->getSql()->count($this->registry['table.user_friend'], $con);
     $this->template->assign('requestCount', $requestCount);
     // pending count
     $con = new Condition();
     $con->add('userId', '=', $this->user->getId());
     $con->add('status', '=', Friend\Record::REQUEST);
     $pendingCount = $this->getSql()->count($this->registry['table.user_friend'], $con);
     $this->template->assign('pendingCount', $pendingCount);
     // load groups
     $groupList = $this->getGroups();
     $this->template->assign('groupList', $groupList);
     // options
     $friends = new Option('friends', $this->registry, $this->user, $this->page);
     $friends->add('my_view', 'Friends', $this->page->getUrl() . '/friends');
     if ($requestCount > 0) {
         $friends->add('my_view', 'Request (' . $requestCount . ')', $this->page->getUrl() . '/friends/request');
     }
     if ($pendingCount > 0) {
         $friends->add('my_view', 'Pending (' . $pendingCount . ')', $this->page->getUrl() . '/friends/pending');
     }
     $friends->add('my_view', 'Groups', $this->page->getUrl() . '/friends/group');
     $friends->load(array($this->page));
     $this->template->assign('optionsFriends', $friends);
 }
예제 #3
0
 public function onLoad()
 {
     parent::onLoad();
     // options
     $settings = new Option('settings', $this->registry, $this->user, $this->page);
     $settings->add('my_view', 'Account', $this->page->getUrl() . '/settings');
     $settings->add('my_view', 'Security', $this->page->getUrl() . '/settings/security');
     $settings->add('my_view', 'Connection', $this->page->getUrl() . '/settings/connection');
     $settings->add('my_view', 'Application', $this->page->getUrl() . '/settings/application');
     $settings->load(array($this->page));
     $this->template->assign('optionsSettings', $settings);
 }