当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::getByID方法代码示例

本文整理汇总了PHP中Group::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::getByID方法的具体用法?PHP Group::getByID怎么用?PHP Group::getByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group::getByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_set_groups

 public function update_set_groups()
 {
     if ($this->token->validate('update_set_groups')) {
         $gs = GroupSet::getByID($this->post('gsID'));
         if (!is_object($gs)) {
             $this->error->add(t('Invalid group set.'));
         }
         if (!$this->error->has()) {
             // go through and add all the attributes that aren't in another set
             $gs->clearGroups();
             if (is_array($this->post('gID'))) {
                 foreach ($_POST['gID'] as $gID) {
                     $g = Group::getByID($gID);
                     if (is_object($g)) {
                         $gs->addGroup($g);
                     }
                 }
             }
             $this->redirect('dashboard/users/group_sets', 'set_updated');
         }
     } else {
         $this->error->add($this->token->getErrorMessage());
     }
     $this->edit($this->post('asID'));
 }
开发者ID:nveid,项目名称:concrete5,代码行数:25,代码来源:sets.php

示例2: save

 public function save($post)
 {
     // clear all selected permissions
     $tps = array();
     foreach ($post['tpID'] as $tpID) {
         $tp = TaskPermission::getByID($tpID);
         $tps[] = $tp;
         $tp->clearPermissions();
     }
     foreach ($post['selectedEntity'] as $e) {
         if ($e != '') {
             $o1 = explode('_', $e);
             if ($o1[0] == 'uID') {
                 $obj = UserInfo::getByID($o1[1]);
             } else {
                 $obj = Group::getByID($o1[1]);
             }
             foreach ($tps as $tp) {
                 if ($post[$e . '_' . $tp->getTaskPermissionID()] == 1) {
                     $tp->addAccess($obj);
                 }
             }
         }
     }
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:25,代码来源:task_permissions.php

示例3: run

 public function run()
 {
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('delete_user', t('Delete Users'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     Loader::model('single_page');
     $sp = Page::getByPath('/dashboard/settings/multilingual');
     if ($sp->isError()) {
         $d1a = SinglePage::add('/dashboard/settings/multilingual');
         $d1a->update(array('cName' => t('Multilingual Setup')));
     }
     $sp = Page::getByPath('/dashboard/composer');
     if ($sp->isError()) {
         $d2 = SinglePage::add('/dashboard/composer');
         $d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.')));
     }
     $sp = Page::getByPath('/dashboard/composer/write');
     if ($sp->isError()) {
         $d3 = SinglePage::add('/dashboard/composer/write');
     }
     $sp = Page::getByPath('/dashboard/composer/drafts');
     if ($sp->isError()) {
         $d4 = SinglePage::add('/dashboard/composer/drafts');
     }
     $sp = Page::getByPath('/dashboard/pages/types/composer');
     if ($sp->isError()) {
         $d5 = SinglePage::add('/dashboard/pages/types/composer');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:35,代码来源:version_542.php

示例4: delete

	public function delete($delGroupId, $token = ''){

		$u=new User();
		try {
		
			if(!$u->isSuperUser()) {
				throw new Exception(t('You do not have permission to perform this action.'));
			}
			
			$group = Group::getByID($delGroupId);			
			
			if(!($group instanceof Group)) {
				throw new Exception(t('Invalid group ID.'));
			}
			
			$valt = Loader::helper('validation/token');
			if (!$valt->validate('delete_group_' . $delGroupId, $token)) {
				throw new Exception($valt->getErrorMessage());
			}
			
			$group->delete(); 
			$resultMsg=t('Group deleted successfully.');		
			
			$_REQUEST=array();
			$_GET=array();
			$_POST=array();			
			$this->set('message', $resultMsg);
			$this->view(); 
		} catch(Exception $e) {
			$this->set('error', $e);
		}
	}	
开发者ID:nbourguig,项目名称:concrete5,代码行数:32,代码来源:groups.php

示例5: getSearchResultFromQuery

 public function getSearchResultFromQuery(Query $query)
 {
     $result = parent::getSearchResultFromQuery($query);
     $u = new \User();
     if (!$u->isSuperUser()) {
         $gIDs = array(-1);
         $gs = new GroupList();
         $groups = $gs->getResults();
         foreach ($groups as $g) {
             $gp = new \Permissions($g);
             if ($gp->canSearchUsersInGroup()) {
                 $gIDs[] = $g->getGroupID();
             }
         }
         $result->getItemListObject()->getQueryObject()->leftJoin("u", "UserGroups", "ugRequired", "ugRequired.uID = u.uID");
         $groups = 'ugRequired.gID in (' . implode(',', $gIDs) . ')';
         $gg = \Group::getByID(REGISTERED_GROUP_ID);
         $ggp = new \Permissions($gg);
         if ($ggp->canSearchUsersInGroup()) {
             $null = 'ugRequired.gID is null';
         }
         $result->getItemListObject()->getQueryObject()->select('distinct (u.uID)');
         $expr = $result->getItemListObject()->getQueryObject()->expr()->orX($groups, $null);
         $result->getItemListObject()->getQueryObject()->andwhere($expr);
     }
     return $result;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:27,代码来源:SearchProvider.php

示例6: addFilesForProduct

 public static function addFilesForProduct(array $files, StoreProduct $product)
 {
     self::removeFilesForProduct($product);
     //add new ones.
     if (!empty($files['dffID'])) {
         foreach ($files['dffID'] as $fileID) {
             if (!empty($fileID) && $fileID > 0) {
                 self::add($product->getProductID(), $fileID);
                 $fileObj = \File::getByID($fileID);
                 $fs = \FileSet::getByName("Digital Downloads");
                 $fs->addFileToSet($fileObj);
                 $fileObj->resetPermissions(1);
                 $pk = \Concrete\Core\Permission\Key\FileKey::getByHandle('view_file');
                 $pk->setPermissionObject($fileObj);
                 $pao = $pk->getPermissionAssignmentObject();
                 $groupEntity = \Concrete\Core\Permission\Access\Entity\GroupEntity::getOrCreate(\Group::getByID(GUEST_GROUP_ID));
                 $pa = $pk->getPermissionAccessObject();
                 if ($pa) {
                     $pa->removeListItem($groupEntity);
                     $pao->assignPermissionAccess($pa);
                 }
             }
         }
     }
 }
开发者ID:vividweb,项目名称:vivid_store,代码行数:25,代码来源:ProductFile.php

示例7: reindex

	/** 
	 * Reindexes the search engine.
	 */
	public function reindex() {

		Loader::library('3rdparty/Zend/Search/Lucene');
		Loader::library('3rdparty/StandardAnalyzer/Analyzer/Standard/English');

		$index = new Zend_Search_Lucene(DIR_FILES_CACHE_PAGES, true);
		//Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
		Zend_Search_Lucene_Analysis_Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English());
		
		$db = Loader::db();
		$collection_attributes = Loader::model('collection_attributes');
		$r = $db->query("select cID from Pages order by cID asc");
		$g = Group::getByID(GUEST_GROUP_ID);
		$nh = Loader::helper('navigation');
		
		while ($row = $r->fetchRow()) {
			$c = Page::getByID($row['cID'], 'ACTIVE');
			
			if($c->getCollectionAttributeValue('exclude_search_index')) continue;		
			
			$themeObject = $c->getCollectionThemeObject();
			$g->setPermissionsForObject($c);
			if ($g->canRead()) {			
				$pageID = md5($row['cID']);
				$doc = new Zend_Search_Lucene_Document();
				$doc->addField(Zend_Search_Lucene_Field::Keyword('cIDhash', $pageID));
				$doc->addField(Zend_Search_Lucene_Field::Unindexed('cID', $row['cID']));
				$doc->addField(Zend_Search_Lucene_Field::Text('cName', $c->getCollectionName(), APP_CHARSET));
				$doc->addField(Zend_Search_Lucene_Field::Keyword('ctHandle', $c->getCollectionTypeHandle()));
				$doc->addField(Zend_Search_Lucene_Field::Text('cDescription', $c->getCollectionDescription(), APP_CHARSET));
				$doc->addField(Zend_Search_Lucene_Field::Text('cBody', $this->getBodyContentFromPage($c), APP_CHARSET));
				
				if (is_object($themeObject)) {
					$doc->addField(Zend_Search_Lucene_Field::Text('cTheme', $themeObject->getThemeHandle()));
				}
				$doc->addField(Zend_Search_Lucene_Field::Text( 'cPath', $c->getCollectionPath())); 
				
				if (count($this->cPathSections) > 0) {
					foreach($this->cPathSections as $var => $cPath) {
						$isInSection = (strstr(strtolower($c->getCollectionPath()), $cPath . '/')) ? 'true' : 'false';
						$doc->addField(Zend_Search_Lucene_Field::Keyword($var, $isInSection));
					}
				}
				
				$attributes=$c->getSetCollectionAttributes();
				foreach($attributes as $attribute){
					if ($attribute->isCollectionAttributeKeySearchable()) {
						$doc->addField(Zend_Search_Lucene_Field::Keyword( $attribute->akHandle, $c->getCollectionAttributeValue($attribute) ));
					}
				}
				
				$index->addDocument($doc);
			}			
		}
		$result = new stdClass;
		$result->count = $index->count();
		return $result;
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:61,代码来源:indexed_search.php

示例8: run

 public function run()
 {
     $db = Loader::db();
     $columns = $db->MetaColumns('Pages');
     if (!isset($columns['CISSYSTEMPAGE'])) {
         $db->Execute('alter table Pages add column cIsSystemPage tinyint(1) not null default 0');
         $db->Execute('alter table Pages add index (cIsSystemPage)');
     }
     $columns = $db->MetaColumns('Pages');
     if (!isset($columns['CISACTIVE'])) {
         $db->Execute('alter table Pages add column cIsActive tinyint(1) not null default 1');
         $db->Execute('alter table Pages add index (cIsActive)');
         $db->Execute('update Pages set cIsActive = 1');
     }
     $columns = $db->MetaColumns('PageSearchIndex');
     if (!isset($columns['CREQUIRESREINDEX'])) {
         $db->Execute('alter table PageSearchIndex add column cRequiresReindex tinyint(1) not null default 0');
         $db->Execute('alter table PageSearchIndex add index (cRequiresReindex)');
     }
     // install version job
     Loader::model("job");
     Job::installByHandle('remove_old_page_versions');
     // flag system pages appropriately
     Page::rescanSystemPages();
     // add a newsflow task permission
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('view_newsflow'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('view_newsflow', t('View Newsflow'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     // Install new block types
     $this->installBlockTypes();
     // install stacks, trash and drafts
     $this->installSinglePages();
     // move the old dashboard
     $newDashPage = Page::getByPath('/dashboard/welcome');
     if (!is_object($newDashPage) || $newDashPage->isError()) {
         $dashboard = Page::getByPath('/dashboard');
         $dashboard->moveToTrash();
         // install new dashboard + page types
         $this->installDashboard();
         $this->migrateOldDashboard();
     }
     Loader::model('system/captcha/library');
     $scl = SystemCaptchaLibrary::getByHandle('securimage');
     if (!is_object($scl)) {
         $scl = SystemCaptchaLibrary::add('securimage', t('SecurImage (Default)'));
         $scl->activate();
     }
     Config::save('SEEN_INTRODUCTION', 1);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:55,代码来源:version_550.php

示例9: load

	public function load() {
		$db = Loader::db();
		$gID = $db->GetOne('select gID from PermissionAccessEntityGroups where peID = ?', array($this->peID));
		if ($gID) {
			$g = Group::getByID($gID);
			if (is_object($g)) {
				$this->group = $g;
				$this->label = $g->getGroupName();
			} else {
				$this->label = t('(Deleted Group)');
			}
		}
	}
开发者ID:ronlobo,项目名称:concrete5,代码行数:13,代码来源:group.php

示例10: run

 public function run()
 {
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('install_packages'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('install_packages', t('Install Packages and Connect to the Marketplace'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     // ensure we have a proper ocID
     $db->Execute("alter table Files modify column ocID int unsigned not null default 0");
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:14,代码来源:version_5411.php

示例11: run

 /** Executes the job.
  * @return string Returns a string describing the job result in case of success.
  * @throws Exception Throws an exception in case of errors.
  */
 public function run()
 {
     Cache::disableCache();
     Cache::disableLocalCache();
     try {
         $db = Loader::db();
         $instances = array('navigation' => Loader::helper('navigation'), 'dashboard' => Loader::helper('concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page'), 'guestGroup' => Group::getByID(GUEST_GROUP_ID), 'now' => new DateTime('now'), 'ak_exclude_sitemapxml' => CollectionAttributeKey::getByHandle('exclude_sitemapxml'), 'ak_sitemap_changefreq' => CollectionAttributeKey::getByHandle('sitemap_changefreq'), 'ak_sitemap_priority' => CollectionAttributeKey::getByHandle('sitemap_priority'));
         $instances['guestGroupAE'] = array(GroupPermissionAccessEntity::getOrCreate($instances['guestGroup']));
         $xmlDoc = new SimpleXMLElement('<' . '?xml version="1.0" encoding="' . APP_CHARSET . '"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
         $rs = Loader::db()->Query('SELECT cID FROM Pages');
         while ($row = $rs->FetchRow()) {
             self::addPage($xmlDoc, intval($row['cID']), $instances);
         }
         $rs->Close();
         Events::fire('on_sitemap_xml_ready', $xmlDoc);
         $dom = dom_import_simplexml($xmlDoc)->ownerDocument;
         $dom->formatOutput = true;
         $addedPages = count($xmlDoc->url);
         $relName = ltrim(SITEMAPXML_FILE, '\\/');
         $osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
         $urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
         if (!file_exists($osName)) {
             @touch($osName);
         }
         if (!is_writable($osName)) {
             throw new Exception(t('The file %s is not writable', $osName));
         }
         if (!($hFile = @fopen($osName, 'w'))) {
             throw new Exception(t('Cannot open file %s', $osName));
         }
         if (!@fwrite($hFile, $dom->saveXML())) {
             throw new Exception(t('Error writing to file %s', $osName));
         }
         @fflush($hFile);
         @fclose($hFile);
         unset($hFile);
         return t('%1$s file saved (%2$d pages).', sprintf('<a href="%s" target="_blank">%s</a>', $urlName, preg_replace('/^https?:\\/\\//i', '', $urlName)), $addedPages);
     } catch (Exception $x) {
         if (isset($hFile) && $hFile) {
             @fflush($hFile);
             @ftruncate($hFile, 0);
             @fclose($hFile);
             $hFile = null;
         }
         throw $x;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:51,代码来源:generate_sitemap.php

示例12: load

 public function load()
 {
     $db = Loader::db();
     $gIDs = $db->GetCol('select gID from PermissionAccessEntityGroups where peID = ? order by gID asc', array($this->peID));
     if ($gIDs && is_array($gIDs)) {
         for ($i = 0; $i < count($gIDs); $i++) {
             $g = Group::getByID($gIDs[$i]);
             if (is_object($g)) {
                 $this->groups[] = $g;
                 $this->label .= $g->getGroupName();
                 if ($i + 1 < count($gIDs)) {
                     $this->label .= t(' + ');
                 }
             }
         }
     }
 }
开发者ID:nanpou,项目名称:concrete5,代码行数:17,代码来源:group_combination.php

示例13: filterList

 /**
  * @param FileList $list
  * @param $request
  */
 public function filterList(ItemList $list)
 {
     $filterGIDs = array();
     if (isset($this->data['gID']) && is_array($this->data['gID'])) {
         foreach ($this->data['gID'] as $gID) {
             $g = \Group::getByID($gID);
             if (is_object($g)) {
                 $gp = new \Permissions($g);
                 if ($gp->canSearchUsersInGroup()) {
                     $filterGIDs[] = $g->getGroupID();
                 }
             }
         }
     }
     foreach ($filterGIDs as $gID) {
         $list->filterByGroupID($gID);
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:22,代码来源:UserGroupField.php

示例14: canGuestsViewThisBlock

 public function canGuestsViewThisBlock()
 {
     $pk = PermissionKey::getByHandle('view_block');
     $pk->setPermissionObject($this->getPermissionObject());
     $gg = GroupPermissionAccessEntity::getOrCreate(Group::getByID(GUEST_GROUP_ID));
     $accessEntities = array($gg);
     $valid = false;
     $list = $pk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     foreach ($list as $l) {
         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
             $valid = true;
         }
         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
             $valid = false;
         }
     }
     return $valid;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:18,代码来源:block.php

示例15: run

 public function run()
 {
     $bt = BlockType::getByHandle('guestbook');
     if (is_object($bt)) {
         $bt->refresh();
     }
     // add user export users task permission
     $pk = PermissionKey::getByHandle('access_user_search_export');
     if (!$pk instanceof PermissionKey) {
         $pk = PermissionKey::add('user', 'access_user_search_export', 'Export Site Users', 'Controls whether a user can export site users or not', false, false);
         $pa = $pk->getPermissionAccessObject();
         if (!is_object($pa)) {
             $pa = PermissionAccess::create($pk);
         }
         $adminGroup = Group::getByID(ADMIN_GROUP_ID);
         //Make sure "Adminstrators" group still exists
         if ($adminGroup) {
             $adminGroupEntity = GroupPermissionAccessEntity::getOrCreate($adminGroup);
             $pa->addListItem($adminGroupEntity);
             $pt = $pk->getPermissionAssignmentObject();
             $pt->assignPermissionAccess($pa);
         }
     }
     if (!Config::get('SECURITY_TOKEN_JOBS')) {
         Config::save('SECURITY_TOKEN_JOBS', Loader::helper('validation/identifier')->getString(64));
     }
     if (!Config::get('SECURITY_TOKEN_ENCRYPTION')) {
         Config::save('SECURITY_TOKEN_ENCRYPTION', Loader::helper('validation/identifier')->getString(64));
     }
     if (!Config::get('SECURITY_TOKEN_VALIDATION')) {
         Config::save('SECURITY_TOKEN_VALIDATION', Loader::helper('validation/identifier')->getString(64));
     }
     $sp = Page::getByPath('/dashboard/system/mail/method/test_settings');
     if (!is_object($sp) || $sp->isError()) {
         $sp = SinglePage::add('/dashboard/system/mail/method/test_settings');
         $sp->update(array('cName' => t('Test Mail Settings')));
         $sp->setAttribute('meta_keywords', 'test smtp, test mail');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:39,代码来源:version_563.php


注:本文中的Group::getByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。