本文整理汇总了PHP中Concrete\Core\Permission\Duration类的典型用法代码示例。如果您正苦于以下问题:PHP Duration类的具体用法?PHP Duration怎么用?PHP Duration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Duration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPermissionDurationObject
public function loadPermissionDurationObject($pdID)
{
if ($pdID > 0) {
$pd = Duration::getByID($pdID);
$this->duration = $pd;
}
}
示例2: validate
public function validate()
{
$u = new User();
if ($u->isSuperUser()) {
return true;
}
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
return false;
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$valid = false;
$list = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
$valid = true;
}
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
$valid = false;
}
}
return $valid;
}
示例3: getAccessListItems
public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
{
$db = Database::connection();
$list = parent::getAccessListItems($accessType, $filterEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
$pe = $l->getAccessEntityObject();
$prow = $db->fetchAssoc('select permission, externalLink from PagePermissionPageTypeAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
if (is_array($prow) && $prow['permission']) {
$l->setPageTypesAllowedPermission($prow['permission']);
$l->setAllowExternalLinks($prow['externalLink']);
$permission = $prow['permission'];
} elseif ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
$l->setPageTypesAllowedPermission('A');
$l->setAllowExternalLinks(1);
} else {
$l->setPageTypesAllowedPermission('N');
$l->setAllowExternalLinks(0);
}
if ($permission == 'C') {
$ptIDs = $db->GetCol('select ptID from PagePermissionPageTypeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
$l->setPageTypesAllowedArray($ptIDs);
}
}
return $list;
}
示例4: getMyAssignment
public function getMyAssignment()
{
$u = new User();
$asl = new AddConversationMessageConversationListItem();
if ($u->isSuperUser()) {
$asl->setNewConversationMessageApprovalStatus('A');
return $asl;
}
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
$asl->setNewConversationMessageApprovalStatus('U');
return $asl;
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(UserKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
if ($l->getNewConversationMessageApprovalStatus() == 'U') {
$asl->setNewConversationMessageApprovalStatus('U');
}
if ($l->getNewConversationMessageApprovalStatus() == 'A') {
$asl->setNewConversationMessageApprovalStatus('A');
}
}
return $asl;
}
示例5: getAllowedThemeIDs
protected function getAllowedThemeIDs()
{
$u = new User();
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
return array();
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(PageKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
$db = Loader::db();
$allpThemeIDs = $db->GetCol('select pThemeID from PageThemes order by pThemeID asc');
$pThemeIDs = array();
foreach ($list as $l) {
if ($l->getThemesAllowedPermission() == 'N') {
$pThemeIDs = array();
}
if ($l->getThemesAllowedPermission() == 'C') {
if ($l->getAccessType() == PageKey::ACCESS_TYPE_EXCLUDE) {
$pThemeIDs = array_values(array_diff($pThemeIDs, $l->getThemesAllowedArray()));
} else {
$pThemeIDs = array_unique(array_merge($pThemeIDs, $l->getThemesAllowedArray()));
}
}
if ($l->getThemesAllowedPermission() == 'A') {
$pThemeIDs = $allpThemeIDs;
}
}
return $pThemeIDs;
}
示例6: getCurrentlyActiveUsers
public function getCurrentlyActiveUsers(WorkflowProgress $wp)
{
$paa = $this->getPermissionAccessObject();
if (!$paa) {
return array();
}
$paa->setWorkflowProgressObject($wp);
$included = $this->getAccessListItems(self::ACCESS_TYPE_INCLUDE);
$excluded = $this->getAccessListItems(self::ACCESS_TYPE_EXCLUDE);
$included = PermissionDuration::filterByActive($included);
$excluded = PermissionDuration::filterByActive($excluded);
$users = array();
$usersExcluded = array();
foreach ($included as $inc) {
$pae = $inc->getAccessEntityObject();
$users = array_merge($users, $pae->getAccessEntityUsers($paa));
}
$users = array_unique($users);
foreach ($excluded as $inc) {
$pae = $inc->getAccessEntityObject();
$usersExcluded = array_merge($usersExcluded, $pae->getAccessEntityUsers());
}
$users = array_diff($users, $usersExcluded);
return $users;
}
示例7: getMyAssignment
public function getMyAssignment()
{
$u = new User();
$asl = new ViewUserAttributesUserPermissionAssignment();
if ($u->isSuperUser()) {
$asl->setAttributesAllowedPermission('A');
return $asl;
}
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
return $asl;
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(UserKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
if ($l->getAttributesAllowedPermission() == 'N') {
$asl->setAttributesAllowedPermission('N');
}
if ($l->getAttributesAllowedPermission() == 'C') {
$asl->setAttributesAllowedPermission('C');
}
if ($l->getAttributesAllowedPermission() == 'A') {
$asl->setAttributesAllowedPermission('A');
}
}
$asl->setAttributesAllowedArray($this->getAllowedAttributeKeyIDs($list));
return $asl;
}
示例8: getAccessListItems
public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
{
$db = Loader::db();
$list = parent::getAccessListItems($accessType, $filterEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
$pe = $l->getAccessEntityObject();
$prow = $db->GetRow('select permission from PagePermissionThemeAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
if (is_array($prow) && $prow['permission']) {
$l->setThemesAllowedPermission($prow['permission']);
$permission = $prow['permission'];
} else {
if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
$l->setThemesAllowedPermission('A');
} else {
$l->setThemesAllowedPermission('N');
}
}
if ($permission == 'C') {
$pThemeIDs = $db->GetCol('select pThemeID from PagePermissionThemeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
$l->setThemesAllowedArray($pThemeIDs);
}
}
return $list;
}
示例9: getAllowedFileExtensions
public function getAllowedFileExtensions()
{
$u = new User();
$extensions = array();
if ($u->isSuperUser()) {
$extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
return $extensions;
}
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
return array();
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(FileSetKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
if ($l->getFileTypesAllowedPermission() == 'N') {
$extensions = array();
}
if ($l->getFileTypesAllowedPermission() == 'C') {
$extensions = array_unique(array_merge($extensions, $l->getFileTypesAllowedArray()));
}
if ($l->getFileTypesAllowedPermission() == 'A') {
$extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
}
}
return $extensions;
}
示例10: getAccessListItems
public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array(), $checkCache = true)
{
$db = Database::connection();
$list = parent::getAccessListItems($accessType, $filterEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
/**
* @var $l NotifyInNotificationCenterNotificationListItem
*/
$pe = $l->getAccessEntityObject();
$prow = $db->GetRow('select permission from NotificationPermissionSubscriptionList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
if (is_array($prow) && $prow['permission']) {
$l->setSubscriptionsAllowedPermission($prow['permission']);
$permission = $prow['permission'];
if ($permission == 'C') {
$subscriptions = $db->GetCol('select nSubscriptionIdentifier from NotificationPermissionSubscriptionListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
$l->setSubscriptionsAllowedArray($subscriptions);
}
} elseif ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
$l->setSubscriptionsAllowedPermission('A');
} else {
$l->setSubscriptionsAllowedPermission('N');
}
}
return $list;
}
示例11: handlePageUpdate
public function handlePageUpdate($event)
{
$page = $event->getPageObject();
$pk = PermissionKey::getByHandle('view_page');
$pk->setPermissionObject($page);
$list = $pk->getAccessListItems();
foreach ($list as $pa) {
$pae = $pa->getAccessEntityObject();
if ($pae->getAccessEntityTypeHandle() == 'group') {
if ($pae->getGroupObject()->getGroupID() == GUEST_GROUP_ID) {
$pd = $pa->getPermissionDurationObject();
if (!is_object($pd)) {
$pd = new PermissionDuration();
}
$publicDate = strtotime($page->getCollectionDatePublic());
$pd->setStartDateAllDay(0);
$pd->setEndDateAllDay(0);
$pd->setStartDate($dateStart = date('Y-m-d H:i:s', $publicDate));
$pd->save();
$paa = PermissionAccess::getByID($pa->paID, $pk);
$paa->addListItem($pae, $pd, PermissionKey::ACCESS_TYPE_INCLUDE);
}
}
}
}
示例12: getAllowedBlockTypeIDs
protected function getAllowedBlockTypeIDs()
{
$u = new User();
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
return array();
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(AreaKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
$db = Loader::db();
$btIDs = array();
if (count($list) > 0) {
$cache = \Core::make('cache/request');
$dsh = Loader::helper('concrete/dashboard');
if ($dsh->inDashboard()) {
$identifier = 'blocktypeids/all';
} else {
$identifier = 'blocktypeids/public';
}
$item = $cache->getItem($identifier);
$allBTIDs = $item->get();
if ($item->isMiss()) {
if ($dsh->inDashboard()) {
$allBTIDs = $db->GetCol('select btID from BlockTypes');
} else {
$allBTIDs = $db->GetCol('select btID from BlockTypes where btIsInternal = 0');
}
$cache->save($item->set($allBTIDs));
}
foreach ($list as $l) {
if ($l->getBlockTypesAllowedPermission() == 'N') {
$btIDs = array();
}
if ($l->getBlockTypesAllowedPermission() == 'C') {
if ($l->getAccessType() == AreaKey::ACCESS_TYPE_EXCLUDE) {
$btIDs = array_values(array_diff($btIDs, $l->getBlockTypesAllowedArray()));
} else {
$btIDs = array_unique(array_merge($btIDs, $l->getBlockTypesAllowedArray()));
}
}
if ($l->getBlockTypesAllowedPermission() == 'A') {
$btIDs = $allBTIDs;
}
}
}
return $btIDs;
}
示例13: validateAccessEntities
public function validateAccessEntities($accessEntities)
{
$valid = false;
$accessEntities = $this->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
$valid = true;
}
if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
$valid = false;
}
}
return $valid;
}
示例14: getAccessListItems
public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = [], $checkCache = true)
{
$db = Database::connection();
$list = parent::getAccessListItems($accessType, $filterEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
$pe = $l->getAccessEntityObject();
$prow = $db->fetchAssoc('select permission from PagePermissionThemeAccessList where peID = ? and paID = ?', [$pe->getAccessEntityID(), $l->getPermissionAccessID()]);
if ($prow && $prow['permission']) {
$l->setThemesAllowedPermission($prow['permission']);
$permission = $prow['permission'];
if ($permission == 'C') {
$pThemeIDs = $db->GetCol('select pThemeID from PagePermissionThemeAccessListCustom where peID = ? and paID = ?', [$pe->getAccessEntityID(), $l->getPermissionAccessID()]);
$l->setThemesAllowedArray($pThemeIDs);
}
} elseif ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
$l->setThemesAllowedPermission('A');
} else {
$l->setThemesAllowedPermission('N');
}
}
return $list;
}
示例15: getAccessListItems
public function getAccessListItems($accessType = UserPermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
{
$db = Loader::db();
$list = parent::getAccessListItems($accessType, $filterEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
$pe = $l->getAccessEntityObject();
$prow = $db->GetRow('select attributePermission, uName, uPassword, uEmail, uAvatar, uTimezone, uDefaultLanguage from UserPermissionEditPropertyAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $this->getPermissionAccessID()));
if (is_array($prow) && $prow['attributePermission']) {
$l->setAttributesAllowedPermission($prow['attributePermission']);
$l->setAllowEditUserName($prow['uName']);
$l->setAllowEditEmail($prow['uEmail']);
$l->setAllowEditPassword($prow['uPassword']);
$l->setAllowEditAvatar($prow['uAvatar']);
$l->setAllowEditTimezone($prow['uTimezone']);
$l->setAllowEditDefaultLanguage($prow['uDefaultLanguage']);
$attributePermission = $prow['attributePermission'];
} else {
if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_INCLUDE) {
$l->setAttributesAllowedPermission('A');
$l->setAllowEditUserName(1);
$l->setAllowEditEmail(1);
$l->setAllowEditPassword(1);
$l->setAllowEditAvatar(1);
$l->setAllowEditTimezone(1);
$l->setAllowEditDefaultLanguage(1);
} else {
$l->setAttributesAllowedPermission('N');
$l->setAllowEditUserName(0);
$l->setAllowEditEmail(0);
$l->setAllowEditPassword(0);
$l->setAllowEditAvatar(0);
$l->setAllowEditTimezone(0);
$l->setAllowEditDefaultLanguage(0);
}
}
if ($attributePermission == 'C') {
$akIDs = $db->GetCol('select akID from UserPermissionEditPropertyAttributeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $this->getPermissionAccessID()));
$l->setAttributesAllowedArray($akIDs);
}
}
return $list;
}