public function getForm($item, $description = '')
 {
     if ($item instanceof TaskPermission) {
         $tp = new TaskPermissionList();
         $tp->add($item);
     } else {
         $tp = $item;
     }
     $gl = new GroupList($tp);
     $ul = new UserInfoList($tp);
     $uArray = $ul->getUserInfoList();
     $gArray = $gl->getGroupList();
     $tps = $tp->getTaskPermissions();
     $html = '';
     foreach ($tps as $_tp) {
         $html .= '<input type="hidden" name="tpID[]" value="' . $_tp->getTaskPermissionID() . '" />';
     }
     $html .= '<a href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/user_group_selector" id="ug-selector" dialog-modal="false" dialog-width="90%" dialog-title="' . t('Choose User/Group') . '"  dialog-height="70%" class="ccm-button-right dialog-launch"><span><em>' . t('Add Group or User') . '</em></span></a>';
     $html .= '<p>' . $description . '</p>';
     $html .= '<div class="ccm-spacer">&nbsp;</div><br/>';
     $html .= '<div id="ccm-permissions-entities-wrapper" class="ccm-permissions-entities-wrapper"><div id="ccm-permissions-entity-base" class="ccm-permissions-entity-base">' . $this->getAccessRow($tp) . '</div>';
     foreach ($gArray as $g) {
         $html .= $this->getAccessRow($tp, $g);
     }
     foreach ($uArray as $ui) {
         $html .= $this->getAccessRow($tp, $ui);
     }
     $html .= '</div>';
     return $html;
 }
Example #2
0
 public function getAccessEntityUsers(PermissionAccess $pa)
 {
     $gl = new GroupList();
     foreach ($this->groups as $g) {
         $gl->filterByGroupID($g->getGroupID());
     }
     return $gl->get();
 }
Example #3
0
 public function edit()
 {
     $this->set('form', \Loader::helper('form'));
     $this->set('apikey', \Config::get('auth.community.appid', ''));
     $this->set('apisecret', \Config::get('auth.community.secret', ''));
     $list = new \GroupList();
     $list->includeAllGroups();
     $this->set('groups', $list->getResults());
 }
Example #4
0
 /**
  * @see \C5TL\Parser\DynamicItem::parseManual()
  */
 public function parseManual(\Gettext\Translations $translations, $concrete5version)
 {
     if (class_exists('\\GroupList', true)) {
         $gl = new \GroupList(null, false, true);
         foreach ($gl->getGroupList() as $g) {
             $this->addTranslation($translations, $g->getGroupName(), 'GroupName');
             $this->addTranslation($translations, $g->getGroupDescription(), 'GroupDescription');
         }
     }
 }
 public function edit()
 {
     $this->set('form', \Loader::helper('form'));
     $this->set('apikey', \Config::get('auth.worldskills.appid', ''));
     $this->set('apisecret', \Config::get('auth.worldskills.secret', ''));
     $this->set('rolesApplicationCode', \Config::get('auth.worldskills.roles_application_code', ''));
     $list = new \GroupList();
     $list->includeAllGroups();
     $this->set('groups', $list->getResults());
 }
Example #6
0
 public function edit()
 {
     $this->set('form', \Loader::helper('form'));
     $this->set('apikey', \Config::get('auth.google.appid', ''));
     $this->set('apisecret', \Config::get('auth.google.secret', ''));
     $list = new \GroupList();
     $list->includeAllGroups();
     $this->set('groups', $list->getResults());
     $this->set('whitelist', \Config::get('auth.google.email_filters.whitelist', array()));
     $blacklist = array_map(function ($entry) {
         return json_encode($entry);
     }, \Config::get('auth.google.email_filters.blacklist', array()));
     $this->set('blacklist', $blacklist);
 }
 function getAllGroups()
 {
     if (func_num_args() == 0) {
         return array('description' => t('List of all groups'));
     }
     Loader::model('groups');
     $groupslist = new GroupList(null, false, true);
     $groups = $groupslist->getGroupList();
     $groups_names = array();
     foreach ($groups as $group) {
         $groups_names[] = $group->getGroupName();
     }
     $count = count($groups_names) - 1;
     $last = $groups_names[$count];
     unset($groups_names[$count]);
     $str = join(", ", $groups_names);
     $str .= ' ' . t('and') . ' ' . $last;
     return $str;
 }
