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


PHP ilDateTime::_within方法代码示例

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


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

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

示例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);
     // 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


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