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


PHP CRM_Core_Permission::ufGroupValid方法代码示例

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


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

示例1: preProcess

 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  * @access public
  *
  */
 function preProcess()
 {
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
     if (!$this->_id) {
         $session =& CRM_Core_Session::singleton();
         $this->_id = $session->get('userID');
         if (!$this->_id) {
             CRM_Core_Error::fatal(ts('Could not find the required contact id parameter (id=) for viewing a contact record with a Profile.'));
         }
     }
     $this->assign('cid', $this->_id);
     $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     if ($this->_gid) {
         require_once 'CRM/Profile/Page/Dynamic.php';
         $page =& new CRM_Profile_Page_Dynamic($this->_id, $this->_gid, 'Profile');
         $profileGroup = array();
         $profileGroup['title'] = null;
         $profileGroup['content'] = $page->run();
         $profileGroups[] = $profileGroup;
         $map = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_map');
         if ($map) {
             $this->assign('mapURL', CRM_Utils_System::url("civicrm/profile/map", "reset=1&pv=1&cid={$this->_id}&gid={$this->_gid}"));
         }
         if (CRM_Core_Permission::ufGroupValid($this->_gid, CRM_Core_Permission::SEARCH)) {
             $this->assign('listingURL', CRM_Utils_System::url("civicrm/profile", "force=1&gid={$this->_gid}"));
         }
     } else {
         require_once 'CRM/Core/BAO/UFGroup.php';
         $ufGroups =& CRM_Core_BAO_UFGroup::getModuleUFGroup('Profile');
         $profileGroups = array();
         foreach ($ufGroups as $groupid => $group) {
             require_once 'CRM/Profile/Page/Dynamic.php';
             $page =& new CRM_Profile_Page_Dynamic($this->_id, $groupid, 'Profile');
             $profileGroup = array();
             $profileGroup['title'] = $group['title'];
             $profileGroup['content'] = $page->run();
             $profileGroups[] = $profileGroup;
         }
         $this->assign('listingURL', CRM_Utils_System::url("civicrm/profile", "force=1"));
     }
     $this->assign('groupID', $this->_gid);
     $this->assign('profileGroups', $profileGroups);
     $this->assign('recentlyViewed', false);
     $title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
     //CRM-4131.
     $sortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_id, 'display_name');
     if ($sortName) {
         require_once 'CRM/Core/Permission.php';
         require_once 'CRM/Contact/BAO/Contact/Permission.php';
         $session = CRM_Core_Session::singleton();
         $config = CRM_Core_Config::singleton();
         if ($session->get('userID') && CRM_Core_Permission::check('access CiviCRM') && CRM_Contact_BAO_Contact_Permission::allow($session->get('userID'), CRM_Core_Permission::VIEW) && !$config->userFrameworkFrontend) {
             $sortNameUrl = CRM_Utils_System::url('civicrm/contact/view', "action=view&reset=1&cid={$this->_id}", true);
             $sortName = "<a href=\"{$sortNameUrl}\">{$sortName}</a>";
         }
         $title .= ' - ' . $sortName;
     }
     CRM_Utils_System::setTitle($title);
 }
开发者ID:bhirsch,项目名称:civicrm,代码行数:67,代码来源:View.php