Example #8
0
	public function getForm($item, $description = '') {
		
		if ($item instanceof TaskPermission) {
			$tp = new TaskPermissionList();
			$tp->add($item);
		} else {
			$tp = $item;
		}

		$gl = new GroupList($tp);
		$ul = new UserInfoList($tp);
		$uArray = $ul->getUserInfoList();
		$gArray = $gl->getGroupList();
		
		$tps = $tp->getTaskPermissions();
		$html = '';
		foreach($tps as $_tp) {
			$html .= '<input type="hidden" name="tpID[]" value="' . $_tp->getTaskPermissionID() . '" />';
		}
		
		$html .= '<div class="ccm-pane-body">';
		$html .= '<a class="btn ug-selector ccm-button-right dialog-launch" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/users/search_dialog?mode=choose_multiple" dialog-modal="false" dialog-width="90%" dialog-title="' . t('Add User') . '"  dialog-height="70%">' . t('Add User') . '</a>';
		$html .= '<a class="btn ug-selector ccm-button-right dialog-launch" style="margin-right: 5px" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/select_group" dialog-modal="false" dialog-title="' . t('Add Group') . '">' . t('Add Group') . '</a>';

		$html .= '<p>' . $description . '</p>'; 

		$html .= '<div id="ccm-permissions-entities-wrapper" class="ccm-permissions-entities-wrapper"><div id="ccm-permissions-entity-base" class="ccm-permissions-entity-base">' . $this->getAccessRow($tp) . '</div>';
		
		foreach($gArray as $g) { 
			$html .= $this->getAccessRow($tp, $g);
		}
		
		foreach($uArray as $ui) {
			$html .= $this->getAccessRow($tp, $ui);
		}
		
		
		$html .= '</div></div>';
		
		return $html;
	}
Example #9
0
 function showContent()
 {
     $this->elementStart('p', array('id' => 'new_group'));
     $this->element('a', array('href' => common_local_url('newgroup'), 'class' => 'more'), _('Create a new group'));
     $this->elementEnd('p');
     $this->elementStart('p', array('id' => 'group_search'));
     $this->element('a', array('href' => common_local_url('groupsearch'), 'class' => 'more'), _('Search for more groups'));
     $this->elementEnd('p');
     if (Event::handle('StartShowUserGroupsContent', array($this))) {
         $offset = ($this->page - 1) * GROUPS_PER_PAGE;
         $limit = GROUPS_PER_PAGE + 1;
         $groups = $this->user->getGroups($offset, $limit);
         if ($groups instanceof User_group) {
             $gl = new GroupList($groups, $this->user, $this);
             $cnt = $gl->show();
             $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'usergroups', array('nickname' => $this->user->nickname));
         } else {
             $this->showEmptyListMessage();
         }
         Event::handle('EndShowUserGroupsContent', array($this));
     }
 }
Example #10
0
 function showContent()
 {
     if ($this->scoped instanceof Profile && $this->scoped->sameAs($this->getTarget())) {
         $notice = sprintf(_('Groups let you find and talk with ' . 'people of similar interests. ' . 'You can [search for groups](%%%%action.groups%%%%) in your instance or ' . '[create a new group](%%%%action.newgroup%%%%). ' . 'You can also follow groups ' . 'from other GNU social instances: click on the remote button below ' . 'and copy the group\'s link. ' . 'You can find a list of GNU social groups [here](http://skilledtests.com/wiki/List_of_federated_GNU_social_groups)' . ''));
         $this->elementStart('div', 'instructions');
         $this->raw(common_markup_to_html($notice));
         $this->elementEnd('div');
     }
     if (Event::handle('StartShowUserGroupsContent', array($this))) {
         $offset = ($this->page - 1) * GROUPS_PER_PAGE;
         $limit = GROUPS_PER_PAGE + 1;
         $groups = $this->getTarget()->getGroups($offset, $limit);
         if ($groups instanceof User_group) {
             $gl = new GroupList($groups, $this->getTarget(), $this);
             $cnt = $gl->show();
             if (0 == $cnt) {
                 $this->showEmptyListMessage();
             } else {
                 $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'usergroups', array('nickname' => $this->getTarget()->getNickname()));
             }
         }
         Event::handle('EndShowUserGroupsContent', array($this));
     }
 }
