Exemplo n.º 1
0
                 $html .= ', <a class="assign-role" href="' . Route::url('index.php?option=' . $option . '&cn=' . $this->group->cn . '&active=members&action=assignrole&uid=' . $u->get('uidNumber')) . '">' . Lang::txt('PLG_GROUPS_MEMBERS_ASSIGN_ROLE') . '</a>';
             }
         }
     }
     if ($this->membership_control == 1) {
         if (($this->authorized == 'manager' || $this->authorized == 'admin') && !$roles) {
             $html .= '<strong>' . Lang::txt('PLG_GROUPS_MEMBERS_MEMBER_ROLES') . ':</strong> ';
             $html .= '<span class="roles-list" id="roles-list-' . $u->get('uidNumber') . '"></span>';
             $html .= ' <a class="assign-role" href="' . Route::url('index.php?option=' . $option . '&cn=' . $this->group->cn . '&active=members&action=assignrole&uid=' . $u->get('uidNumber')) . '">' . Lang::txt('PLG_GROUPS_MEMBERS_ASSIGN_ROLE') . '</a>';
         }
     }
     $html .= '</span>';
 }
 if ($this->filter == 'pending') {
     $database = App::get('db');
     $row = new Components\Groups\Tables\Reason($database);
     $row->loadReason($u->get('uidNumber'), $this->group->gidNumber);
     if ($row) {
         $html .= '<span class="reason" data-title="' . Lang::txt('PLG_GROUPS_MEMBERS_REASON_FOR_REQUEST') . '">';
         $html .= '<span class="reason-reason">' . stripslashes($row->reason) . '</span>';
         $html .= '<span class="reason-date">' . Date::of($row->date)->toLocal('F d, Y @ g:ia') . '</span>';
         $html .= '</span>';
     }
 } else {
     //$html .= '<span class="activity">Activity: </span>';
 }
 $html .= '</td>' . "\n";
 if ($this->authorized == 'manager' || $this->authorized == 'admin') {
     switch ($this->filter) {
         case 'invitees':
             if ($this->membership_control == 1) {
Exemplo n.º 2
0
		</thead>
		<tfoot>
			<tr>
				<td colspan="8"><?php 
echo $this->pagination($this->total, $this->filters['start'], $this->filters['limit']);
?>
</td>
			</tr>
		</tfoot>
		<tbody>
		<?php 
$k = 0;
$i = 0;
foreach ($this->rows as $row) {
    if (isset($row->username)) {
        $reason = new \Components\Groups\Tables\Reason($database);
        $reason->loadReason($row->username, $this->filters['gidNumber']);
        $reasonforjoin = '';
        if ($reason) {
            $reasonforjoin = stripslashes($reason->reason);
        }
    }
    $status = $row->role;
    ?>
			<tr class="<?php 
    echo "row{$k}";
    ?>
">
				<td>
					<input type="checkbox" name="id[]" id="cb<?php 
    echo $i;
Exemplo n.º 3
0
 /**
  * Approve membership for one or more users
  *
  * @return     void
  */
 private function approve()
 {
     if ($this->authorized != 'manager' && $this->authorized != 'admin') {
         return false;
     }
     if ($this->membership_control == 0) {
         return false;
     }
     $database = App::get('db');
     // Set a flag for emailing any changes made
     $admchange = '';
     // Note: we use two different lists to avoid situations where the user is already a member but somehow an applicant too.
     // Recording the list of applicants for removal separate allows for removing the duplicate entry from the applicants list
     // without trying to add them to the members list (which they already belong to).
     $users = array();
     $applicants = array();
     // Get all normal members (non-managers) of this group
     $members = $this->group->get('members');
     // Incoming array of users to promote
     $mbrs = Request::getVar('users', array(0));
     foreach ($mbrs as $mbr) {
         // Retrieve user's account info
         $targetuser = User::getInstance($mbr);
         // Ensure we found an account
         if (is_object($targetuser)) {
             $uid = $targetuser->get('id');
             // The list of applicants to remove from the applicant list
             $applicants[] = $uid;
             // Loop through existing members and make sure the user isn't already a member
             if (in_array($uid, $members)) {
                 $this->setError(Lang::txt('PLG_GROUPS_MESSAGES_ERROR_ALREADY_A_MEMBER', $mbr));
                 continue;
             }
             // Remove record of reason wanting to join group
             $reason = new Components\Groups\Tables\Reason($database);
             $reason->deleteReason($targetuser->get('id'), $this->group->get('gidNumber'));
             // Are they approved for membership?
             $admchange .= "\t\t" . $targetuser->get('name') . "\r\n";
             $admchange .= "\t\t" . $targetuser->get('username') . ' (' . $targetuser->get('email') . ')';
             $admchange .= count($mbrs) > 1 ? "\r\n" : '';
             // They user is not already a member, so we can go ahead and add them
             $users[] = $uid;
             // E-mail the user, letting them know they've been approved
             $this->notifyUser($targetuser);
         } else {
             $this->setError(Lang::txt('PLG_GROUPS_MESSAGES_ERROR_USER_NOTFOUND') . ' ' . $mbr);
         }
     }
     // Remove users from applicants list
     $this->group->remove('applicants', $applicants);
     // Add users to members list
     $this->group->add('members', $users);
     // Save changes
     $this->group->update();
     // log invites
     \Components\Groups\Models\Log::log(array('gidNumber' => $this->group->get('gidNumber'), 'action' => 'membership_approved', 'comments' => $users));
 }