示例2: array

 /**
  * This method returns the links that are given for each search row.
  *
  * @return array
  * @access public
  *
  */
 static function &links($map = FALSE, $editLink = FALSE, $ufLink = FALSE, $gids = NULL)
 {
     if (!self::$_links) {
         self::$_links = array();
         $viewPermission = TRUE;
         if ($gids) {
             // check view permission for each profile id, in case multiple profile ids are rendered
             // then view action is disabled if any profile returns false
             foreach ($gids as $profileId) {
                 $viewPermission = CRM_Core_Permission::ufGroupValid($profileId, CRM_Core_Permission::VIEW);
                 if (!$viewPermission) {
                     break;
                 }
             }
         }
         if ($viewPermission) {
             self::$_links[CRM_Core_Action::VIEW] = array('name' => ts('View'), 'url' => 'civicrm/profile/view', 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%', 'title' => ts('View Profile Details'));
         }
         if ($editLink) {
             self::$_links[CRM_Core_Action::UPDATE] = array('name' => ts('Edit'), 'url' => 'civicrm/profile/edit', 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%', 'title' => ts('Edit'));
         }
         if ($ufLink) {
             self::$_links[CRM_Core_Action::PROFILE] = array('name' => ts('Website Profile'), 'url' => 'user/%%ufID%%', 'qs' => ' ', 'title' => ts('View Website Profile'));
         }
         if ($map) {
             self::$_links[CRM_Core_Action::MAP] = array('name' => ts('Map'), 'url' => 'civicrm/profile/map', 'qs' => 'reset=1&cid=%%id%%&gid=%%gid%%', 'title' => ts('Map'));
         }
     }
     return self::$_links;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:Listings.php

示例3: preProcess

 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if (!$this->_id) {
         $session = CRM_Core_Session::singleton();
         $this->_id = $session->get('userID');
         if (!$this->_id) {
             CRM_Core_Error::fatal(ts('Could not find the required contact id parameter (id=) for viewing a contact record with a Profile.'));
         }
     }
     $this->assign('cid', $this->_id);
     $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     $profileIds = array();
     if (count($gids) > 1) {
         if (!empty($gids)) {
             foreach ($gids as $pfId) {
                 $profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
             }
         }
         // check if we are rendering mixed profiles
         if (CRM_Core_BAO_UFGroup::checkForMixProfiles($profileIds)) {
             CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
         }
         $this->_gid = $profileIds[0];
     }
     if (!$this->_gid) {
         $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0, 'GET');
     }
     $anyContent = TRUE;
     if ($this->_gid) {
         $page = new CRM_Profile_Page_Dynamic($this->_id, $this->_gid, 'Profile', FALSE, $profileIds);
         $profileGroup = array();
         $profileGroup['title'] = NULL;
         $profileGroup['content'] = $page->run();
         if (empty($profileGroup['content'])) {
             $anyContent = FALSE;
         }
         $profileGroups[] = $profileGroup;
         $gidString = $this->_gid;
         if (!empty($profileIds)) {
             $gidString = implode(',', $profileIds);
         }
         $map = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_map');
         if ($map) {
             $this->assign('mapURL', CRM_Utils_System::url("civicrm/profile/map", "reset=1&pv=1&cid={$this->_id}&gid={$gidString}"));
         }
         if (CRM_Core_Permission::ufGroupValid($this->_gid, CRM_Core_Permission::SEARCH)) {
             $this->assign('listingURL', CRM_Utils_System::url("civicrm/profile", "force=1&gid={$gidString}"));
         }
     } else {
         $ufGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup('Profile');
         $profileGroups = array();
         foreach ($ufGroups as $groupid => $group) {
             $page = new CRM_Profile_Page_Dynamic($this->_id, $groupid, 'Profile', FALSE, $profileIds);
             $profileGroup = array();
             $profileGroup['title'] = $group['title'];
             $profileGroup['content'] = $page->run();
             if (empty($profileGroup['content'])) {
                 $anyContent = FALSE;
             }
             $profileGroups[] = $profileGroup;
         }
         $this->assign('listingURL', CRM_Utils_System::url("civicrm/profile", "force=1"));
     }
     $this->assign('groupID', $this->_gid);
     $this->assign('profileGroups', $profileGroups);
     $this->assign('recentlyViewed', FALSE);
     // do not set title if there is no content
     // CRM-6081
     if (!$anyContent) {
         CRM_Utils_System::setTitle('');
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:79,代码来源:View.php

示例4: array

 /**
  * This method returns the links that are given for each search row.
  *
  * @return array
  * @access public
  *
  */
 static function &links($map = false, $editLink = false, $ufLink = false, $gid = null)
 {
     if (!self::$_links) {
         self::$_links = array();
         $viewPermission = true;
         if ($gid) {
             $viewPermission = CRM_Core_Permission::ufGroupValid($gid, CRM_Core_Permission::VIEW);
         }
         if ($viewPermission) {
             self::$_links[CRM_Core_Action::VIEW] = array('name' => ts('View'), 'url' => 'civicrm/profile/view', 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%', 'title' => ts('View Profile Details'));
         }
         if ($editLink) {
             self::$_links[CRM_Core_Action::UPDATE] = array('name' => ts('Edit'), 'url' => 'civicrm/profile/edit', 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%', 'title' => ts('Edit'));
         }
         if ($ufLink) {
             self::$_links[CRM_Core_Action::PROFILE] = array('name' => ts('Website Profile'), 'url' => 'user/%%ufID%%', 'qs' => ' ', 'title' => ts('View Website Profile'));
         }
         if ($map) {
             self::$_links[CRM_Core_Action::MAP] = array('name' => ts('Map'), 'url' => 'civicrm/profile/map', 'qs' => 'reset=1&cid=%%id%%&gid=%%gid%%', 'title' => ts('Map'));
         }
     }
     return self::$_links;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:30,代码来源:Listings.php


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