*/ /** * This view will allow users to view a members profile * * @package Members * @subpackage UserInterface */ class MembersProfileView extends GalleryView { /** * @see GalleryView::loadTemplate */ function loadTemplate(&$template, &$form) { global $gallery; GalleryCoreApi::requireOnce('modules/members/classes/GalleryMembersHelper.class'); list ($ret, $result) = GalleryMembersHelper::canViewMembersModule($gallery->getActiveUserId()); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } if (!$result) { return array(null, array('redirect' => array('view' => 'core.ShowItem'))); } $userId = GalleryUtilities::getRequestVariables('userId'); if (empty($userId)) { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__), null); } if ($form['formName'] != 'MembersProfile') { /* Set some defaults */ $form['formName'] = 'MembersProfile'; } $MembersProfile = array(); /* Bring in the root album information for the breadcrumb */ list ($ret, $rootAlbumId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.rootAlbum'); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } list ($ret, $rootAlbum) = GalleryCoreApi::loadEntitiesById($rootAlbumId); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $MembersProfile['rootAlbum'] = (array)$rootAlbum; list ($ret, $user) = GalleryCoreApi::loadEntitiesById($userId); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $MembersProfile['user'] = (array)$user; list ($ret, $lastItems) = GalleryMembersHelper::fetchLastUserItems($user->getId(), 0, 5, ORDER_DESCENDING); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $MembersProfile['lastItems'] = array(); foreach ($lastItems as $item) { $MembersProfile['lastItems'][] = (array)$item; } list ($ret, $daysSinceCreation) = GalleryMembersHelper::daysSinceCreation($user->getId()); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $MembersProfile['daysSinceCreation'] = $daysSinceCreation; list ($ret, $canViewProfileEmail) = GalleryMembersHelper::canViewProfileEmail($gallery->getActiveUserId()); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $MembersProfile['canViewProfileEmail'] = $canViewProfileEmail; $template->setVariable('MembersProfile', $MembersProfile); list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'members'); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $template->title($module->translate('Members Profile')); return array(null, array('body' => 'modules/members/templates/MembersProfile.tpl')); } } ?>