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


PHP ilDateTime类代码示例

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


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

示例1: setDate

 public function setDate(ilDateTime $a_value = null)
 {
     if ($a_value && $a_value->isNull()) {
         $a_value = null;
     }
     $this->value = $a_value;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:class.ilADTDate.php

示例2: run

 public function run()
 {
     global $ilSetting, $ilDB;
     $status = ilCronJobResult::STATUS_NO_ACTION;
     $days_before = $ilSetting->get('ch_reminder_days');
     $now = new ilDateTime(time(), IL_CAL_UNIX);
     $limit = clone $now;
     $limit->increment(IL_CAL_DAY, $days_before);
     $counter = 0;
     $query = 'SELECT * FROM booking_user ' . 'JOIN cal_entries ON entry_id = cal_id ' . 'WHERE notification_sent = ' . $ilDB->quote(0, 'integer') . ' ' . 'AND starta > ' . $ilDB->quote($now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp') . ' ' . 'AND starta <= ' . $ilDB->quote($limit->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp');
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         include_once 'Services/Calendar/classes/class.ilCalendarMailNotification.php';
         $mail = new ilCalendarMailNotification();
         $mail->setAppointmentId($row->entry_id);
         $mail->setRecipients(array($row->user_id));
         $mail->setType(ilCalendarMailNotification::TYPE_BOOKING_REMINDER);
         $mail->send();
         // update notification
         $query = 'UPDATE booking_user ' . 'SET notification_sent = ' . $ilDB->quote(1, 'integer') . ' ' . 'WHERE user_id = ' . $ilDB->quote($row->user_id, 'integer') . ' ' . 'AND entry_id = ' . $ilDB->quote($row->entry_id, 'integer');
         $ilDB->manipulate($query);
         $counter++;
     }
     if ($counter) {
         $status = ilCronJobResult::STATUS_OK;
     }
     $result = new ilCronJobResult();
     $result->setStatus($status);
     return $result;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:30,代码来源:class.ilConsultationHourCron.php

示例3: calculate

 /**
  * Calculates schedules.
  */
 public function calculate()
 {
     $events = $this->getEvents();
     // we need category type for booking handling
     $ids = array();
     foreach ($events as $event) {
         $ids[] = $event->getEntryId();
     }
     $counter = 0;
     foreach ($events as $event) {
         $this->schedule[$counter]['event'] = $event;
         $this->schedule[$counter]['dstart'] = $event->getStart()->get(IL_CAL_UNIX);
         $this->schedule[$counter]['dend'] = $event->getEnd()->get(IL_CAL_UNIX);
         $this->schedule[$counter]['fullday'] = $event->isFullday();
         if (!$event->isFullday()) {
             switch ($this->type) {
                 case self::TYPE_DAY:
                 case self::TYPE_WEEK:
                     // store date info (used for calculation of overlapping events)
                     $start_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
                     $this->schedule[$counter]['start_info'] = $start_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
                     $end_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
                     $this->schedule[$counter]['end_info'] = $end_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
                     break;
                 default:
                     break;
             }
         }
         $counter++;
         if ($this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
             break;
         }
     }
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:37,代码来源:class.ilRoomSharingCalendarSchedule.php

示例4: parse

 /**
  * Parse table content
  */
 public function parse()
 {
     $this->initTable();
     // @TODO add filter
     $users = $this->getParentObject()->object->getTrackedUsers($this->filter['lastname']);
     $attempts = $this->getParentObject()->object->getAttemptsForUsers();
     $versions = $this->getParentObject()->object->getModuleVersionForUsers();
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     $allowExportPrivacy = $privacy->enabledExportSCORM();
     $data = array();
     foreach ($users as $user) {
         $tmp = array();
         $tmp['user'] = $user['user_id'];
         if ($allowExportPrivacy == true) {
             $tmp['name'] = $user['lastname'] . ', ' . $user['firstname'];
         } else {
             $tmp['name'] = $user['user_id'];
         }
         $dt = new ilDateTime($user['last_access'], IL_CAL_DATETIME);
         $tmp['last_access'] = $dt->get(IL_CAL_UNIX);
         $tmp['attempts'] = (int) $attempts[$user['user_id']];
         $tmp['version'] = (int) $versions[$user['user_id']];
         $data[] = $tmp;
     }
     $this->setData($data);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:30,代码来源:class.ilSCORMTrackingUsersTableGUI.php

示例5: 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());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:58,代码来源:class.ilECSServerTableGUI.php

示例6: buildJson

 protected function buildJson(ilECSSetting $a_server)
 {
     $json = $this->getJsonCore('application/ecs-file');
     $json->version = $this->content_obj->getVersion();
     require_once "./Services/History/classes/class.ilHistory.php";
     $entries = ilHistory::_getEntriesForObject($this->content_obj->getId(), $this->content_obj->getType());
     if (count($entries)) {
         $entry = array_shift($entries);
         $entry = new ilDateTime($entry["date"], IL_CAL_DATETIME);
         $json->version_date = $entry->get(IL_CAL_UNIX);
     } else {
         $json->version_date = time();
     }
     return $json;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilECSFileSettings.php

示例7: _lookupAppointment

 /**
  * lookup appointment
  *
  * @access public
  * @param int obj_id
  * @static
  */
 public static function _lookupAppointment($a_obj_id)
 {
     global $ilDB;
     $query = "SELECT * FROM event_appointment " . "WHERE event_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $info['fullday'] = $row->fulltime;
         $date = new ilDateTime($row->e_start, IL_CAL_DATETIME, 'UTC');
         $info['start'] = $date->getUnixTime();
         $date = new ilDateTime($row->e_end, IL_CAL_DATETIME, 'UTC');
         $info['end'] = $date->getUnixTime();
         return $info;
     }
     return array();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilSessionAppointment.php

示例8: getLuceneSearchString

 public function getLuceneSearchString($a_value)
 {
     // see ilADTDateTimeSearchBridgeRange::importFromPost();
     if ($a_value["tgl"]) {
         $start = mktime($a_value["lower"]["time"]["h"], $a_value["lower"]["time"]["m"], 1, $a_value["lower"]["date"]["m"], $a_value["lower"]["date"]["d"], $a_value["lower"]["date"]["y"]);
         $end = mktime($a_value["upper"]["time"]["h"], $a_value["upper"]["time"]["m"], 1, $a_value["upper"]["date"]["m"], $a_value["upper"]["date"]["d"], $a_value["upper"]["date"]["y"]);
         if ($start && $end && $start > $end) {
             $tmp = $start;
             $start = $end;
             $end = $tmp;
         }
         $start = new ilDateTime($start, IL_CAL_UNIX);
         $end = new ilDateTime($end, IL_CAL_UNIX);
         return "{" . $start->get(IL_CAL_DATETIME) . " TO " . $end->get(IL_CAL_DATETIME) . "}";
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:16,代码来源:class.ilAdvancedMDFieldDefinitionDateTime.php

示例9: _isToday

 /**
  * check if a date is today 
  * @param ilDateTime $date date to check
  * @return bool
  * @static
  */
 public static function _isToday($date)
 {
     global $ilUser;
     if (!is_object(self::$today)) {
         self::$today = new ilDateTime(time(), IL_CAL_UNIX, $ilUser->getTimeZone());
     }
     return ilDateTime::_equals(self::$today, $date, IL_CAL_DAY, $ilUser->getTimeZone());
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:14,代码来源:class.ilCalendarUtil.php

示例10: getAppointmentIdsByGroup

 /**
  * Get appointment ids by consultation hour group
  * @param type $a_user_id
  * @param type $a_ch_group_id
  * @param ilDateTime $start
  */
 public static function getAppointmentIdsByGroup($a_user_id, $a_ch_group_id, ilDateTime $start = null)
 {
     global $ilDB;
     // @todo check start time
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     $type = ilCalendarCategory::TYPE_CH;
     $start_limit = '';
     if ($start instanceof ilDateTime) {
         $start_limit = 'AND ce.starta >= ' . $ilDB->quote($start->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp');
     }
     $query = 'SELECT ce.cal_id FROM cal_entries ce ' . 'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id ' . 'JOIN cal_categories cc ON ca.cat_id = cc.cat_id ' . 'JOIN booking_entry be ON ce.context_id = be.booking_id ' . 'WHERE cc.obj_id = ' . $ilDB->quote($a_user_id, 'integer') . ' ' . 'AND cc.type = ' . $ilDB->quote($type, 'integer') . ' ' . 'AND be.booking_group = ' . $ilDB->quote($a_ch_group_id, 'integer') . ' ' . $start_limit . ' ' . 'ORDER BY ce.starta ';
     $res = $ilDB->query($query);
     $app_ids = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $app_ids[] = $row->cal_id;
     }
     return $app_ids;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:24,代码来源:class.ilConsultationHourAppointments.php

示例11: handleEvent

 /**
  * Handle an event in a listener.
  *
  * @param	string	$a_component	component, e.g. "Modules/Forum" or "Services/User"
  * @param	string	$a_event		event e.g. "createUser", "updateUser", "deleteUser", ...
  * @param	array	$a_parameter	parameter array (assoc), array("name" => ..., "phone_office" => ...)
  */
 static function handleEvent($a_component, $a_event, $a_parameter)
 {
     global $ilLog;
     $ilLog->write(__METHOD__ . ': Listening to event from: ' . $a_component);
     switch ($a_component) {
         case 'Services/User':
             switch ($a_event) {
                 case 'afterCreation':
                     $user = $a_parameter['user_obj'];
                     $this->handleMembership($user);
                     break;
             }
             break;
         case 'Modules/Course':
             switch ($a_event) {
                 case 'addSubscriber':
                 case 'addParticipant':
                     if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
                         if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
                             $GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
                             return true;
                         }
                         include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
                         $server_id = ilECSImport::lookupServerId($a_parameter['usr_id']);
                         $GLOBALS['ilLog']->write(__METHOD__ . ': Found server id: ' . $server_id);
                         include_once 'Services/WebServices/ECS/classes/class.ilECSSetting.php';
                         $settings = ilECSSetting::getInstanceByServerId($server_id);
                         $end = new ilDateTime(time(), IL_CAL_UNIX);
                         $end->increment(IL_CAL_MONTH, $settings->getDuration());
                         if ($user->getTimeLimitUntil() < $end->get(IL_CAL_UNIX)) {
                             $user->setTimeLimitUntil($end->get(IL_CAL_UNIX));
                             $user->update();
                         }
                         self::_sendNotification($settings, $user);
                         unset($user);
                     }
                     break;
             }
             break;
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:48,代码来源:class.ilECSAppEventListener.php

示例12: parse

 /**
  * Parse table content
  */
 public function parse()
 {
     $this->initTable();
     // @TODO add filter
     $users = $this->getParentObject()->object->getTrackedUsers($this->filter['lastname']);
     $attempts = $this->getParentObject()->object->getAttemptsForUsers();
     $versions = $this->getParentObject()->object->getModuleVersionForUsers();
     $data = array();
     foreach ($users as $user) {
         $tmp = array();
         $tmp['user'] = $user['user_id'];
         $tmp['firstname'] = $user['firstname'];
         $tmp['lastname'] = $user['lastname'];
         $dt = new ilDateTime($user['last_access'], IL_CAL_DATETIME);
         $tmp['last_access'] = $dt->get(IL_CAL_UNIX);
         $tmp['attempts'] = (int) $attempts[$user['user_id']];
         $tmp['version'] = (int) $versions[$user['user_id']];
         $data[] = $tmp;
     }
     $this->setData($data);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:24,代码来源:class.ilSCORMTrackingUsersTableGUI.php

示例13: _getProgress

 function _getProgress($a_user_id, $a_obj_id)
 {
     require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
     $events = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
     include_once './Services/Calendar/classes/class.ilDateTime.php';
     foreach ($events as $row) {
         $tmp_date = new ilDateTime($row['last_access'], IL_CAL_UNIX);
         $row['last_access'] = $tmp_date->get(IL_CAL_TIMESTAMP);
         if ($progress) {
             $progress['spent_seconds'] += $row['spent_seconds'];
             $progress['access_time'] = max($progress['access_time'], $row['last_access']);
         } else {
             $progress['obj_id'] = $row['obj_id'];
             $progress['user_id'] = $row['usr_id'];
             $progress['spent_seconds'] = $row['spent_seconds'];
             $progress['access_time'] = $row['last_access'];
             $progress['visits'] = $row['read_count'];
         }
     }
     return $progress ? $progress : array();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:21,代码来源:class.ilLearningProgress.php

示例14: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng, $ilUser;
     $ok = true;
     $_POST[$this->getPostVar()]["date"]["y"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["y"]);
     $_POST[$this->getPostVar()]["date"]["m"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["m"]);
     $_POST[$this->getPostVar()]["date"]["d"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["d"]);
     $_POST[$this->getPostVar()]["time"]["h"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["h"]);
     $_POST[$this->getPostVar()]["time"]["m"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["m"]);
     $_POST[$this->getPostVar()]["time"]["s"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["s"]);
     // verify date
     $dt['year'] = (int) $_POST[$this->getPostVar()]['date']['y'];
     $dt['mon'] = (int) $_POST[$this->getPostVar()]['date']['m'];
     $dt['mday'] = (int) $_POST[$this->getPostVar()]['date']['d'];
     $dt['hours'] = (int) $_POST[$this->getPostVar()]['time']['h'];
     $dt['minutes'] = (int) $_POST[$this->getPostVar()]['time']['m'];
     $dt['seconds'] = (int) $_POST[$this->getPostVar()]['time']['s'];
     if ($dt['year'] == 0 && $dt['mon'] == 0 && $dt['mday'] == 0 && $this->getRequired()) {
         $this->date = null;
         $this->setAlert($lng->txt("msg_input_is_required"));
         return false;
     } else {
         if ($dt['year'] == 0 && $dt['mon'] == 0 && $dt['mday'] == 0) {
             $this->date = null;
             $_POST[$this->getPostVar()]['date'] = "";
             // #10413
         } else {
             if (!checkdate((int) $dt['mon'], (int) $dt['mday'], (int) $dt['year'])) {
                 $this->date = null;
                 $this->setAlert($lng->txt("exc_date_not_valid"));
                 return false;
             }
             $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE, $ilUser->getTimeZone());
             $_POST[$this->getPostVar()]['date'] = $date->get(IL_CAL_FKT_DATE, 'Y-m-d', $ilUser->getTimeZone());
             $this->setDate($date);
         }
     }
     return true;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:44,代码来源:class.ilBirthdayInputGUI.php

示例15: createVmsSessionCode

 public function createVmsSessionCode($a_vuser_id, $a_group_id, ilDateTime $expires)
 {
     $GLOBALS['ilLog']->write('Creating new vms session code');
     try {
         $this->initClient();
         $req = new stdClass();
         $req->sessioncode = new stdClass();
         $req->sessioncode->userid = (int) $a_vuser_id;
         $req->sessioncode->groupid = (int) $a_group_id;
         $req->sessioncode->codelength = self::CODELENGTH;
         $req->sessioncode->expirationdate = $expires->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE);
         $req->sessioncode->timezone = self::WS_TIMEZONE;
         $reps = $this->getClient()->createVmsSessionCode($req);
         ilViteroSessionStore::getInstance()->addSession($a_vuser_id, $reps->code, $expires, self::SESSION_TYPE_VMS);
         return $reps->code;
     } catch (SoapFault $e) {
         $code = $this->parseErrorCode($e);
         $GLOBALS['ilLog']->write(__METHOD__ . ': Creating vms session code failed with message: ' . $code);
         $GLOBALS['ilLog']->write(__METHOD__ . ': Last request: ' . $this->getClient()->__getLastRequest());
         $GLOBALS['ilLog']->write(__METHOD__ . ': Last request: ' . $this->getClient()->__getLastResponse());
         throw new ilViteroConnectorException($e->getMessage(), $code);
     }
 }
开发者ID:leifos-gmbh,项目名称:Vitero,代码行数:23,代码来源:class.ilViteroSessionCodeSoapConnector.php


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