本文整理汇总了PHP中ilDateTime::_before方法的典型用法代码示例。如果您正苦于以下问题:PHP ilDateTime::_before方法的具体用法?PHP ilDateTime::_before怎么用?PHP ilDateTime::_before使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilDateTime
的用法示例。
在下文中一共展示了ilDateTime::_before方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillRow
/**
* Fill row
* @staticvar int $counter
* @param array $set
*/
public function fillRow($set)
{
global $ilCtrl;
$ilCtrl->setParameter($this->getParentObject(), 'server_id', $set['server_id']);
$ilCtrl->setParameterByClass('ilecsmappingsettingsgui', 'server_id', $set['server_id']);
if ($set['active']) {
$this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_ok.svg'));
$this->tpl->setVariable('TXT_OK', $this->lng->txt('ecs_activated'));
} else {
$this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_not_ok.svg'));
$this->tpl->setVariable('TXT_OK', $this->lng->txt('ecs_inactivated'));
}
$this->tpl->setVariable('VAL_TITLE', ilECSSetting::getInstanceByServerId($set['server_id'])->getTitle());
$this->tpl->setVariable('LINK_EDIT', $ilCtrl->getLinkTarget($this->getParentObject(), 'edit'));
$this->tpl->setVariable('TXT_SRV_ADDR', $this->lng->txt('ecs_server_addr'));
if (ilECSSetting::getInstanceByServerId($set['server_id'])->getServer()) {
$this->tpl->setVariable('VAL_DESC', ilECSSetting::getInstanceByServerId($set['server_id'])->getServer());
} else {
$this->tpl->setVariable('VAL_DESC', $this->lng->txt('ecs_not_configured'));
}
$dt = ilECSSetting::getInstanceByServerId($set['server_id'])->fetchCertificateExpiration();
if ($dt != NULL) {
$this->tpl->setVariable('TXT_CERT_VALID', $this->lng->txt('ecs_cert_valid_until'));
$now = new ilDateTime(time(), IL_CAL_UNIX);
$now->increment(IL_CAL_MONTH, 2);
if (ilDateTime::_before($dt, $now)) {
$this->tpl->setCurrentBlock('invalid');
$this->tpl->setVariable('VAL_ICERT', ilDatePresentation::formatDate($dt));
$this->tpl->parseCurrentBlock();
} else {
$this->tpl->setCurrentBlock('valid');
$this->tpl->setVariable('VAL_VCERT', ilDatePresentation::formatDate($dt));
$this->tpl->parseCurrentBlock();
}
}
// Actions
include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
$list = new ilAdvancedSelectionListGUI();
$list->setSelectionHeaderClass('small');
$list->setItemLinkClass('small');
$list->setId('actl_' . $set['server_id']);
$list->setListTitle($this->lng->txt('actions'));
if (ilECSSetting::getInstanceByServerId($set['server_id'])->isEnabled()) {
$list->addItem($this->lng->txt('ecs_deactivate'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'deactivate'));
} else {
$list->addItem($this->lng->txt('ecs_activate'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'activate'));
}
$list->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'edit'));
$list->addItem($this->lng->txt('copy'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'cp'));
$list->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'delete'));
$this->tpl->setVariable('ACTIONS', $list->getHTML());
$ilCtrl->clearParameters($this->getParentObject());
}
示例2: validate
/**
* validate
*
* @access public
* @return
*/
public function validate()
{
global $ilErr, $lng;
$success = true;
$ilErr->setMessage('');
if (!strlen($this->getTitle())) {
$success = false;
$ilErr->appendMessage($lng->txt('err_missing_title'));
}
if (ilDateTime::_before($this->getEnd(), $this->getStart(), '')) {
$success = false;
$ilErr->appendMessage($lng->txt('err_end_before_start'));
}
return $success;
}
示例3: lookupRegistrationInfo
/**
* Lookup registration info
* @global ilDB $ilDB
* @global ilObjUser $ilUser
* @global ilLanguage $lng
* @param int $a_obj_id
* @return array
*/
public static function lookupRegistrationInfo($a_obj_id)
{
global $ilDB, $ilUser, $lng;
$query = 'SELECT sub_limitation_type, sub_start, sub_end, sub_mem_limit, sub_max_members FROM crs_settings ' . 'WHERE obj_id = ' . $ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
$info = array();
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$info['reg_info_start'] = new ilDateTime($row->sub_start, IL_CAL_UNIX);
$info['reg_info_end'] = new ilDateTime($row->sub_end, IL_CAL_UNIX);
$info['reg_info_type'] = $row->sub_limitation_type;
$info['reg_info_max_members'] = $row->sub_max_members;
$info['reg_info_mem_limit'] = $row->sub_mem_limit;
}
$registration_possible = true;
// Limited registration
if ($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_LIMITED) {
$dt = new ilDateTime(time(), IL_CAL_UNIX);
if (ilDateTime::_before($dt, $info['reg_info_start'])) {
$info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_start');
$info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
} elseif (ilDateTime::_before($dt, $info['reg_info_end'])) {
$info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_end');
$info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
} else {
$registration_possible = false;
$info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
$info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
}
} else {
if ($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_UNLIMITED) {
$registration_possible = true;
} else {
$registration_possible = false;
$info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
$info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
}
}
if ($info['reg_info_mem_limit'] && $registration_possible) {
// Check if users are on waiting list
// @todo
// Check for free places
$part = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $ilUser->getId());
if ($part->getNumberOfMembers() <= $info['reg_info_max_members']) {
$info['reg_info_list_prop_limit']['property'] = $lng->txt('crs_list_reg_limit_places');
$info['reg_info_list_prop_limit']['value'] = max(0, $info['reg_info_max_members'] - $part->getNumberOfMembers());
} else {
$info['reg_info_list_prop_limit']['property'] = '';
$info['reg_info_list_prop_limit']['value'] = $lng->txt('crs_list_reg_limit_full');
}
}
return $info;
}
示例4: synchroniseExternalCalendars
/**
* Sync external calendars
*/
protected function synchroniseExternalCalendars()
{
global $ilUser;
if (!ilCalendarSettings::_getInstance()->isWebCalSyncEnabled()) {
return false;
}
// @todo make this thread safe
$limit = new ilDateTime(time(), IL_CAL_UNIX);
$limit->increment(IL_CAL_HOUR, -1 * ilCalendarSettings::_getInstance()->getWebCalSyncHours());
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
foreach ($cats->getCategoriesInfo() as $cat_id => $info) {
if ($info['remote']) {
// Check for execution
$category = new ilCalendarCategory($cat_id);
if (ilDateTime::_before($category->getRemoteSyncLastExecution(), $limit)) {
// update in any case to avoid multiple updates of invalid calendar sources.
$category->setRemoteSyncLastExecution(new ilDateTime(time(), IL_CAL_UNIX));
$category->update();
include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
$remote = new ilCalendarRemoteReader($category->getRemoteUrl());
$remote->setUser($category->getRemoteUser());
$remote->setPass($category->getRemotePass());
$remote->read();
$remote->import($category);
break;
}
}
}
}
示例5: lookupRegistrationInfo
/**
* Lookup registration info
* @global ilDB $ilDB
* @global ilObjUser $ilUser
* @global ilLanguage $lng
* @param int $a_obj_id
* @return array
*/
public static function lookupRegistrationInfo($a_obj_id)
{
global $ilDB, $ilUser, $lng;
$query = 'SELECT registration_type, registration_enabled, registration_unlimited, registration_start, ' . 'registration_end, registration_mem_limit, registration_max_members FROM grp_settings ' . 'WHERE obj_id = ' . $ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
$info = array();
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$info['reg_info_start'] = new ilDateTime($row->registration_start, IL_CAL_DATETIME);
$info['reg_info_end'] = new ilDateTime($row->registration_end, IL_CAL_DATETIME);
$info['reg_info_type'] = $row->registration_type;
$info['reg_info_max_members'] = $row->registration_max_members;
$info['reg_info_mem_limit'] = $row->registration_mem_limit;
$info['reg_info_unlimited'] = $row->registration_unlimited;
$info['reg_info_max_members'] = 0;
if ($info['reg_info_mem_limit']) {
$info['reg_info_max_members'] = $row->registration_max_members;
}
$info['reg_info_enabled'] = $row->registration_enabled;
}
$registration_possible = $info['reg_info_enabled'];
// Limited registration (added $registration_possible, see bug 0010157)
if (!$info['reg_info_unlimited'] && $registration_possible) {
$dt = new ilDateTime(time(), IL_CAL_UNIX);
if (ilDateTime::_before($dt, $info['reg_info_start'])) {
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_start');
$info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
} elseif (ilDateTime::_before($dt, $info['reg_info_end'])) {
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_end');
$info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
} else {
$registration_possible = false;
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_period');
$info['reg_info_list_prop']['value'] = $lng->txt('grp_list_reg_noreg');
}
} else {
// added !$registration_possible, see bug 0010157
if (!$registration_possible) {
$registration_possible = false;
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_period');
$info['reg_info_list_prop']['value'] = $lng->txt('grp_list_reg_noreg');
}
}
if ($info['reg_info_mem_limit'] && $registration_possible) {
// Check if users are on waiting list
// @todo
// Check for free places
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
$part = ilGroupParticipants::_getInstanceByObjId($a_obj_id);
if ($part->getCountMembers() <= $info['reg_info_max_members']) {
$info['reg_info_list_prop_limit']['property'] = $lng->txt('grp_list_reg_limit_places');
$info['reg_info_list_prop_limit']['value'] = max(0, $info['reg_info_max_members'] - $part->getCountMembers());
} else {
$info['reg_info_list_prop_limit']['property'] = '';
$info['reg_info_list_prop_limit']['value'] = $lng->txt('grp_list_reg_limit_full');
}
}
return $info;
}
示例6: getOverviewData
/**
* get the data for a users overview table
*
* @return array list of box data
*/
public function getOverviewData()
{
$data = array();
// get the basic box data
for ($box = 0; $box <= $this->getLastBox(); $box++) {
$data[$box] = array("box" => (int) $box, "capacity" => (int) $this->getBoxCapacity($box), "count" => (int) $this->countCardsInBox($box), "last_trained" => new ilDateTime());
}
// get the last trained date of all boxes
// for each box this is taken from the latest last trained date
// of all cards with box as last status
foreach ((array) $this->getUsedCards() as $usage) {
$box = $usage->getLastStatus();
if (isset($data[$box]) and ilDateTime::_before($data[$box]["last_trained"], $usage->getLastChecked())) {
$data[$box]["last_trained"] = $usage->getLastChecked();
}
}
return array_values($data);
}
示例7: _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));
}
示例8: 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;
}
示例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;
}
示例10: save
//.........这里部分代码省略.........
$title = $sco_ids[$form->getInput('available_rooms')]['sco_name'];
$description = $sco_ids[$form->getInput('available_rooms')]['description'];
// create and insert object in objecttree
$class_name = "ilObj" . $objDefinition->getClassName($new_type);
include_once $location . "/class." . $class_name . ".php";
/** @var $newObj ilObjAdobeConnect */
$newObj = new $class_name();
$newObj->setType($new_type);
$newObj->setTitle(ilUtil::stripSlashes($title));
$newObj->setDescription(ilUtil::stripSlashes($description));
$newObj->create();
$newObj->createReference();
$newObj->putInTree($_GET["ref_id"]);
$newObj->setPermissions($_GET["ref_id"]);
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->afterSave($newObj);
return;
} catch (Exception $e) {
ilUtil::sendFailure($e->getMessage(), true);
}
} else {
global $ilUser;
$owner = $ilUser->getId();
if (strlen($form->getInput('owner')) > 1) {
if (ilObjUser::_lookupId($form->getInput('owner')) > 0) {
$owner = ilObjUser::_lookupId($form->getInput('owner'));
} else {
ilUtil::sendFailure($this->lng->txt('user_not_found'));
$owner = 0;
}
}
if ($template_settings['duration']['hide'] == '1') {
$durationValid = true;
} else {
if ($form->getInput('time_type_selection') == 'permanent_room' && ilAdobeConnectServer::getSetting('enable_perm_room', '1')) {
$duration['hh'] = 2;
$duration['mm'] = 0;
} else {
$duration = $form->getInput("duration");
}
if ($duration['hh'] * 60 + $duration['mm'] < 10) {
$form->getItemByPostVar('duration')->setAlert($this->pluginObj->txt('min_duration_error'));
$durationValid = false;
} else {
$durationValid = true;
}
}
if ($template_settings['start_date']['hide'] == '1') {
$time_mismatch = false;
} else {
if ($durationValid) {
require_once dirname(__FILE__) . '/class.ilAdobeConnectServer.php';
$serverConfig = ilAdobeConnectServer::_getInstance();
$minTime = new ilDateTime(time() + $serverConfig->getScheduleLeadTime() * 60 * 60, IL_CAL_UNIX);
$newStartDate = $form->getItemByPostVar("start_date")->getDate();
$time_mismatch = false;
if (ilDateTime::_before($newStartDate, $minTime) && $form->getInput('time_type_selection') != 'permanent_room') {
ilUtil::sendFailure(sprintf($this->pluginObj->txt('xavc_lead_time_mismatch_create'), ilDatePresentation::formatDate($minTime)), true);
$time_mismatch = true;
}
}
}
if (!$time_mismatch && $owner > 0) {
try {
if ($durationValid) {
$location = $objDefinition->getLocation($new_type);
// create and insert object in objecttree
$class_name = "ilObj" . $objDefinition->getClassName($new_type);
include_once $location . "/class." . $class_name . ".php";
/** @var $newObj ilObjAdobeConnect */
$newObj = new $class_name();
$newObj->setType($new_type);
$newObj->setTitle(ilUtil::stripSlashes($_POST["title"]));
$newObj->setDescription(ilUtil::stripSlashes($_POST["desc"]));
$newObj->setOwner($owner);
$newObj->create();
$newObj->createReference();
$newObj->putInTree($_GET["ref_id"]);
$newObj->setPermissions($_GET["ref_id"]);
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->afterSave($newObj);
return;
}
} catch (Exception $e) {
ilUtil::sendFailure($e->getMessage(), true);
}
}
}
$form->setValuesByPost();
if (ilAdobeConnectServer::getSetting('show_free_slots')) {
$this->showCreationForm($form);
} else {
$this->tpl->setContent($form->getHtml());
}
} else {
$form->setValuesByPost();
$this->tpl->setContent($form->getHTML());
return;
}
}
示例11: 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];
}
示例12: 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;
}
示例13: show
//.........这里部分代码省略.........
$this->tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, true));
$this->tpl->parseCurrentBlock();
}
if (isset($_GET["bkid"])) {
$user_id = $_GET["bkid"];
$disable_empty = true;
$no_add = true;
} else {
if ($ilUser->getId() == ANONYMOUS_USER_ID) {
$user_id = $ilUser->getId();
$disable_empty = false;
$no_add = true;
} else {
$user_id = $ilUser->getId();
$disable_empty = false;
$no_add = false;
}
}
$is_portfolio_embedded = false;
if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) {
$no_add = true;
$is_portfolio_embedded = true;
}
include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php';
$this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH, $user_id);
$this->scheduler->addSubitemCalendars(true);
if (sizeof($this->schedule_filters)) {
foreach ($this->schedule_filters as $filter) {
$this->scheduler->addFilter($filter);
}
}
$this->scheduler->calculate();
include_once 'Services/Calendar/classes/class.ilCalendarSettings.php';
$settings = ilCalendarSettings::_getInstance();
$counter = 0;
foreach (ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE, 'm'), $this->seed->get(IL_CAL_FKT_DATE, 'Y'), $this->user_settings->getWeekStart())->get() as $date) {
$counter++;
$has_events = (bool) $this->showEvents($date);
if (!$no_add) {
include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
$this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
$this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
$this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
$new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
if ($settings->getEnableGroupMilestones()) {
$this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
$this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
$this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
$new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone');
$this->tpl->setCurrentBlock("new_ms");
$this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX));
$this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD));
$this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
$this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
$this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
$this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
$this->tpl->parseCurrentBlock();
} else {
$this->tpl->setCurrentBlock("new_app");
$this->tpl->setVariable('ADD_LINK', $new_app_url);
$this->tpl->setVariable('NEW_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app')));
$this->tpl->parseCurrentBlock();
}
}
$day = $date->get(IL_CAL_FKT_DATE, 'j');
$month = $date->get(IL_CAL_FKT_DATE, 'n');
if ($day == 1) {
$month_day = '1 ' . ilCalendarUtil::_numericMonthToString($month, false);
} else {
$month_day = $day;
}
if (!$is_portfolio_embedded && (!$disable_empty || $has_events)) {
$this->tpl->setCurrentBlock('month_day_link');
$this->ctrl->clearParametersByClass('ilcalendardaygui');
$this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
$this->tpl->setVariable('OPEN_DAY_VIEW', $this->ctrl->getLinkTargetByClass('ilcalendardaygui', ''));
$this->ctrl->clearParametersByClass('ilcalendardaygui');
} else {
$this->tpl->setCurrentBlock('month_day_no_link');
}
$this->tpl->setVariable('MONTH_DAY', $month_day);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock('month_col');
include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
if (ilCalendarUtil::_isToday($date)) {
$this->tpl->setVariable('TD_CLASS', 'caltoday');
} elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) {
$this->tpl->setVariable('TD_CLASS', 'calstd');
} elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) {
$this->tpl->setVariable('TD_CLASS', 'calprev');
} else {
$this->tpl->setVariable('TD_CLASS', 'calnext');
}
$this->tpl->parseCurrentBlock();
if ($counter and !($counter % 7)) {
$this->tpl->setCurrentBlock('month_row');
$this->tpl->parseCurrentBlock();
}
}
}
示例14: 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;
}
示例15: 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;
}