예제 #1
0
    }
    ?>
			<?php 
}
?>

			<?php 
if ($this->registration->Interests != REG_HIDE) {
    ?>
				<?php 
    if ($this->params->get('access_tags') == 0 || $this->params->get('access_tags') == 1 && $loggedin || $this->params->get('access_tags') == 2 && $isUser) {
        ?>
					<?php 
        include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'tags.php';
        $mt = new \Components\Members\Models\Tags($this->profile->get('uidNumber'));
        $tags = $mt->render();
        if ($tags) {
            ?>
						<li class="profile-interests field">
							<div class="field-content">
								<div class="key"><?php 
            echo Lang::txt('PLG_GROUPS_PROFILE_INTERESTS');
            ?>
</div>
								<div class="value">
									<?php 
            echo $tags;
            ?>
								</div>
							</div>
						</li>
예제 #2
0
 /**
  * Intro Page
  *
  * @return  void
  */
 public function displayTask()
 {
     // set the neeced layout
     $this->view->setLayout('display');
     // build the title
     $this->_buildTitle();
     // build pathway
     $this->_buildPathway();
     //vars
     $mytags = '';
     $this->view->mygroups = array('members' => null, 'invitees' => null, 'applicants' => null);
     $this->view->populargroups = array();
     $this->view->interestinggroups = array();
     //get the users profile
     $profile = \Hubzero\User\Profile::getInstance(User::get("id"));
     //if we have a users profile load their groups and groups matching their tags
     if (is_object($profile)) {
         //get users tags
         include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'tags.php';
         $mt = new \Components\Members\Models\Tags($profile->get("uidNumber"));
         $mytags = $mt->render('string');
         //get users groups
         $this->view->mygroups['members'] = \Hubzero\User\Helper::getGroups($profile->get("uidNumber"), 'members', 1);
         $this->view->mygroups['invitees'] = \Hubzero\User\Helper::getGroups($profile->get("uidNumber"), 'invitees', 1);
         $this->view->mygroups['applicants'] = \Hubzero\User\Helper::getGroups($profile->get("uidNumber"), 'applicants', 1);
         $this->view->mygroups = array_filter($this->view->mygroups);
         //get groups user may be interested in
         $this->view->interestinggroups = Group\Helper::getGroupsMatchingTagString($mytags, \Hubzero\User\Helper::getGroups($profile->get("uidNumber")));
     }
     //get the popular groups
     $this->view->populargroups = Group\Helper::getPopularGroups(3);
     //get featured groups
     $this->view->featuredgroups = Group\Helper::getFeaturedGroups($this->config->get('intro_featuredgroups_list', ''));
     //set some vars for view
     $this->view->config = $this->config;
     $this->view->title = $this->_title;
     // get view notifications
     $this->view->notifications = $this->getNotifications() ? $this->getNotifications() : array();
     //display view
     $this->view->display();
 }
예제 #3
0
 /**
  * Looks up a user's interests (tags)
  *
  * @param   integer  $cloud  Output as tagcloud (defaults to no)
  * @return  string   List of tags as either a tagcloud or comma-delimitated string
  */
 private function _getInterests($cloud = 0)
 {
     $database = \App::get('db');
     require_once Component::path('com_members') . DS . 'models' . DS . 'tags.php';
     // Get tags of interest
     $mt = new \Components\Members\Models\Tags(User::get('id'));
     if ($cloud) {
         $tags = $mt->render();
     } else {
         $tags = $mt->render('string');
     }
     return $tags;
 }
예제 #4
0
    ?>
			</li>
		<?php 
}
?>

		<?php 
if ($this->registration->Interests != REG_HIDE) {
    ?>
			<?php 
    if ($this->params->get('access_tags') == 0 || $this->params->get('access_tags') == 1 && $loggedin || $this->params->get('access_tags') == 2 && $isUser) {
        ?>
				<?php 
        $cls = '';
        $mt = new \Components\Members\Models\Tags($this->profile->get('uidNumber'));
        $tags = $mt->render();
        $tag_string = $mt->render('string');
        if ($this->params->get('access_tags') == 2) {
            $cls .= 'private';
        }
        if ($tag_string == "") {
            $cls .= $isUser ? " hidden" : " hide";
        }
        if (isset($update_missing) && in_array("interests", array_keys($update_missing))) {
            $cls = str_replace(' hide', '', $cls);
            $cls .= ' missing';
        }
        ?>
				<li class="profile-interests section <?php 
        echo $cls;
        ?>
예제 #5
0
 /**
  * Search entries
  *
  * @return  void
  */
 public function searchTask()
 {
     // Incoming
     $filters = array('limit' => Request::getInt('limit', Config::get('list_limit')), 'start' => Request::getInt('limitstart', 0), 'tag' => Request::getVar('tags', ''), 'search' => Request::getVar('q', ''), 'filterby' => Request::getWord('filterby', ''), 'sortby' => Request::getWord('sortby', 'date'), 'sort_Dir' => strtolower(Request::getWord('sortdir', 'desc')), 'area' => Request::getVar('area', ''));
     // Validate inputs
     $filters['tag'] = $filters['tag'] ? $filters['tag'] : Request::getVar('tag', '');
     if ($filters['filterby'] && !in_array($filters['filterby'], array('open', 'closed'))) {
         $filters['filterby'] = '';
     }
     if (!in_array($filters['sortby'], array('date', 'votes', 'rewards'))) {
         $filters['sortby'] = 'date';
     }
     if (!in_array($filters['sort_Dir'], array('desc', 'asc'))) {
         $filters['sort_Dir'] = 'desc';
     }
     if ($filters['area'] && !in_array($filters['area'], array('mine', 'assigned', 'interest'))) {
         $filters['area'] = '';
     }
     // Get questions of interest
     // @TODO: Remove reference to members. Add getTags() to user?
     if ($filters['area'] == 'interest') {
         require_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'tags.php';
         // Get tags of interest
         $mt = new \Components\Members\Models\Tags(User::get('id'));
         $filters['tag'] = $mt->render('string');
     }
     // Get assigned questions
     // @TODO: Remove reference to tools. Turn into an event call?
     if ($filters['area'] == 'assigned') {
         require_once PATH_CORE . DS . 'components' . DS . 'com_tools' . DS . 'tables' . DS . 'author.php';
         // What tools did this user contribute?
         $db = App::get('db');
         $TA = new \Components\Tools\Tables\Author($db);
         $tools = $TA->getToolContributions(User::get('id'));
         $mytooltags = array();
         if ($tools) {
             foreach ($tools as $tool) {
                 $mytooltags[] = 'tool' . $tool->toolname;
             }
         }
         $filters['tag'] = implode(',', $mytooltags);
     }
     $records = Question::all()->including(['responses', function ($response) {
         $response->select('id')->select('question_id')->where('state', '!=', Question::STATE_DELETED);
     }]);
     if ($filters['tag'] || $filters['area'] == 'interest' || $filters['area'] == 'assigned') {
         $cloud = new Tags();
         $tags = $cloud->parse($filters['tag']);
         $records->select('#__answers_questions.*')->join('#__tags_object', '#__tags_object.objectid', '#__answers_questions.id')->join('#__tags', '#__tags.id', '#__tags_object.tagid')->whereEquals('#__tags_object.tbl', 'answers')->whereIn('#__tags.tag', $tags);
     }
     if ($filters['search']) {
         $filters['search'] = strtolower((string) $filters['search']);
         $records->whereLike('subject', $filters['search'], 1)->orWhereLike('question', $filters['search'], 1)->resetDepth();
     }
     if ($filters['filterby'] == 'open') {
         $records->whereEquals('state', 0);
     }
     if ($filters['filterby'] == 'closed') {
         $records->whereEquals('state', 1);
     }
     if (!$filters['filterby'] || $filters['filterby'] == 'both') {
         $records->where('state', '<', Question::STATE_DELETED);
     }
     if ($filters['area'] == 'mine') {
         $records->whereEquals('created_by', User::get('id'));
     }
     switch ($filters['sortby']) {
         case 'rewards':
             $order = 'reward';
             break;
         case 'votes':
             $order = 'helpful';
             break;
         case 'date':
         default:
             $order = 'created';
             break;
     }
     $results = $records->order($order, $filters['sort_Dir'])->paginated()->rows();
     // Output HTML
     $this->view->setError($this->getErrors())->set('results', $results)->set('filters', $filters)->set('config', $this->config)->setLayout('search')->display();
 }
예제 #6
0
 /**
  * Event call to determine if this plugin should return data
  *
  * @param      array  $fields  Fields filled in
  * @param      object $profile MembersProfile
  * @return     integer
  */
 public function getProfileCompleteness($fields, $profile)
 {
     //default vars
     $num_fields = 0;
     $num_filled_fields = 0;
     $_property_map = array('Fullname' => 'name', 'Email' => 'email', 'URL' => 'web', 'Phone' => 'phone', 'Employment' => 'orgtype', 'Organization' => 'org', 'Citizenship' => 'countryorigin', 'Residency' => 'countryresident', 'Sex' => 'sex', 'Disability' => 'disability', 'Hispanic' => 'hispanic', 'Race' => 'race', 'Bio' => 'bio', 'Interests' => 'tags', 'OptIn' => 'mailPreferenceOption', 'ORCID' => 'orcid');
     //unset errors from the fields object
     $fields->setErrors(array());
     //load the user profile
     $registration = new \Components\Members\Models\Registration();
     $registration->loadProfile($profile);
     //add tags to the registration object
     $database = App::get('db');
     $mt = new \Components\Members\Models\Tags($profile->get('uidNumber'));
     $registration->_registration['tags'] = $mt->render('string');
     //add bio to the registration object
     $fields->Bio = REG_OPTIONAL;
     $registration->_registration['bio'] = $profile->get("bio");
     //loop through each field to see if we want to count it
     foreach ($fields as $k => $v) {
         //if the field is anything button hidden we want to count it
         if (in_array($v, array(REG_REQUIRED, REG_OPTIONAL, REG_READONLY))) {
             //check if we have a mapping (excludes certain unused vars)
             if (isset($_property_map[$k])) {
                 //add to the number of fields count
                 $num_fields++;
                 //check to see if we have it filled in
                 $value = $registration->get($_property_map[$k]);
                 $type = gettype($registration->get($_property_map[$k]));
                 if ($type == 'array' && !empty($value) || $type == 'string' && $value != '') {
                     $num_filled_fields++;
                 }
             }
         }
     }
     //return percentage
     return number_format($num_filled_fields / $num_fields * 100, 0);
 }
예제 #7
0
 /**
  * Edit a member's information
  *
  * @param      integer $id ID of member to edit
  * @return     void
  */
 public function editTask($id = 0)
 {
     Request::setVar('hidemainmenu', 1);
     if (!$id) {
         // Incoming
         $id = Request::getVar('id', array());
         // Get the single ID we're working with
         if (is_array($id)) {
             $id = !empty($id) ? $id[0] : 0;
         }
     }
     // Initiate database class and load info
     $this->view->profile = new Profile();
     $this->view->profile->load($id);
     $this->view->password = \Hubzero\User\Password::getInstance($id);
     // Get password rules
     $password_rules = \Hubzero\Password\Rule::getRules();
     // Get the password rule descriptions
     $this->view->password_rules = array();
     foreach ($password_rules as $rule) {
         if (!empty($rule['description'])) {
             $this->view->password_rules[] = $rule['description'];
         }
     }
     // Validate the password
     $this->view->validated = isset($this->validated) ? $this->validated : false;
     // Get the user's interests (tags)
     include_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'tags.php';
     $mt = new \Components\Members\Models\Tags($id);
     $this->view->tags = $mt->render('string');
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }
예제 #8
0
 /**
  * Show a form for editing a profile
  *
  * @param   object  $profile  Profile
  * @return  void
  */
 public function editTask($profile = null)
 {
     // Incoming
     $id = Request::getInt('id', 0);
     // Check if they're logged in
     if (User::isGuest()) {
         $rtrn = Request::getVar('REQUEST_URI', Route::url('index.php?option=' . $this->_controller . '&task=activity', false, true), 'server');
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($rtrn), false));
     }
     // Ensure we have an ID
     if (!$id) {
         App::abort(404, Lang::txt('COM_MEMBERS_NO_ID'));
     }
     // Check authorization
     if (!User::authorise('core.manage', $this->_option) && $id != User::get('id')) {
         App::abort(403, Lang::txt('COM_MEMBERS_NOT_AUTH'));
     }
     // Initiate profile class if we don't already have one and load info
     // Note: if we already have one then we just came from $this->save()
     if (!is_object($profile)) {
         $profile = Member::oneOrFail($id);
     }
     // Ensure we have a member
     if (!$profile->get('id')) {
         App::abort(404, Lang::txt('COM_MEMBERS_NOT_FOUND'));
     }
     // Get the user's interests (tags)
     $mt = new \Components\Members\Models\Tags($id);
     $this->view->tags = $mt->render('string');
     // Set the page title
     $title = Lang::txt(strtoupper($this->_option));
     $title .= $this->_task ? ': ' . Lang::txt(strtoupper($this->_task)) : '';
     Document::setTitle($title);
     // Set the pathway
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     Pathway::append(stripslashes($profile->get('name')), 'index.php?option=' . $this->_option . '&id=' . $profile->get('id'));
     Pathway::append(Lang::txt(strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&id=' . $profile->get('id') . '&task=' . $this->_task);
     foreach ($this->getErrors() as $error) {
         Notify::error($error);
     }
     $fields = Field::all()->including(['options', function ($option) {
         $option->select('*')->ordered();
     }])->where('action_edit', '!=', Field::STATE_HIDDEN)->ordered()->rows();
     // Ouput HTML
     $this->view->set('title', $title)->set('profile', $profile)->set('fields', $fields)->setLayout('edit')->display();
 }
예제 #9
0
 /**
  * Show a form for editing a profile
  *
  * @param      object $xregistration \Components\Members\Models\Registration
  * @param      object $profile       \Hubzero\User\Profile
  * @return     void
  */
 public function editTask($xregistration = null, $profile = null)
 {
     // Set the page title
     $this->view->title = Lang::txt(strtoupper($this->_name));
     $this->view->title .= $this->_task ? ': ' . Lang::txt(strtoupper($this->_task)) : '';
     Document::setTitle($this->view->title);
     // Set the pathway
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_name)), 'index.php?option=' . $this->_option);
     }
     // Incoming
     $id = Request::getInt('id', 0);
     // Check if they're logged in
     if (User::isGuest()) {
         $rtrn = Request::getVar('REQUEST_URI', Route::url('index.php?option=' . $this->_controller . '&task=activity'), 'server');
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($rtrn)));
         return;
     }
     // Ensure we have an ID
     if (!$id) {
         Pathway::append(Lang::txt(strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&id=' . $id . '&task=' . $this->_task);
         App::abort(404, Lang::txt('MEMBERS_NO_ID'));
         return;
     }
     // Check authorization
     $this->view->authorized = $this->_authorize($id);
     if ($id != User::get('id')) {
         Pathway::append(Lang::txt(strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&id=' . $id . '&task=' . $this->_task);
         App::abort(403, Lang::txt('MEMBERS_NOT_AUTH'));
         return;
     }
     // Initiate profile class if we don't already have one and load info
     // Note: if we already have one then we just came from $this->save()
     if (!is_object($profile)) {
         $profile = \Hubzero\User\Profile::getInstance($id);
     }
     // Ensure we have a member
     if (!$profile->get('name') && !$profile->get('surname')) {
         Pathway::append(Lang::txt(strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&id=' . $id . '&task=' . $this->_task);
         App::abort(404, Lang::txt('MEMBERS_NOT_FOUND'));
         return;
     }
     // Get the user's interests (tags)
     $mt = new \Components\Members\Models\Tags($id);
     $this->view->tags = $mt->render('string');
     // Add to the pathway
     Pathway::append(stripslashes($profile->get('name')), 'index.php?option=' . $this->_option . '&id=' . $profile->get('uidNumber'));
     Pathway::append(Lang::txt(strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&id=' . $profile->get('uidNumber') . '&task=' . $this->_task);
     // Instantiate an xregistration object if we don't already have one
     // Note: if we already have one then we just came from $this->save()
     if (!is_object($xregistration)) {
         $xregistration = new \Components\Members\Models\Registration();
     }
     $this->view->xregistration = $xregistration;
     // Find out which fields are hidden, optional, or required
     $registration = new \Hubzero\Base\Object();
     $registration->Username = $this->_registrationField('registrationUsername', 'RROO', $this->_task);
     $registration->Password = $this->_registrationField('registrationPassword', 'RRHH', $this->_task);
     $registration->ConfirmPassword = $this->_registrationField('registrationConfirmPassword', 'RRHH', $this->_task);
     $registration->Fullname = $this->_registrationField('registrationFullname', 'RRRR', $this->_task);
     $registration->Email = $this->_registrationField('registrationEmail', 'RRRR', $this->_task);
     $registration->ConfirmEmail = $this->_registrationField('registrationConfirmEmail', 'RRRR', $this->_task);
     $registration->URL = $this->_registrationField('registrationURL', 'HHHH', $this->_task);
     $registration->Phone = $this->_registrationField('registrationPhone', 'HHHH', $this->_task);
     $registration->Employment = $this->_registrationField('registrationEmployment', 'HHHH', $this->_task);
     $registration->Organization = $this->_registrationField('registrationOrganization', 'HHHH', $this->_task);
     $registration->Citizenship = $this->_registrationField('registrationCitizenship', 'HHHH', $this->_task);
     $registration->Residency = $this->_registrationField('registrationResidency', 'HHHH', $this->_task);
     $registration->Sex = $this->_registrationField('registrationSex', 'HHHH', $this->_task);
     $registration->Disability = $this->_registrationField('registrationDisability', 'HHHH', $this->_task);
     $registration->Hispanic = $this->_registrationField('registrationHispanic', 'HHHH', $this->_task);
     $registration->Race = $this->_registrationField('registrationRace', 'HHHH', $this->_task);
     $registration->Interests = $this->_registrationField('registrationInterests', 'HHHH', $this->_task);
     $registration->Reason = $this->_registrationField('registrationReason', 'HHHH', $this->_task);
     $registration->OptIn = $this->_registrationField('registrationOptIn', 'HHHH', $this->_task);
     $registration->TOU = $this->_registrationField('registrationTOU', 'HHHH', $this->_task);
     $registration->ORCID = $this->_registrationField('registrationORCID', 'OOOO', $this->_task);
     // Ouput HTML
     $this->view->profile = $profile;
     $this->view->registration = $registration;
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $this->view->display();
 }
예제 #10
0
 /**
  * Search entries
  *
  * @return     void
  */
 public function searchTask()
 {
     $this->view->config = $this->config;
     $this->view->task = $this->_task;
     // Incoming
     $this->view->filters = array('limit' => Request::getInt('limit', Config::get('list_limit')), 'start' => Request::getInt('limitstart', 0), 'tag' => Request::getVar('tags', ''), 'q' => Request::getVar('q', ''), 'filterby' => Request::getWord('filterby', ''), 'sortby' => Request::getWord('sortby', 'date'), 'sort_Dir' => Request::getWord('sortdir', 'DESC'), 'area' => Request::getVar('area', ''));
     // Validate inputs
     $this->view->filters['tag'] = $this->view->filters['tag'] ? $this->view->filters['tag'] : Request::getVar('tag', '');
     if ($this->view->filters['filterby'] && !in_array($this->view->filters['filterby'], array('open', 'closed'))) {
         $this->view->filters['filterby'] = '';
     }
     if (!in_array($this->view->filters['sortby'], array('date', 'votes', 'rewards'))) {
         $this->view->filters['sortby'] = 'date';
     }
     if ($this->view->filters['area'] && !in_array($this->view->filters['area'], array('mine', 'assigned', 'interest'))) {
         $this->view->filters['area'] = '';
     }
     // Get questions of interest
     if ($this->view->filters['area'] == 'interest') {
         require_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'tags.php';
         // Get tags of interest
         $mt = new \Components\Members\Models\Tags(User::get('id'));
         $mytags = $mt->render('string');
         $this->view->filters['tag'] = $this->view->filters['tag'] ? $this->view->filters['tag'] : $mytags;
         $this->view->filters['mine'] = 0;
     }
     // Get assigned questions
     if ($this->view->filters['area'] == 'assigned') {
         require_once PATH_CORE . DS . 'components' . DS . 'com_tools' . DS . 'tables' . DS . 'author.php';
         // What tools did this user contribute?
         $TA = new \Components\Tools\Tables\Author($this->database);
         $tools = $TA->getToolContributions(User::get('id'));
         $mytooltags = array();
         if ($tools) {
             foreach ($tools as $tool) {
                 $mytooltags[] = 'tool' . $tool->toolname;
             }
         }
         $this->view->filters['tag'] = $this->view->filters['tag'] ? $this->view->filters['tag'] : implode(',', $mytooltags);
         $this->view->filters['mine'] = 0;
     }
     if ($this->view->filters['area'] == 'mine') {
         $this->view->filters['mine'] = 1;
     }
     // Instantiate a Questions object
     $aq = new Tables\Question($this->database);
     if (($this->view->filters['area'] == 'interest' || $this->view->filters['area'] == 'assigned') && !$this->view->filters['tag']) {
         // Get a record count
         $this->view->total = 0;
         // Get records
         $this->view->results = array();
     } else {
         // Get a record count
         $this->view->total = $aq->getCount($this->view->filters);
         // Get records
         $this->view->results = $aq->getResults($this->view->filters);
     }
     // Did we get any results?
     if (count($this->view->results) > 0) {
         // Do some processing on the results
         foreach ($this->view->results as $i => $result) {
             $this->view->results[$i] = new Question($result);
         }
     }
     // Set the page title
     $this->_buildTitle();
     // Set the pathway
     $this->_buildPathway();
     // Output HTML
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $this->view->setLayout('search')->display();
 }