當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Duration::setEndDateAllDay方法代碼示例

本文整理匯總了PHP中Concrete\Core\Permission\Duration::setEndDateAllDay方法的典型用法代碼示例。如果您正苦於以下問題:PHP Duration::setEndDateAllDay方法的具體用法?PHP Duration::setEndDateAllDay怎麽用?PHP Duration::setEndDateAllDay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Concrete\Core\Permission\Duration的用法示例。


在下文中一共展示了Duration::setEndDateAllDay方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: testMonthlyRecurring

 public function testMonthlyRecurring()
 {
     // -- Last day of the week
     $monthly_ldotw_repetition = new Duration();
     $monthly_ldotw_repetition->setStartDate(date('Y-m-d 01:00:00', strtotime('second saturday of december 1992')));
     $monthly_ldotw_repetition->setEndDate(date('Y-m-d 03:00:00', strtotime('second saturday of december 1992')));
     $monthly_ldotw_repetition->setEndDateAllDay(false);
     $monthly_ldotw_repetition->setStartDateAllDay(false);
     $monthly_ldotw_repetition->setRepeatPeriod($monthly_ldotw_repetition::REPEAT_MONTHLY);
     $monthly_ldotw_repetition->setRepeatMonthBy($monthly_ldotw_repetition::MONTHLY_REPEAT_LAST_WEEKDAY);
     $monthly_ldotw_repetition->setRepeatMonthLastWeekday(1);
     // Monday
     $monthly_ldotw_repetition->setRepeatEveryNum(1);
     $this->assertTrue($monthly_ldotw_repetition->isActive(strtotime(date('Y-m-d 01:30:00', strtotime('last monday of march ' . self::getFarYear(2205))))));
     // -- Weekly
     $monthly_weekly_repetition = new Duration();
     $monthly_weekly_repetition->setStartDate(date('Y-m-d 01:00:00', strtotime('second saturday of december 1992')));
     $monthly_weekly_repetition->setEndDate(date('Y-m-d 03:00:00', strtotime('second saturday of december 1992')));
     $monthly_weekly_repetition->setEndDateAllDay(false);
     $monthly_weekly_repetition->setStartDateAllDay(false);
     $monthly_weekly_repetition->setRepeatPeriod($monthly_weekly_repetition::REPEAT_MONTHLY);
     $monthly_weekly_repetition->setRepeatMonthBy($monthly_weekly_repetition::MONTHLY_REPEAT_WEEKLY);
     $monthly_weekly_repetition->setRepeatEveryNum(1);
     $this->assertTrue($monthly_weekly_repetition->isActive(strtotime(date('Y-m-d 01:30:00', strtotime('second saturday of march ' . self::getFarYear(2205))))));
     // -- Monthly
     $monthly_weekly_repetition = new Duration();
     $monthly_weekly_repetition->setStartDate('1990-05-21 01:00:00');
     $monthly_weekly_repetition->setEndDate('1990-05-21 03:00:00');
     $monthly_weekly_repetition->setEndDateAllDay(false);
     $monthly_weekly_repetition->setStartDateAllDay(false);
     $monthly_weekly_repetition->setRepeatPeriod($monthly_weekly_repetition::REPEAT_MONTHLY);
     $monthly_weekly_repetition->setRepeatMonthBy($monthly_weekly_repetition::MONTHLY_REPEAT_MONTHLY);
     $monthly_weekly_repetition->setRepeatEveryNum(1);
     $this->assertTrue($monthly_weekly_repetition->isActive(strtotime(date('Y-m-21 01:50:00', time()))));
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:35,代碼來源:DurationTest.php

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

示例4: 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::setEndDateAllDay方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。