本文整理汇总了PHP中Concrete\Core\Permission\Duration类的典型用法代码示例。如果您正苦于以下问题:PHP Duration类的具体用法?PHP Duration怎么用?PHP Duration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Duration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loadPermissionDurationObject
public function loadPermissionDurationObject($pdID)
{
if ($pdID > 0) {
$pd = Duration::getByID($pdID);
$this->duration = $pd;
}
}
开发者ID:ngreimel,项目名称:kovent,代码行数:7,代码来源:ListItem.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:FileKey.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:26,代码来源:AddSubpagePageAccess.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:27,代码来源:AddConversationMessageConversationKey.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:31,代码来源:EditPageThemePageKey.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:WorkflowKey.php
示例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;
}
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:30,代码来源:ViewUserAttributesUserKey.php
示例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;
}
开发者ID:ngreimel,项目名称:kovent,代码行数:25,代码来源:EditPageThemePageAccess.php
示例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;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:29,代码来源:AddFileFileSetKey.php
示例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;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:26,代码来源:NotifyInNotificationCenterNotificationAccess.php
示例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);
}
}
}
}
开发者ID:TimDix,项目名称:publish-date-master,代码行数:25,代码来源:controller.php
示例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;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:49,代码来源:AddBlockToAreaAreaKey.php
示例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;
}
开发者ID:robertdamoc,项目名称:concrete5,代码行数:16,代码来源:Access.php
示例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;
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:23,代码来源:EditPageThemePageAccess.php
示例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;
}
开发者ID:ngreimel,项目名称:kovent,代码行数:43,代码来源:EditUserPropertiesUserAccess.php
示例16: setupPermissions
/**
* Sets up a list to only return items the proper user can access
*/
public function setupPermissions()
{
$u = new User();
if ($u->isSuperUser() || $this->ignorePermissions) {
return;
// super user always sees everything. no need to limit
}
$accessEntities = $u->getUserAccessEntityObjects();
$peIDs = array('-1');
foreach ($accessEntities as $pae) {
$peIDs[] = $pae->getAccessEntityID();
}
$owpae = PageOwnerPermissionAccessEntity::getOrCreate();
// now we retrieve a list of permission duration object IDs that are attached view_page or view_page_version
// against any of these access entity objects. We just get'em all.
$db = Loader::db();
$activePDIDs = array();
$vpPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = ?', array($this->viewPagePermissionKeyHandle));
/*
$vpvPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_page_versions\'');
$pdIDs = $db->GetCol("select distinct pdID from PagePermissionAssignments ppa inner join PermissionAccessList pa on ppa.paID = pa.paID where pkID in (?, ?) and pdID > 0", array($vpPKID, $vpvPKID));
*/
$pdIDs = $db->GetCol("select distinct pdID from PagePermissionAssignments ppa inner join PermissionAccessList pa on ppa.paID = pa.paID where pkID =? and pdID > 0", array($vpPKID));
if (count($pdIDs) > 0) {
// then we iterate through all of them and find any that are active RIGHT NOW
foreach ($pdIDs as $pdID) {
$pd = PermissionDuration::getByID($pdID);
if ($pd->isActive()) {
$activePDIDs[] = $pd->getPermissionDurationID();
}
}
}
$activePDIDs[] = 0;
if ($this->includeAliases) {
$cInheritPermissionsFromCID = 'if(p2.cID is null, p1.cInheritPermissionsFromCID, p2.cInheritPermissionsFromCID)';
} else {
$cInheritPermissionsFromCID = 'p1.cInheritPermissionsFromCID';
}
if ($this->displayOnlyApprovedPages) {
$cvIsApproved = ' and cv.cvIsApproved = 1';
}
$uID = 0;
if ($u->isRegistered()) {
$uID = $u->getUserID();
}
/*
$this->filter(false, "((select count(cID) from PagePermissionAssignments ppa1 inner join PermissionAccessList pa1 on ppa1.paID = pa1.paID where ppa1.cID = {$cInheritPermissionsFromCID} and pa1.accessType = " . PermissionKey::ACCESS_TYPE_INCLUDE . " and pa1.pdID in (" . implode(',', $activePDIDs) . ")
and pa1.peID in (" . implode(',', $peIDs) . ") and (if(pa1.peID = " . $owpae->getAccessEntityID() . " and p1.uID <>" . $uID . ", false, true)) and (ppa1.pkID = " . $vpPKID . $cvIsApproved . " or ppa1.pkID = " . $vpvPKID . ")) > 0
or (p1.cPointerExternalLink !='' AND p1.cPointerExternalLink IS NOT NULL))");
$this->filter(false, "((select count(cID) from PagePermissionAssignments ppaExclude inner join PermissionAccessList paExclude on ppaExclude.paID = paExclude.paID where ppaExclude.cID = {$cInheritPermissionsFromCID} and accessType = " . PermissionKey::ACCESS_TYPE_EXCLUDE . " and pdID in (" . implode(',', $activePDIDs) . ")
and paExclude.peID in (" . implode(',', $peIDs) . ") and (if(paExclude.peID = " . $owpae->getAccessEntityID() . " and p1.uID <>" . $uID . ", false, true)) and (ppaExclude.pkID = " . $vpPKID . $cvIsApproved . " or ppaExclude.pkID = " . $vpvPKID . ")) = 0)");
*/
$this->filter(false, "((select count(cID) from PagePermissionAssignments ppa1 inner join PermissionAccessList pa1 on ppa1.paID = pa1.paID where ppa1.cID = {$cInheritPermissionsFromCID} and pa1.accessType = " . PermissionKey::ACCESS_TYPE_INCLUDE . " and pa1.pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand pa1.peID in (" . implode(',', $peIDs) . ") and (if(pa1.peID = " . $owpae->getAccessEntityID() . " and p1.uID <>" . $uID . ", false, true)) and (ppa1.pkID = " . $vpPKID . $cvIsApproved . ")) > 0\n\t\t\tor (p1.cPointerExternalLink !='' AND p1.cPointerExternalLink IS NOT NULL))");
$this->filter(false, "((select count(cID) from PagePermissionAssignments ppaExclude inner join PermissionAccessList paExclude on ppaExclude.paID = paExclude.paID where ppaExclude.cID = {$cInheritPermissionsFromCID} and accessType = " . PermissionKey::ACCESS_TYPE_EXCLUDE . " and pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand paExclude.peID in (" . implode(',', $peIDs) . ") and (if(paExclude.peID = " . $owpae->getAccessEntityID() . " and p1.uID <>" . $uID . ", false, true)) and (ppaExclude.pkID = " . $vpPKID . $cvIsApproved . ")) = 0)");
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:58,代码来源:PageList.php
示例17: updatePermissionDurationObjects
protected function updatePermissionDurationObjects()
{
$db = \Database::get();
$r = $db->Execute('select pdID from PermissionDurationObjects order by pdID asc');
while ($row = $r->FetchRow()) {
$pd = Duration::getByID($row['pdID']);
if (isset($pd->error)) {
// this is a legacy object. It was serialized from 5.7.3.1 and earlier and used to extend Object.
// so we take the old pd* parameters and use them as the basis for the standard parameters.
$pd->setStartDate($pd->pdStartDate);
$pd->setEndDate($pd->pdEndDate);
$pd->setStartDateAllDay((bool) $pd->pdStartDateAllDay);
$pd->setEndDateAllDay((bool) $pd->pdEndDateAllDay);
if ($pd->pdRepeatPeriod == 'daily') {
$pd->setRepeatPeriod(Duration::REPEAT_DAILY);
} elseif ($pd->pdRepeatPeriod == 'weekly') {
$pd->setRepeatPeriod(Duration::REPEAT_WEEKLY);
} elseif ($pd->pdRepeatPeriod == 'monthly') {
$pd->setRepeatPeriod(Duration::REPEAT_MONTHLY);
} else {
$pd->setRepeatPeriod(Duration::REPEAT_NONE);
}
if ($pd->pdRepeatEveryNum) {
$pd->setRepeatEveryNum($pd->pdRepeatEveryNum);
}
if ($pd->pdRepeatPeriodWeeksDays) {
$pd->setRepeatPeriodWeekDays($pd->pdRepeatPeriodWeeksDays);
}
if ($pd->pdRepeatPeriodMonthsRepeatBy == 'week') {
$pd->setRepeatMonthBy(Duration::MONTHLY_REPEAT_WEEKLY);
} elseif ($pd->pdRepeatPeriodMonthsRepeatBy == 'month') {
$pd->setRepeatMonthBy(Duration::MONTHLY_REPEAT_MONTHLY);
}
if ($pd->pdRepeatPeriodEnd) {
$pd->setRepeatPeriodEnd($pd->pdRepeatPeriodEnd);
}
unset($pd->pdStartDate);
unset($pd->pdEndDate);
unset($pd->pdStartDateAllDay);
unset($pd->pdEndDateAllDay);
unset($pd->pdRepeatPeriod);
unset($pd->pdRepeatEveryNum);
unset($pd->pdRepeatPeriodWeeksDays);
unset($pd->pdRepeatPeriodMonthsRepeatBy);
unset($pd->pdRepeatPeriodEnd);
unset($pd->error);
$pd->save();
}
}
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:50,代码来源:Version20150504000000.php
示例18: createFromRequest
/**
* @return Duration|null
*/
public static function createFromRequest()
{
$dt = Loader::helper('form/date_time');
$dateStart = $dt->translate('pdStartDate');
$dateEnd = $dt->translate('pdEndDate');
if ($dateStart || $dateEnd) {
// create a Duration object
$pd = new Duration();
if ($_REQUEST['pdStartDateAllDayActivate']) {
$pd->setStartDateAllDay(1);
$dateStart = date('Y-m-d 00:00:00', strtotime($dateStart));
} else {
$pd->setStartDateAllDay(0);
}
if ($_REQUEST['pdEndDateAllDayActivate']) {
$pd->setEndDateAllDay(1);
$dateEnd = date('Y-m-d 23:59:59', strtotime($dateEnd));
} else {
$pd->setEndDateAllDay(0);
}
$pd->setStartDate($dateStart);
$pd->setEndDate($dateEnd);
if ($_POST['pdRepeatPeriod'] && $_POST['pdRepeat']) {
if ($_POST['pdRepeatPeriod'] == 'daily') {
$pd->setRepeatPeriod(Duration::REPEAT_DAILY);
$pd->setRepeatEveryNum($_POST['pdRepeatPeriodDaysEvery']);
} elseif ($_POST['pdRepeatPeriod'] == 'weekly') {
$pd->setRepeatPeriod(Duration::REPEAT_WEEKLY);
$pd->setRepeatEveryNum($_POST['pdRepeatPeriodWeeksEvery']);
$pd->setRepeatPeriodWeekDays($_POST['pdRepeatPeriodWeeksDays']);
} elseif ($_POST['pdRepeatPeriod'] == 'monthly') {
$pd->setRepeatPeriod(Duration::REPEAT_MONTHLY);
$repeat_by = $_POST['pdRepeatPeriodMonthsRepeatBy'];
$repeat = self::MONTHLY_REPEAT_WEEKLY;
switch ($repeat_by) {
case 'week':
$repeat = self::MONTHLY_REPEAT_WEEKLY;
break;
case 'month':
$repeat = self::MONTHLY_REPEAT_MONTHLY;
break;
case 'lastweekday':
$repeat = self::MONTHLY_REPEAT_LAST_WEEKDAY;
$dotw = $_POST['pdRepeatPeriodMonthsRepeatLastDay'] ?: 0;
$pd->setRepeatMonthLastWeekday($dotw);
break;
}
$pd->setRepeatMonthBy($repeat);
$pd->setRepeatEveryNum($_POST['pdRepeatPeriodMonthsEvery']);
}
$pd->setRepeatPeriodEnd($dt->translate('pdEndRepeatDateSpecific'));
} else {
$pd->setRepeatPeriod(Duration::REPEAT_NONE);
}
$pd->save();
return $pd;
} else {
unset($pd);
}
return null;
}
开发者ID:ngreimel,项目名称:kovent,代码行数:64,代码来源:Duration.php
示例19: 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->GetRow('select attributePermission, name, publicDateTime, uID, description, paths from PagePermissionPropertyAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
$attributePermission = '';
if (!empty($prow) && $prow['attributePermission']) {
$l->setAttributesAllowedPermission($prow['attributePermission']);
$l->setAllowEditName($prow['name']);
$l->setAllowEditDateTime($prow['publicDateTime']);
$l->setAllowEditUserID($prow['uID']);
$l->setAllowEditDescription($prow['description']);
$l->setAllowEditPaths($prow['paths']);
$attributePermission = $prow['attributePermission'];
} elseif ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
$l->setAttributesAllowedPermission('A');
$l->setAllowEditName(1);
$l->setAllowEditDateTime(1);
$l->setAllowEditUserID(1);
$l->setAllowEditDescription(1);
$l->setAllowEditPaths(1);
} else {
$l->setAttributesAllowedPermission('N');
$l->setAllowEditName(0);
$l->setAllowEditDateTime(0);
$l->setAllowEditUserID(0);
$l->setAllowEditDescription(0);
$l->setAllowEditPaths(0);
}
if ($attributePermission == 'C') {
$akIDs = $db->GetCol('select akID from PagePermissionPropertyAttributeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
$l->setAttributesAllowedArray($akIDs);
}
}
return $list;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:39,代码来源:EditPagePropertiesPageAccess.php
示例20: stdClass
}
if (!is_object($pae)) {
$pae = false;
}
$pd = false;
if ($_REQUEST['pdID']) {
$pd = PermissionDuration::getByID($_REQUEST['pdID']);
}
if (!is_object($pd)) {
$pd = false;
}
if ($_POST['task'] == 'save_permissions') {
$js = Loader::helper('json');
$r = new stdClass();
if (is_object($pae)) {
$pd = PermissionDuration::translateFromRequest();
} else {
$r->error = true;
$r->message = t('You must choose who this permission is for.');
}
if (!$r->error) {
$r->peID = $pae->getAccessEntityID();
if (is_object($pd)) {
$r->pdID = $pd->getPermissionDurationID();
} else {
$r->pdID = 0;
}
}
print $js->encode($r);
exit;
}
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:access_entity.php
注:本文中的Concrete\Core\Permission\Duration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论