Example #1
0
 /**
  * Controller
  */
 public function process()
 {
     $oUser = User_Service_User::instance();
     $aUser = $oUser->getByUserName($this->request()->get('user_name'));
     $bIsPage = $aUser['profile_page_id'] > 0 ? true : false;
     if ($bIsPage) {
         $aUser['page'] = Phpfox::getService('pages')->getPage($aUser['profile_page_id']);
         // list($iTotalMembers, $aMembers) = Phpfox::getService('pages')->getMembers($aUser['page']['page_id']);
         // $aUser['page_members'] = $aMembers;
     }
     $aUser['birthday_time_stamp'] = $aUser['birthday'];
     $aUser['birthday'] = $oUser->age($aUser['birthday']);
     $aUser['gender_name'] = $oUser->gender($aUser['gender']);
     $aUser['birthdate_display'] = $oUser->getProfileBirthDate($aUser);
     $aUser['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aUser['country_iso']), 'country');
     if (isset($aUser['country_child_id']) && $aUser['country_child_id'] > 0) {
         $aUser['location_child'] = Phpfox::getService('core.country')->getChild($aUser['country_child_id']);
     }
     $aUser['is_friend'] = false;
     $iTotal = 0;
     $aMutual = array();
     if ($aUser['user_id'] != Phpfox::getUserId() && !$bIsPage) {
         if (Phpfox::isUser() && Phpfox::isModule('friend')) {
             $aUser['is_friend'] = Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aUser['user_id']);
             if (!$aUser['is_friend']) {
                 $aUser['is_friend'] = Phpfox::getService('friend.request')->isRequested(Phpfox::getUserId(), $aUser['user_id']) ? 2 : false;
             }
         }
         list($iTotal, $aMutual) = Friend_Service_Friend::instance()->getMutualFriends($aUser['user_id'], 4);
     }
     $bShowBDayInput = false;
     if (!empty($aUser['birthday'])) {
         $iDays = Phpfox::getLib('date')->daysToDate($aUser['birthday'], null, false);
     } else {
         $iDays = 999;
     }
     if ($iDays < 1 && $iDays > 0) {
         $bShowBDayInput = true;
     }
     if (empty($aUser['dob_setting'])) {
         switch (Phpfox::getParam('user.default_privacy_brithdate')) {
             case 'month_day':
                 $aUser['dob_setting'] = '1';
                 break;
             case 'show_age':
                 $aUser['dob_setting'] = '2';
                 break;
             case 'hide':
                 $aUser['dob_setting'] = '3';
                 break;
         }
     }
     ($sPlugin = Phpfox_Plugin::get('user.component_block_tooltip_1')) ? eval($sPlugin) : false;
     $this->template()->assign(array('bIsPage' => $bIsPage, 'aUser' => $aUser, 'iMutualTotal' => $iTotal, 'aMutualFriends' => $aMutual, 'bShowBDay' => $bShowBDayInput));
 }
Example #2
0
 protected function _build($row)
 {
     $row = (array) $row;
     if (isset($row['user']) && is_array($row['user'])) {
         $row = $row['user'];
     }
     $age = $row['birthday'];
     $day = '';
     $month = '';
     $year = '';
     if (!empty($age)) {
         $month = substr($age, 0, 2);
         $day = substr($age, 2, 2);
         $year = substr($age, -4);
     }
     $image_50px = '';
     if (!empty($row['user_image'])) {
         $image_50px = \Phpfox_Image_Helper::instance()->display(['user' => $row, 'suffix' => '_50_square', 'return_url' => true]);
     }
     return ['id' => (int) $row['user_id'], 'name' => $row['full_name'], 'url' => \Phpfox_Url::instance()->makeUrl($row['user_name']), 'gender' => ['id' => $row['gender'], 'name' => \User_Service_User::instance()->gender($row['gender'])], 'photo' => ['50px' => $image_50px, '120px' => str_replace('_50_square', '_120_square', $image_50px), '200px' => str_replace('_50_square', '_200_square', $image_50px), 'original' => str_replace('_50_square', '', $image_50px)], 'location' => ['iso' => $row['country_iso']], 'dob' => ['day' => $day, 'month' => $month, 'year' => $year]];
 }
