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


PHP ilDateTime::_after方法代码示例

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


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

示例1: fillRow

 /**
  * Fill row
  * @param type $a_set
  */
 public function fillRow($row)
 {
     global $ilCtrl;
     $this->tpl->setVariable('START', $row['start_str']);
     $this->tpl->setVariable('NAME', $row['name']);
     $this->tpl->setVariable('COMMENT', $row['comment']);
     $this->tpl->setVariable('TITLE', $row['title']);
     $this->tpl->setVariable('VAL_ID', $row['id']);
     include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
     $list = new ilAdvancedSelectionListGUI();
     $list->setId('act_chboo_' . $row['id']);
     $list->setListTitle($this->lng->txt('actions'));
     $ilCtrl->setParameter($this->getParentObject(), 'bookuser', $row['id']);
     $start = new ilDateTime($row['start'], IL_CAL_UNIX);
     if (ilDateTime::_after($start, $this->today, IL_CAL_DAY)) {
         $list->addItem($this->lng->txt('cal_ch_reject_booking'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmRejectBooking'));
     }
     $list->addItem($this->lng->txt('cal_ch_delete_booking'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteBooking'));
     $this->tpl->setVariable('ACTIONS', $list->getHTML());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:24,代码来源:class.ilConsultationHourBookingTableGUI.php

示例2: getSubItems

 /**
  * Get subitems of container
  * @param bool $a_admin_panel_enabled[optional]
  * @param bool $a_include_side_block[optional]
  * @return array 
  */
 public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false)
 {
     global $ilUser;
     // Caching
     if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block])) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     // Results are stored in $this->items
     parent::getSubItems($a_admin_panel_enabled, $a_include_side_block);
     $limit_sess = false;
     if (!$a_admin_panel_enabled && !$a_include_side_block && $this->items['sess'] && is_array($this->items['sess']) && $this->isSessionLimitEnabled() && $this->getViewMode() == ilContainer::VIEW_SESSIONS) {
         $limit_sess = true;
     }
     if (!$limit_sess) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     // do session limit
     // @todo move to gui class
     if (isset($_GET['crs_prev_sess'])) {
         $ilUser->writePref('crs_sess_show_prev_' . $this->getId(), (string) (int) $_GET['crs_prev_sess']);
     }
     if (isset($_GET['crs_next_sess'])) {
         $ilUser->writePref('crs_sess_show_next_' . $this->getId(), (string) (int) $_GET['crs_next_sess']);
     }
     $sessions = ilUtil::sortArray($this->items['sess'], 'start', 'ASC', true, false);
     $today = new ilDate(date('Ymd', time()), IL_CAL_DATE);
     $previous = $current = $next = array();
     foreach ($sessions as $key => $item) {
         $start = new ilDateTime($item['start'], IL_CAL_UNIX);
         $end = new ilDateTime($item['end'], IL_CAL_UNIX);
         if (ilDateTime::_within($today, $start, $end, IL_CAL_DAY)) {
             $current[] = $item;
         } elseif (ilDateTime::_before($start, $today, IL_CAL_DAY)) {
             $previous[] = $item;
         } elseif (ilDateTime::_after($start, $today, IL_CAL_DAY)) {
             $next[] = $item;
         }
     }
     $num_previous_remove = max(count($previous) - $this->getNumberOfPreviousSessions(), 0);
     while ($num_previous_remove--) {
         if (!$ilUser->getPref('crs_sess_show_prev_' . $this->getId())) {
             array_shift($previous);
         }
         $this->items['sess_link']['prev']['value'] = 1;
     }
     $num_next_remove = max(count($next) - $this->getNumberOfNextSessions(), 0);
     while ($num_next_remove--) {
         if (!$ilUser->getPref('crs_sess_show_next_' . $this->getId())) {
             array_pop($next);
         }
         // @fixme
         $this->items['sess_link']['next']['value'] = 1;
     }
     $sessions = array_merge($previous, $current, $next);
     $this->items['sess'] = $sessions;
     // #15389 - see ilContainer::getSubItems()
     include_once 'Services/Container/classes/class.ilContainerSorting.php';
     $sort = ilContainerSorting::_getInstance($this->getId());
     $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
     return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:67,代码来源:class.ilObjCourse.php

示例3: _within

 /**
  * Check whether an date is within a date duration given by start and end
  * @param ilDateTime $dt
  * @param ilDateTime $start
  * @param ilDateTime $end
  * @param type $a_compare_field
  * @param type $a_tz
  */
 public static function _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field = '', $a_tz = '')
 {
     return (ilDateTime::_after($dt, $start, $a_compare_field, $a_tz) or ilDateTime::_equals($dt, $start, $a_compare_field, $a_tz)) && (ilDateTime::_before($dt, $end, $a_compare_field, $a_tz) or ilDateTime::_equals($dt, $end, $a_compare_field, $a_tz));
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:12,代码来源:class.ilDateTime.php

示例4: getOpenRoomBooking

 public static function getOpenRoomBooking($a_group_id)
 {
     $now = new ilDateTime(time(), IL_CAL_UNIX);
     $earlier = clone $now;
     $later = clone $now;
     $later->increment(IL_CAL_DAY, 5);
     $booking = self::lookupNextBooking($earlier, $later, $a_group_id);
     if (!$booking['open'] instanceof ilDateTime) {
         return 0;
     }
     if (ilDateTime::_before($booking['open'], $now) and ilDateTime::_after($booking['closed'], $now)) {
         return $booking['id'];
     }
     return 0;
 }
开发者ID:leifos-gmbh,项目名称:Vitero,代码行数:15,代码来源:class.ilViteroUtils.php

示例5: getActive

 /**
  * get activation
  *
  * @return	boolean		true/false for active or not
  */
 function getActive($a_check_scheduled_activation = false)
 {
     if ($a_check_scheduled_activation && !$this->active) {
         include_once "./Services/Calendar/classes/class.ilDateTime.php";
         $start = new ilDateTime($this->getActivationStart(), IL_CAL_DATETIME);
         $end = new ilDateTime($this->getActivationEnd(), IL_CAL_DATETIME);
         $now = new ilDateTime(time(), IL_CAL_UNIX);
         if (!ilDateTime::_before($now, $start) && !ilDateTime::_after($now, $end)) {
             return true;
         }
     }
     return $this->active;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:18,代码来源:class.ilPageObject.php

示例6: matchesValue

 /**
  * Check if value matches
  * @param	mixed	$a_value	Econtent value
  * @param	int		$a_type		Parameter type
  * @return
  */
 protected function matchesValue($a_value, $a_type)
 {
     global $ilLog;
     switch ($a_type) {
         case self::ATTR_ARRAY:
             $values = explode(',', $a_value);
             $ilLog->write(__METHOD__ . ': Checking for value: ' . $a_value);
             $ilLog->write(__METHOD__ . ': Checking against attribute values: ' . $this->getMappingValue());
             break;
         case self::ATTR_INT:
             $ilLog->write(__METHOD__ . ': Checking for value: ' . $a_value);
             $ilLog->write(__METHOD__ . ': Checking against attribute values: ' . $this->getMappingValue());
             $values = array($a_value);
             break;
         case self::ATTR_STRING:
             $values = array($a_value);
             break;
     }
     $values = explode(',', $a_value);
     foreach ($values as $value) {
         $value = trim($value);
         switch ($this->getMappingType()) {
             case self::TYPE_FIXED:
                 foreach ($this->getMappingAsArray() as $attribute_value) {
                     $attribute_value = trim($attribute_value);
                     if (strcasecmp($attribute_value, $value) == 0) {
                         return true;
                     }
                 }
                 break;
             case self::TYPE_DURATION:
                 include_once './Services/Calendar/classes/class.ilDateTime.php';
                 $tmp_date = new ilDate($a_value, IL_CAL_UNIX);
                 return ilDateTime::_after($tmp_date, $this->getDateRangeStart()) and ilDateTime::_before($tmp_date, $this->getDateRangeEnd());
         }
     }
     return false;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:44,代码来源:class.ilECSCategoryMappingRule.php

示例7: getHTML


//.........这里部分代码省略.........
                     if (count($registrations)) {
                         $this->tpl->setCurrentBlock('panel_current_booking');
                         $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_reg_registered_users'));
                         $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations));
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
             break;
         case ilCalendarCategory::TYPE_CH:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch'));
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             $entry = new ilBookingEntry($a_app['event']->getContextId());
             $is_owner = $entry->isOwner();
             $user_entry = $cat_info['obj_id'] == $ilUser->getId();
             if ($user_entry && !$is_owner) {
                 // find source calendar entry in owner calendar
                 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
                 $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart());
                 $ref_event = $apps[0];
             } else {
                 $ref_event = $a_app['event']->getEntryId();
             }
             $this->tpl->setCurrentBlock('panel_booking_owner');
             $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner'));
             $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId()));
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock('panel_max_booking');
             $this->tpl->setVariable('PANEL_TXT_MAX_BOOKING', $this->lng->txt('cal_ch_num_bookings'));
             $this->tpl->setVariable('PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
             $this->tpl->parseCurrentBlock();
             if (!$is_owner) {
                 if ($entry->hasBooked($ref_event)) {
                     if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
                         $this->tpl->parseCurrentBlock();
                     }
                 } elseif ($entry->isAppointmentBookableForUser($ref_event, $GLOBALS['ilUser']->getId())) {
                     $this->tpl->setCurrentBlock('panel_book_link');
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                     $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book'));
                     $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $obj_ids = $entry->getTargetObjIds();
                 foreach ($obj_ids as $obj_id) {
                     $title = ilObject::_lookupTitle($obj_id);
                     $refs = ilObject::_getAllReferences($obj_id);
                     include_once './Services/Link/classes/class.ilLink.php';
                     $this->tpl->setCurrentBlock('panel_booking_target_row');
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE', $title);
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET', ilLink::_getLink(end($refs)));
                     $this->tpl->parseCurrentBlock();
                 }
                 if ($obj_ids) {
                     $this->tpl->setCurrentBlock('panel_booking_target');
开发者ID:arlendotcn,项目名称:ilias,代码行数:67,代码来源:class.ilCalendarAppointmentPanelGUI.php

示例8: _registrationEnabled

 /**
  * 
  * @return 
  * @param object $a_obj_id
  */
 public static function _registrationEnabled($a_obj_id)
 {
     global $ilDB;
     $query = "SELECT * FROM grp_settings " . "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
     $res = $ilDB->query($query);
     $enabled = $unlimited = false;
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $enabled = $row->registration_enabled;
         $unlimited = $row->registration_unlimited;
         $start = $row->registration_start;
         $end = $row->registration_end;
     }
     if (!$enabled) {
         return false;
     }
     if ($unlimited) {
         return true;
     }
     if (!$unlimited) {
         $start = new ilDateTime($start, IL_CAL_DATETIME, 'UTC');
         $end = new ilDateTime($end, IL_CAL_DATETIME, 'UTC');
         $time = new ilDateTime(time(), IL_CAL_UNIX);
         return ilDateTime::_after($time, $start) and ilDateTime::_before($time, $end);
     }
     return false;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:31,代码来源:class.ilObjGroupAccess.php

示例9: applyLimits

 /**
  * Apply limits (count or until)
  *
  * @access protected
  * @param object ilDateList
  * 
  */
 protected function applyLimits(ilDateList $list)
 {
     $list->sort();
     #echo "list: ";
     #echo $list;
     #echo '<br />';
     // Check valid dates before starting time
     foreach ($list->get() as $check_date) {
         if (ilDateTime::_before($check_date, $this->event->getStart(), IL_CAL_DAY)) {
             #echo 'Removed: '.$check_date.'<br/>';
             $list->remove($check_date);
         }
     }
     #echo 'Until date '.$this->recurrence->getFrequenceUntilDate();
     // Check count if given
     if ($this->recurrence->getFrequenceUntilCount()) {
         foreach ($list->get() as $res) {
             // check smaller than since the start time counts as one
             if (count($this->valid_dates->get()) < $this->recurrence->getFrequenceUntilCount()) {
                 $this->valid_dates->add($res);
             } else {
                 $this->limit_reached = true;
                 return false;
             }
         }
         return true;
     } elseif ($this->recurrence->getFrequenceUntilDate()) {
         #echo 'Until date '.$this->recurrence->getFrequenceUntilDate();
         $date = $this->recurrence->getFrequenceUntilDate();
         foreach ($list->get() as $res) {
             #echo 'Check date '.$res;
             if (ilDateTime::_after($res, $date, IL_CAL_DAY)) {
                 #echo 'Limit reached';
                 $this->limit_reached = true;
                 return false;
             }
             $this->valid_dates->add($res);
         }
         return true;
     }
     $this->valid_dates->merge($list);
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:50,代码来源:class.ilCalendarRecurrenceCalculator.php

示例10: getSubItems

 /**
  * Get subitems of container
  * @param bool $a_admin_panel_enabled[optional]
  * @param bool $a_include_side_block[optional]
  * @return array 
  */
 public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false)
 {
     global $ilUser;
     // Caching
     if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block])) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     // Results are stored in $this->items
     parent::getSubItems($a_admin_panel_enabled, $a_include_side_block);
     // No sessions
     if (!is_array($this->items['sess']) or !$this->items['sess']) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     // No session limit
     if (!$this->isSessionLimitEnabled() or $a_admin_panel_enabled) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     if ($a_include_side_block) {
         return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
     }
     // @todo move to gui class
     if (isset($_GET['crs_prev_sess'])) {
         $ilUser->writePref('crs_sess_show_prev_' . $this->getId(), (string) (int) $_GET['crs_prev_sess']);
     }
     if (isset($_GET['crs_next_sess'])) {
         $ilUser->writePref('crs_sess_show_next_' . $this->getId(), (string) (int) $_GET['crs_next_sess']);
     }
     $sessions = ilUtil::sortArray($this->items['sess'], 'start', 'ASC', true, false);
     $today = new ilDate(date('Ymd', time()), IL_CAL_DATE);
     $previous = $current = $next = array();
     foreach ($sessions as $key => $item) {
         $start = new ilDateTime($item['start'], IL_CAL_UNIX);
         $end = new ilDateTime($item['end'], IL_CAL_UNIX);
         if (ilDateTime::_within($today, $start, $end, IL_CAL_DAY)) {
             $current[] = $item;
         } elseif (ilDateTime::_before($start, $today, IL_CAL_DAY)) {
             $previous[] = $item;
         } elseif (ilDateTime::_after($start, $today, IL_CAL_DAY)) {
             $next[] = $item;
         }
     }
     $num_previous_remove = max(count($previous) - $this->getNumberOfPreviousSessions(), 0);
     while ($num_previous_remove--) {
         if (!$ilUser->getPref('crs_sess_show_prev_' . $this->getId())) {
             array_shift($previous);
         }
         $this->items['sess_link']['prev']['value'] = 1;
     }
     $num_next_remove = max(count($next) - $this->getNumberOfNextSessions(), 0);
     while ($num_next_remove--) {
         if (!$ilUser->getPref('crs_sess_show_next_' . $this->getId())) {
             array_pop($next);
         }
         // @fixme
         $this->items['sess_link']['next']['value'] = 1;
     }
     $sessions = array_merge($previous, $current, $next);
     $this->items['sess'] = $sessions;
     $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $this->items;
     return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:67,代码来源:class.ilObjCourse.php

示例11: fillRegistrationPeriod

 /**
  * show informations about the registration period
  *
  * @access protected
  */
 protected function fillRegistrationPeriod()
 {
     include_once './Services/Calendar/classes/class.ilDateTime.php';
     $now = new ilDateTime(time(), IL_CAL_UNIX, 'UTC');
     if ($this->container->getSubscriptionUnlimitedStatus()) {
         $reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_period'));
         $reg->setValue($this->lng->txt('mem_unlimited'));
         $this->form->addItem($reg);
         return true;
     } elseif ($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED) {
         return true;
     }
     $start = new ilDateTime($this->container->getSubscriptionStart(), IL_CAL_UNIX, 'UTC');
     $end = new ilDateTime($this->container->getSubscriptionEnd(), IL_CAL_UNIX, 'UTC');
     if (ilDateTime::_before($now, $start)) {
         $tpl = new ilTemplate('tpl.registration_period_form.html', true, true, 'Services/Membership');
         $tpl->setVariable('TXT_FIRST', $this->lng->txt('mem_start'));
         $tpl->setVariable('FIRST', ilDatePresentation::formatDate($start));
         $tpl->setVariable('TXT_END', $this->lng->txt('mem_end'));
         $tpl->setVariable('END', ilDatePresentation::formatDate($end));
         $warning = $this->lng->txt('mem_reg_not_started');
     } elseif (ilDateTime::_after($now, $end)) {
         $tpl = new ilTemplate('tpl.registration_period_form.html', true, true, 'Services/Membership');
         $tpl->setVariable('TXT_FIRST', $this->lng->txt('mem_start'));
         $tpl->setVariable('FIRST', ilDatePresentation::formatDate($start));
         $tpl->setVariable('TXT_END', $this->lng->txt('mem_end'));
         $tpl->setVariable('END', ilDatePresentation::formatDate($end));
         $warning = $this->lng->txt('mem_reg_expired');
     } else {
         $tpl = new ilTemplate('tpl.registration_period_form.html', true, true, 'Services/Membership');
         $tpl->setVariable('TXT_FIRST', $this->lng->txt('mem_end'));
         $tpl->setVariable('FIRST', ilDatePresentation::formatDate($end));
     }
     $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_period'));
     $reg->setHtml($tpl->get());
     if (strlen($warning)) {
         // Disable registration
         $this->enableRegistration(false);
         ilUtil::sendFailure($warning);
         #$reg->setAlert($warning);
     }
     $this->form->addItem($reg);
     return true;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:49,代码来源:class.ilCourseRegistrationGUI.php

示例12: register

 /**
  * @see ilMembershipRegistrationCodes::register()
  * @param int user_id
  * @param int role
  * @param bool force registration and do not check registration constraints.
  */
 public function register($a_user_id, $a_role = IL_GRP_MEMBER, $a_force_registration = false)
 {
     include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php';
     include_once "./Modules/Group/classes/class.ilGroupParticipants.php";
     $part = ilGroupParticipants::_getInstanceByObjId($this->getId());
     if ($part->isAssigned($a_user_id)) {
         return true;
     }
     if (!$a_force_registration) {
         // Availability
         if (!$this->isRegistrationEnabled()) {
             include_once './Modules/Group/classes/class.ilObjGroupAccess.php';
             if (!ilObjGroupAccess::_usingRegistrationCode()) {
                 throw new ilMembershipRegistrationException('Cant registrate to group ' . $this->getId() . ', group subscription is deactivated.', '456');
             }
         }
         // Time Limitation
         if (!$this->isRegistrationUnlimited()) {
             $start = $this->getRegistrationStart();
             $end = $this->getRegistrationEnd();
             $time = new ilDateTime(time(), IL_CAL_UNIX);
             if (!(ilDateTime::_after($time, $start) and ilDateTime::_before($time, $end))) {
                 throw new ilMembershipRegistrationException('Cant registrate to group ' . $this->getId() . ', group is out of registration time.', '789');
             }
         }
         // Max members
         if ($this->isMembershipLimited()) {
             $free = max(0, $this->getMaxMembers() - $part->getCountMembers());
             include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
             $waiting_list = new ilGroupWaitingList($this->getId());
             if ($this->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers())) {
                 $this->lng->loadLanguageModule("grp");
                 $waiting_list->addToList($a_user_id);
                 $info = sprintf($this->lng->txt('grp_added_to_list'), $this->getTitle(), $waiting_list->getPosition($a_user_id));
                 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
                 include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
                 $participants = ilGroupParticipants::_getInstanceByObjId($this->getId());
                 $participants->sendNotification(ilGroupMembershipMailNotification::TYPE_WAITING_LIST_MEMBER, $a_user_id);
                 throw new ilMembershipRegistrationException($info, '124');
             }
             if (!$free or $waiting_list->getCountUsers()) {
                 throw new ilMembershipRegistrationException('Cant registrate to group ' . $this->getId() . ', membership is limited.', '123');
             }
         }
     }
     $part->add($a_user_id, $a_role);
     $part->sendNotification($part->TYPE_NOTIFICATION_REGISTRATION, $a_user_id);
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:55,代码来源:class.ilObjGroup.php

示例13: isAppointmentBookableForUser

 /**
  * Check if a calendar appointment is bookable for a specific user
  * @param type $a_cal_entry_id
  * @param type $a_user_id
  * @return bool
  */
 public function isAppointmentBookableForUser($a_app_id, $a_user_id)
 {
     // #12025
     if ($a_user_id == ANONYMOUS_USER_ID) {
         return false;
     }
     // Check max bookings
     if ($this->getNumberOfBookings() <= $this->getCurrentNumberOfBookings($a_app_id)) {
         #$GLOBALS['ilLog']->write(__METHOD__.': Number of bookings exceeded');
         return false;
     }
     // Check deadline
     $dead_limit = new ilDateTime(time(), IL_CAL_UNIX);
     $dead_limit->increment(IL_CAL_HOUR, $this->getDeadlineHours());
     include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
     $entry = new ilCalendarEntry($a_app_id);
     if (ilDateTime::_after($dead_limit, $entry->getStart())) {
         #$GLOBALS['ilLog']->write(__METHOD__.': Deadline reached');
         return false;
     }
     // Check group restrictions
     if (!$this->getBookingGroup()) {
         #$GLOBALS['ilLog']->write(__METHOD__.': No booking group');
         return true;
     }
     include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
     $group_apps = ilConsultationHourAppointments::getAppointmentIdsByGroup($this->getObjId(), $this->getBookingGroup());
     // Number of bookings in group
     $bookings = self::lookupBookingsOfUser($group_apps, $a_user_id);
     include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
     #$GLOBALS['ilLog']->write(__METHOD__.': '.ilConsultationHourGroups::lookupMaxBookings($this->getBookingGroup()));
     if (count($bookings) >= ilConsultationHourGroups::lookupMaxBookings($this->getBookingGroup())) {
         #$GLOBALS['ilLog']->write(__METHOD__.': Personal booking limit reached');
         return false;
     }
     #$GLOBALS['ilLog']->write(__METHOD__.': Is bookable!');
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:class.ilBookingEntry.php


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