Example #11
0
 function __construct($user_group, $terms, $action)
 {
     parent::__construct($user_group, null, $action);
     $this->terms = array_map('preg_quote', array_map('htmlspecialchars', $terms));
     $this->pattern = '/(' . implode('|', $terms) . ')/i';
 }
Example #12
0
				// won't see anything. so we have to check
				$areac = Page::getByID($a->getAreaCollectionInheritID());
				$inheritArea = Area::get($areac, $_GET['arHandle']);
				if ($inheritArea->overrideCollectionPermissions()) {
					// okay, so that area is still around, still has set permissions on it. So we
					// pass our current area to our grouplist, userinfolist objects, knowing that they will 
					// smartly inherit the correct items.
					$gl = new GroupList($a);
					$ul = new UserInfoList($a);
					$permsSet = true;				
				}
			}		
			
			if (!$permsSet) {
				// otherwise we grab the collection permissions for this page
				$gl = new GroupList($c);
				$ul = new UserInfoList($c);
			}	
		}
		
		$gArray = $gl->getGroupList();
		$ulArray = $ul->getUserInfoList();
		
		?>
		<script type="text/javascript">
			function ccm_triggerSelectUser(uID, uName) {
				rowValue = "uID:" + uID;
				rowText = uName;
				if ($("#_row_uID_" + uID).length > 0) {
					return false;
				}			
<?php

defined('C5_EXECUTE') or die("Access Denied.");
?>

<?php 
$included = $permissionAccess->getAccessListItems(PermissionKey::ACCESS_TYPE_INCLUDE);
$excluded = $permissionAccess->getAccessListItems(PermissionKey::ACCESS_TYPE_EXCLUDE);
$gl = new GroupList();
$gl->filter('gID', REGISTERED_GROUP_ID, '>');
$gl->sortBy('gID', 'asc');
$gIDs = $gl->getResults();
$gArray = array();
foreach ($gIDs as $gID) {
    $groups[] = Group::getByID($gID['gID']);
}
$form = Loader::helper('form');
?>

<?php 
if (count($included) > 0 || count($excluded) > 0) {
    ?>

<?php 
    if (count($included) > 0) {
        ?>

<h3><?php 
        echo t('Who can assign what?');
        ?>
</h3>
 /**
  * Displays the form for editing the authentication method
  * 
  * Saving the form calls saveAuthenticationType()
  */
 public function edit()
 {
     $this->set('form', \Loader::helper('form'));
     $this->set('domain', \Config::get('auth.auth0.domain', ''));
     $this->set('client_id', \Config::get('auth.auth0.client_id', ''));
     $this->set('client_secret', \Config::get('auth.auth0.client_secret', ''));
     $this->set('registration_enabled', \Config::get('auth.auth0.registration_enabled', ''));
     $this->set('registration_group', \Config::get('auth.auth0.registration_group', ''));
     $list = new \GroupList();
     $list->includeAllGroups();
     $this->set('groups', $list->getResults());
     // $this->set('whitelist', \Config::get('auth.auth0.email_filters.whitelist', array()));
     // $blacklist = array_map(function($entry) {
     //     return json_encode($entry);
     // }, \Config::get('auth.auth0.email_filters.blacklist', array()));
     // $this->set('blacklist', $blacklist);
 }
Example #15
0
 protected function set_permissions($saved = false)
 {
     //IP Address Blacklist
     Loader::model('user_banned_ip');
     $ip_ban_enable_lock_ip_after = Config::get('IP_BAN_LOCK_IP_ENABLE');
     $ip_ban_enable_lock_ip_after = $ip_ban_enable_lock_ip_after == 1 ? 1 : 0;
     $ip_ban_lock_ip_after_attempts = Config::get('IP_BAN_LOCK_IP_ATTEMPTS');
     $ip_ban_lock_ip_after_time = Config::get('IP_BAN_LOCK_IP_TIME');
     $ip_ban_lock_ip_how_long_min = Config::get('IP_BAN_LOCK_IP_HOW_LONG_MIN') ? Config::get('IP_BAN_LOCK_IP_HOW_LONG_MIN') : '';
     if (!$ip_ban_lock_ip_how_long_min) {
         $ip_ban_lock_ip_how_long_type = self::IP_BAN_LOCK_IP_HOW_LONG_TYPE_FOREVER;
     } else {
         $ip_ban_lock_ip_how_long_type = self::IP_BAN_LOCK_IP_HOW_LONG_TYPE_TIMED;
     }
     $user_banned_ip = new UserBannedIP();
     //pull all once filter various lists using code
     $user_banned_ips = $user_banned_ip->Find('1=1');
     $user_banned_manual_ips = array();
     $user_banned_limited_ips = array();
     foreach ($user_banned_ips as $user_banned_ip) {
         if ($user_banned_ip->isManual == 1) {
             $user_banned_manual_ips[] = $user_banned_ip->getIPRangeForDisplay();
         } else {
             if ($user_banned_ip->expires - time() > 0 || $user_banned_ip->expires == 0) {
                 $user_banned_limited_ips[] = $user_banned_ip;
             }
         }
     }
     $user_banned_manual_ips = join($user_banned_manual_ips, "\n");
     $this->set('user_banned_manual_ips', $user_banned_manual_ips);
     $this->set('user_banned_limited_ips', $user_banned_limited_ips);
     $this->set('ip_ban_enable_lock_ip_after', $ip_ban_enable_lock_ip_after);
     $this->set('ip_ban_lock_ip_after_attempts', $ip_ban_lock_ip_after_attempts);
     $this->set('ip_ban_lock_ip_after_time', $ip_ban_lock_ip_after_time);
     $this->set('ip_ban_change_makeperm', self::IP_BLACKLIST_CHANGE_MAKEPERM);
     $this->set('ip_ban_change_remove', self::IP_BLACKLIST_CHANGE_REMOVE);
     $this->set('ip_ban_lock_ip_how_long_type', $ip_ban_lock_ip_how_long_type);
     $this->set('ip_ban_lock_ip_how_long_type', $ip_ban_lock_ip_how_long_type);
     $this->set('ip_ban_lock_ip_how_long_type_forever', self::IP_BAN_LOCK_IP_HOW_LONG_TYPE_FOREVER);
     $this->set('ip_ban_lock_ip_how_long_type_timed', self::IP_BAN_LOCK_IP_HOW_LONG_TYPE_TIMED);
     $this->set('ip_ban_lock_ip_how_long_min', $ip_ban_lock_ip_how_long_min);
     //maintanence mode
     $site_maintenance_mode = Config::get('SITE_MAINTENANCE_MODE');
     if ($site_maintenance_mode < 1) {
         $site_maintenance_mode = 0;
     }
     $this->set('site_maintenance_mode', $site_maintenance_mode);
     $this->set('user_banned_ips', $user_banned_ips);
     if ($saved) {
         switch ($saved) {
             case "maintenance_enabled":
                 $this->set('message', t('Maintenance Mode turned on. Your site is now private.'));
                 break;
             case "maintenance_disabled":
                 $this->set('message', t('Maintenance Mode turned off. Your site is public.'));
                 break;
             case "saved_ipblacklist":
                 $this->set('message', t('IP Blacklist Settings Updated'));
                 break;
                 //permissions saved
             //permissions saved
             default:
                 $this->set('message', t('Permissions saved.'));
         }
     }
     if (PERMISSIONS_MODEL != 'simple') {
         return;
     }
     $home = Page::getByID(1, "RECENT");
     $gl = new GroupList($home, false, true);
     $gArrayTmp = $gl->getGroupList();
     $gArray = array();
     foreach ($gArrayTmp as $gi) {
         if ($gi->getGroupID() == GUEST_GROUP_ID) {
             $ggu = $gi;
             if ($ggu->canRead()) {
                 $this->set('guestCanRead', true);
             }
         } else {
             if ($gi->getGroupID() == REGISTERED_GROUP_ID) {
                 $gru = $gi;
                 if ($gru->canRead()) {
                     $this->set('registeredCanRead', true);
                 }
             } else {
                 $gArray[] = $gi;
             }
         }
     }
     $this->set('ggu', $ggu);
     $this->set('gru', $gru);
     $this->set('gArray', $gArray);
     $this->set('home', $home);
 }
Example #16
0
<?php  
	$applyMSG = t('Apply these changes to all blocks aliased to this block? Note: This may take some time.');
	
	defined('C5_EXECUTE') or die("Access Denied.");
	global $c;
	global $a;
	
	if ($b->overrideAreaPermissions()) {
		$gl = new GroupList($b);
		$ul = new UserInfoList($b);
	} else if ($a->overrideCollectionPermissions()) {
		$gl = new GroupList($a);
		$ul = new UserInfoList($a);
	} else {
		$gl = new GroupList($c);
		$ul = new UserInfoList($c);
	}
	
	$gArray = $gl->getGroupList();
	$ulArray = $ul->getUserInfoList();
	// $p is the permissions object for this black
	$isAlias = $b->isAlias();
	$numChildren = (!$isAlias) ? $b->getNumChildren() : 0; ?>
	<script type="text/javascript">
		function revertToPagePermissions() {
			ff = document.getElementById('cbOverrideAreaPermissions');
			ff.value = '0';
			<?php  if ($numChildren) { ?>
			if (confirm("<?php echo $applyMSG?>")) {
				document.forms['ccmBlockPermissionForm'].action = document.forms['ccmBlockPermissionForm'].action + "&applyToAll=1";
			}
Example #17
0
 function showContent()
 {
     $this->elementStart('p', array('id' => 'new_group'));
     $this->element('a', array('href' => common_local_url('newgroup'), 'class' => 'more'), _('Create a new group'));
     $this->elementEnd('p');
     $this->elementStart('p', array('id' => 'group_search'));
     $this->element('a', array('href' => common_local_url('groupsearch'), 'class' => 'more'), _('Search for more groups'));
     $this->elementEnd('p');
     $offset = ($this->page - 1) * GROUPS_PER_PAGE;
     $limit = GROUPS_PER_PAGE + 1;
     $groups = $this->user->getGroups($offset, $limit);
     if ($groups) {
         $gl = new GroupList($groups, $this->user, $this);
         $cnt = $gl->show();
     }
     $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'usergroups', array('nickname' => $this->user->nickname));
 }
Example #18
0
					}
					$editComplete = true;
					// reload user object
					$uo = UserInfo::getByID(intval($_GET['uID']));
				} else {
					$db = Loader::db();
					$error[] = $db->ErrorMsg();
				}
			}		
		}	
	}
}