Example #3
0
 protected function _build($row)
 {
     $row = (array) $row;
     if (isset($row['user']) && is_array($row['user'])) {
         $row = $row['user'];
     }
     $age = isset($row['birthday']) ? $row['birthday'] : null;
     $day = '';
     $month = '';
     $year = '';
     if (!empty($age)) {
         $month = substr($age, 0, 2);
         $day = substr($age, 2, 2);
         $year = substr($age, -4);
     }
     $image_50px = '';
     $imageLink = '';
     if (!empty($row['user_image'])) {
         $image_50px = \Phpfox_Image_Helper::instance()->display(['user' => $row, 'suffix' => '_50_square', 'return_url' => true]);
     }
     $imageLink = \Phpfox_Image_Helper::instance()->display(['user' => $row, 'suffix' => '_120_square']);
     $link = \Phpfox_Url::instance()->makeUrl($row['user_name']);
     return ['id' => (int) $row['user_id'], 'group' => (object) ['id' => (int) $row['user_group_id']], 'name' => $row['full_name'], 'name_link' => '<span id="js_user_name_link_' . $row['user_name'] . '" class="user_profile_link_span"><a href="' . $link . '">' . $row['full_name'] . '</a></span>', 'url' => $link, 'gender' => ['id' => $row['gender'], 'name' => \User_Service_User::instance()->gender($row['gender'])], 'photo_link' => $imageLink, 'photo' => ['50px' => $image_50px, '120px' => str_replace('_50_square', '_120_square', $image_50px), '200px' => str_replace('_50_square', '_200_square', $image_50px), 'original' => str_replace('_50_square', '', $image_50px)], 'location' => ['iso' => $row['country_iso']], 'dob' => ['day' => $day, 'month' => $month, 'year' => $year]];
 }
Example #4
0
 /**
  * Get all the user fields when joining with the user database table.
  *
  * @param string $sAlias Table alias. User table alias by default is "u".
  * @param string $sPrefix Prefix for each of the fields.
  * @return string Returns SQL SELECT for user fields.
  */
 public static function getUserField($sAlias = 'u', $sPrefix = '')
 {
     static $aValues = array();
     // Create hash
     $sHash = md5($sAlias . $sPrefix);
     // Have we already cached it? We do not want to run an extra foreach() for nothing.
     if (isset($aValues[$sHash])) {
         return $aValues[$sHash];
     }
     $aFields = User_Service_User::instance()->getUserFields();
     $aValues[$sHash] = '';
     foreach ($aFields as $sField) {
         $aValues[$sHash] .= ", {$sAlias}.{$sField}";
         if ($sAlias == 'u' && $sField == 'server_id') {
             // $sPrefix = 'user_' . (empty($sPrefix) ? '' : $sPrefix);
             $aValues[$sHash] .= " AS user_{$sPrefix}{$sField}";
             // unset($sPrefix);
             continue;
         }
         if (!empty($sPrefix)) {
             $aValues[$sHash] .= " AS {$sPrefix}{$sField}";
         }
     }
     $aValues[$sHash] = ltrim($aValues[$sHash], ',');
     return $aValues[$sHash];
 }
Example #5
0
	/**
	 * JSON
	 */
	public function jsonuserlistAction() 
	{
		$userService = new User_Service_User;
		$users = $userService->listUsers();
		print Zend_Json::encode($users);
		exit;
	}
Example #6
0
	   /**
	*logoutAction
          *
          * @return void
          */
     public function logoutAction()
	 {
	 	$userService = new User_Service_User();
		$userService->clearIdentity();
		$this->_redirect( $this->_helper->url->url( array(), 'index' ));
	 }