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


PHP Duration::getByID方法代码示例

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


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

示例1: loadPermissionDurationObject

 public function loadPermissionDurationObject($pdID)
 {
     if ($pdID > 0) {
         $pd = Duration::getByID($pdID);
         $this->duration = $pd;
     }
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:7,代码来源:ListItem.php

示例2: die

<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Permission\Access\Entity\Entity as PermissionAccessEntity;
use Concrete\Core\Permission\Duration as PermissionDuration;
$f = File::getByID($_REQUEST['fID']);
if (is_object($f)) {
    $fp = new Permissions($f);
    if ($fp->canEditFilePermissions()) {
        if ($_REQUEST['task'] == 'add_access_entity' && Loader::helper("validation/token")->validate('add_access_entity')) {
            $pk = PermissionKey::getByID($_REQUEST['pkID']);
            $pk->setPermissionObject($f);
            $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk);
            $pe = PermissionAccessEntity::getByID($_REQUEST['peID']);
            $pd = PermissionDuration::getByID($_REQUEST['pdID']);
            $pa->addListItem($pe, $pd, $_REQUEST['accessType']);
        }
        if ($_REQUEST['task'] == 'revert_to_global_file_permissions' && Loader::helper("validation/token")->validate('revert_to_global_file_permissions')) {
            $f->resetPermissions();
        }
        if ($_REQUEST['task'] == 'override_global_file_permissions' && Loader::helper("validation/token")->validate('override_global_file_permissions')) {
            $f->resetPermissions(1);
        }
        if ($_REQUEST['task'] == 'remove_access_entity' && Loader::helper("validation/token")->validate('remove_access_entity')) {
            $pk = PermissionKey::getByID($_REQUEST['pkID']);
            $pk->setPermissionObject($f);
            $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk);
            $pe = PermissionAccessEntity::getByID($_REQUEST['peID']);
            $pa->removeListItem($pe);
        }
        if ($_REQUEST['task'] == 'save_permission' && Loader::helper("validation/token")->validate('save_permission')) {
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:31,代码来源:file.php

示例3: 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

示例4: 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

示例5: getAllAssignmentsForPage

 public function getAllAssignmentsForPage()
 {
     $db = Loader::db();
     $assignments = array();
     $r = $db->Execute('select peID, pkID, pdID from PagePermissionAssignments ppa inner join PermissionAccessList pal on ppa.paID = pal.paID where cID = ?', array($this->object->getCollectionID()));
     while ($row = $r->FetchRow()) {
         $pk = PagePermissionKey::getByID($row['pkID']);
         $pae = PermissionAccessEntity::getByID($row['peID']);
         $pd = PermissionDuration::getByID($row['pdID']);
         $ppc = new PageContentPermissionTimedAssignment();
         $ppc->setDurationObject($pd);
         $ppc->setAccessEntityObject($pae);
         $ppc->setPermissionKeyObject($pk);
         $assignments[] = $ppc;
     }
     $r = $db->Execute('select arHandle from Areas where cID = ? and arOverrideCollectionPermissions = 1', array($this->object->getCollectionID()));
     while ($row = $r->FetchRow()) {
         $r2 = $db->Execute('select peID, pdID, pkID from AreaPermissionAssignments apa inner join PermissionAccessList pal on apa.paID = pal.paID where cID = ? and arHandle = ?', array($this->object->getCollectionID(), $row['arHandle']));
         while ($row2 = $r2->FetchRow()) {
             $pk = AreaPermissionKey::getByID($row2['pkID']);
             $pae = PermissionAccessEntity::getByID($row2['peID']);
             $area = Area::get($this->getPermissionObject(), $row['arHandle']);
             $pk->setPermissionObject($area);
             $pd = PermissionDuration::getByID($row2['pdID']);
             $ppc = new PageContentPermissionTimedAssignment();
             $ppc->setDurationObject($pd);
             $ppc->setAccessEntityObject($pae);
             $ppc->setPermissionKeyObject($pk);
             $assignments[] = $ppc;
         }
     }
     $r = $db->Execute('select peID, cvb.cvID, cvb.bID, pdID, pkID from BlockPermissionAssignments bpa
                 inner join PermissionAccessList pal on bpa.paID = pal.paID inner join CollectionVersionBlocks cvb on cvb.cID = bpa.cID and cvb.cvID = bpa.cvID and cvb.bID = bpa.bID
                 where cvb.cID = ? and cvb.cvID = ? and cvb.cbOverrideAreaPermissions = 1', array($this->object->getCollectionID(), $this->object->getVersionID()));
     while ($row = $r->FetchRow()) {
         $pk = BlockPermissionKey::getByID($row['pkID']);
         $pae = PermissionAccessEntity::getByID($row['peID']);
         $arHandle = $db->GetOne('select arHandle from CollectionVersionBlocks where bID = ? and cvID = ? and cID = ?', array($row['bID'], $row['cvID'], $this->object->getCollectionID()));
         $b = Block::getByID($row['bID'], $this->object, $arHandle);
         $pk->setPermissionObject($b);
         $pd = PermissionDuration::getByID($row['pdID']);
         $ppc = new PageContentPermissionTimedAssignment();
         $ppc->setDurationObject($pd);
         $ppc->setAccessEntityObject($pae);
         $ppc->setPermissionKeyObject($pk);
         $assignments[] = $ppc;
     }
     return $assignments;
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:49,代码来源:PageResponse.php

示例6: translateFromRequest

 public static function translateFromRequest()
 {
     $dt = Loader::helper('form/date_time');
     $dateStart = $dt->translate('pdStartDate');
     $dateEnd = $dt->translate('pdEndDate');
     if ($dateStart || $dateEnd) {
         // create a Duration object
         if ($_REQUEST['pdID']) {
             $pd = Duration::getByID($_REQUEST['pdID']);
         } else {
             $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']) {
             $pd->setRepeatPeriod($_POST['pdRepeatPeriod']);
             if ($_POST['pdRepeatPeriod'] == 'daily') {
                 $pd->setRepeatEveryNum($_POST['pdRepeatPeriodDaysEvery']);
             } elseif ($_POST['pdRepeatPeriod'] == 'weekly') {
                 $pd->setRepeatEveryNum($_POST['pdRepeatPeriodWeeksEvery']);
                 $pd->setRepeatPeriodWeekDays($_POST['pdRepeatPeriodWeeksDays']);
             } elseif ($_POST['pdRepeatPeriod'] == 'monthly') {
                 $pd->setRepeatMonthBy($_POST['pdRepeatPeriodMonthsRepeatBy']);
                 $pd->setRepeatEveryNum($_POST['pdRepeatPeriodMonthsEvery']);
             }
             $pd->setRepeatPeriodEnd($dt->translate('pdEndRepeatDateSpecific'));
         } else {
             $pd->setRepeatPeriod(false);
         }
         $pd->save();
     } else {
         unset($pd);
     }
     return $pd;
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:47,代码来源:Duration.php


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