if (is_object($uo)) { 
	$gl = new GroupList($uo, true);
	if ($_GET['task'] == 'edit' || $_POST['edit'] && !$editComplete) { ?>

		<div class="wrapper">
		<div class="actions">
		<span class="required">*</span> - <?php echo t('required field')?>
		</div>
		
		<?php 
		$uName = ($_POST) ? $_POST['uName'] : $uo->getUserName();
		$uEmail = ($_POST) ? $_POST['uEmail'] : $uo->getUserEmail();
		?>
		
	<script>	
	function editAttrVal(attId,cancel){
		if(!cancel){
Example #19
0
 public function view()
 {
     if (PERMISSIONS_MODEL != 'simple') {
         return;
     }
     $home = Page::getByID(1, "RECENT");
     $gl = new GroupList($home, false, true);
     $gArrayTmp = $gl->getGroupList();
     $gArray = array();
     foreach ($gArrayTmp as $gi) {
         if ($gi->getGroupID() == GUEST_GROUP_ID) {
             $ggu = $gi;
             if ($ggu->canRead()) {
                 $this->set('guestCanRead', true);
             }
         } else {
             if ($gi->getGroupID() == REGISTERED_GROUP_ID) {
                 $gru = $gi;
                 if ($gru->canRead()) {
                     $this->set('registeredCanRead', true);
                 }
             } else {
                 $gArray[] = $gi;
             }
         }
     }
     $this->set('ggu', $ggu);
     $this->set('gru', $gru);
     $this->set('gArray', $gArray);
     $this->set('home', $home);
     if ($this->isPost()) {
         if ($this->token->validate('site_permissions_code')) {
             $gru = Group::getByID(REGISTERED_GROUP_ID);
             $ggu = Group::getByID(GUEST_GROUP_ID);
             $gau = Group::getByID(ADMIN_GROUP_ID);
             $args = array();
             switch ($_POST['view']) {
                 case "ANYONE":
                     $args['collectionRead'][] = 'gID:' . $ggu->getGroupID();
                     // this API is pretty crappy. TODO: clean this up in a nice object oriented fashion
                     break;
                 case "USERS":
                     $args['collectionRead'][] = 'gID:' . $gru->getGroupID();
                     // this API is pretty crappy. TODO: clean this up in a nice object oriented fashion
                     break;
                 case "PRIVATE":
                     $args['collectionRead'][] = 'gID:' . $gau->getGroupID();
                     break;
             }
             $args['collectionWrite'] = array();
             if (is_array($_POST['gID'])) {
                 foreach ($_POST['gID'] as $gID) {
                     $args['collectionReadVersions'][] = 'gID:' . $gID;
                     $args['collectionWrite'][] = 'gID:' . $gID;
                     $args['collectionAdmin'][] = 'gID:' . $gID;
                     $args['collectionDelete'][] = 'gID:' . $gID;
                 }
             }
             $args['cInheritPermissionsFrom'] = 'OVERRIDE';
             $args['cOverrideTemplatePermissions'] = 1;
             $home->updatePermissions($args);
             $this->redirect('/dashboard/system/permissions/site/', 'saved');
         } else {
             $this->error->add($this->token->getErrorMessage());
         }
     }
 }
Example #20
0
$ih = Loader::helper('concrete/ui');
$tp = new TaskPermission();
$users = array();
if (is_array($_REQUEST['uID'])) {
    foreach ($_REQUEST['uID'] as $uID) {
        $ui = UserInfo::getByID($uID);
        $users[] = $ui;
    }
}
foreach ($users as $ui) {
    $up = new Permissions($ui);
    if (!$up->canViewUser()) {
        die(t("Access Denied."));
    }
}
$gl = new GroupList();
$g1 = $gl->getResults();
if ($_POST['task'] == 'group_remove') {
    // build the group array
    $groupIDs = $_REQUEST['groupIDs'];
    $groups = array();
    if (is_array($groupIDs) && count($groupIDs)) {
        foreach ($groupIDs as $gID) {
            $groups[] = Group::getByID($gID);
        }
    }
    foreach ($users as $ui) {
        if ($ui instanceof UserInfo) {
            $u = $ui->getUserObject();
            foreach ($groups as $g) {
                $gp = new Permissions($g);
Example #21
0
<? 
	$applyMSG = t('Apply these changes to all blocks aliased to this block? Note: This may take some time.');
	
	defined('C5_EXECUTE') or die("Access Denied.");
	global $c;
	global $a;
	
	if ($b->overrideAreaPermissions()) {
		$gl = new GroupList($b);
		$ul = new UserInfoList($b);
	} else if ($a->overrideCollectionPermissions()) {
		$gl = new GroupList($a);
		$ul = new UserInfoList($a);
	} else {
		$gl = new GroupList($c);
		$ul = new UserInfoList($c);
	}
	
	$gArray = $gl->getGroupList();
	$ulArray = $ul->getUserInfoList();
	// $p is the permissions object for this black
	$isAlias = $b->isAlias();
	$numChildren = (!$isAlias) ? $b->getNumChildren() : 0; ?>
	<script type="text/javascript">
		function revertToPagePermissions() {
			ff = document.getElementById('cbOverrideAreaPermissions');
			ff.value = '0';
			<? if ($numChildren) { ?>
			if (confirm("<?php 
echo $applyMSG;
?>
Example #22
0
 function showContent()
 {
     if (common_logged_in()) {
         $this->elementStart('p', array('id' => 'new_group'));
         $this->element('a', array('href' => common_local_url('newgroup'), 'class' => 'more'), _('Create a new group'));
         $this->elementEnd('p');
     }
     $offset = ($this->page - 1) * GROUPS_PER_PAGE;
     $limit = GROUPS_PER_PAGE + 1;
     $qry = 'SELECT user_group.* ' . 'from user_group join local_group on user_group.id = local_group.group_id ' . 'order by user_group.created desc ' . 'limit ' . $limit . ' offset ' . $offset;
     $groups = new User_group();
     $cnt = 0;
     $groups->query($qry);
     $gl = new GroupList($groups, null, $this);
     $cnt = $gl->show();
     $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'groups');
 }
Example #23
0
 function showContent()
 {
     $this->elementStart('p', array('id' => 'new_group'));
     $this->element('a', array('href' => common_local_url('newgroup'), 'class' => 'more'), _('Create a new group'));
     $this->elementEnd('p');
     $offset = ($this->page - 1) * GROUPS_PER_PAGE;
     $limit = GROUPS_PER_PAGE + 1;
     $groups = new User_group();
     $groups->orderBy('created DESC');
     $groups->limit($offset, $limit);
     if ($groups->find()) {
         $gl = new GroupList($groups, null, $this);
         $cnt = $gl->show();
     }
     $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'groups');
 }