本文整理汇总了PHP中ilDateTime类的典型用法代码示例。如果您正苦于以下问题:PHP ilDateTime类的具体用法?PHP ilDateTime怎么用?PHP ilDateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilDateTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: fillRow
/**
* Standard Version of Fill Row. Most likely to
* be overwritten by derived class.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl;
$now = new ilDateTime(time(), IL_CAL_UNIX);
$this->tpl->setVariable("IMG_ALT", $lng->txt("obj_" . $a_set["type"]));
$this->tpl->setVariable("IMG_SRC", ilObject::_getIcon($a_set["obj_id"], "small", $a_set["type"]));
$this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
$this->tpl->setVariable("ID", $a_set["ref_id"]);
$this->tpl->setVariable("TXT_LAST_EXPORT_FILE", $lng->txt("export_last_file"));
$this->tpl->setVariable("TXT_OMIT", $lng->txt("export_omit"));
$this->tpl->setVariable("TXT_CREATE_NEW_EXPORT_FILE", $lng->txt("export_create"));
$preset = "CREATE";
if ($a_set["timestamp"] > 0) {
$last_export = new ilDateTime($a_set["timestamp"], IL_CAL_UNIX);
$this->tpl->setVariable("VAL_LAST_EXPORT", ilDatePresentation::formatDate($last_export));
if (ilDateTime::_equals($last_export, $now, IL_CAL_DAY)) {
$preset = "LAST_FILE";
}
}
$this->tpl->setVariable("SEL_" . $preset, ' checked="checked" ');
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:25,代码来源:class.ilSubItemSelectionTableGUI.php
示例18: exportSelected
/**
* Export selected user tracking data
* @global ilDB $ilDB
* @global ilObjUser $ilUser
* @param bool $a_all
* @param array $a_users
*/
public function exportSelected($a_all, $a_users = array())
{
global $ilDB, $ilUser, $ilSetting;
$inst_id = $ilSetting->get('inst_id', 0);
// Get all scos
$scos = array();
//get all SCO's of this object
$query = 'SELECT scorm_object.obj_id, scorm_object.title, ' . 'scorm_object.c_type, scorm_object.slm_id, scorm_object.obj_id scoid ' . 'FROM scorm_object, sc_item, sc_resource ' . 'WHERE (scorm_object.slm_id = %s ' . 'AND scorm_object.obj_id = sc_item.obj_id ' . 'AND sc_item.identifierref = sc_resource.import_id ' . 'AND sc_resource.scormtype = %s) ' . 'GROUP BY scorm_object.obj_id, scorm_object.title, scorm_object.c_type, ' . 'scorm_object.slm_id, scorm_object.obj_id ';
$res = $ilDB->queryF($query, array('integer', 'text'), array($this->getId(), 'sco'));
while ($row = $ilDB->fetchAssoc($res)) {
$scos[] = $row['scoid'];
}
$users = array();
if ($a_all) {
$query = 'SELECT user_id FROM scorm_tracking ' . 'WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer') . ' ' . 'GROUP BY user_id';
$res = $ilDB->query($query);
while ($row = $ilDB->fetchAssoc($res)) {
$users[] = $row['user_id'];
}
} else {
$users = $a_users;
}
// get all completed
include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
$completed = ilObjSCORMTracking::_getCompleted($scos, $this->getId());
$last = ilObjSCORMTracking::lookupLastAccessTimes($this->getId());
include_once './Services/Utilities/classes/class.ilCSVWriter.php';
$csv = new ilCSVWriter();
$csv->setSeparator(';');
foreach (array('Department', 'Login', 'Lastname', 'Firstname', 'Email', 'Date', 'Status') as $col) {
$csv->addColumn($col);
}
// Read user data
$query = 'SELECT usr_id,login,firstname,lastname,department,email ' . 'FROM usr_data ' . 'WHERE ' . $ilDB->in('usr_id', $users, false, 'integer');
$res = $ilDB->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$csv->addRow();
$csv->addColumn((string) $row->department);
$csv->addColumn((string) $row->login);
$csv->addColumn((string) $row->lastname);
$csv->addColumn((string) $row->firstname);
$csv->addColumn((string) $row->email);
if (isset($last[$row->usr_id])) {
$dt = new ilDateTime($last[$row->usr_id], IL_CAL_DATETIME);
$csv->addColumn((string) $dt->get(IL_CAL_FKT_DATE, 'd.m.Y'));
} else {
$csv->addColumn('');
}
$csv->addColumn(in_array($row->usr_id, $completed) ? 1 : 0);
}
ilUtil::deliverData($csv->getCSVString(), 'scorm_tracking_' . $this->getRefId() . '_' . time() . '.csv');
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:59,代码来源:class.ilObjSCORMLearningModule.php
示例19: _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
示例20: importRecords
/**
* Import records from Excel file
*
* @param $file
* @param bool $simulate
*/
private function importRecords($file, $simulate = false)
{
global $ilUser, $lng;
include_once "./Modules/DataCollection/libs/ExcelReader/excel_reader2.php";
$warnings = array();
try {
$excel = new Spreadsheet_Excel_Reader($file);
} catch (Exception $e) {
$warnings[] = $lng->txt("dcl_file_not_readable");
}
if (count($warnings)) {
$this->endImport(0, $warnings);
return;
}
$field_names = array();
for ($i = 1; $i <= $excel->colcount(); $i++) {
$field_names[$i] = $excel->val(1, $i);
}
$fields = $this->getImportFieldsFromTitles($field_names, $warnings);
for ($i = 2; $i <= $excel->rowcount(); $i++) {
$record = new ilDataCollectionRecord();
$record->setTableId($this->table_obj->getId());
$record->setOwner($ilUser->getId());
$date_obj = new ilDateTime(time(), IL_CAL_UNIX);
$record->setCreateDate($date_obj->get(IL_CAL_DATETIME));
$record->setTableId($this->table_id);
if (!$simulate) {
$record->doCreate();
}
foreach ($fields as $col => $field) {
$value = $excel->val($i, $col);
$value = utf8_encode($value);
try {
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
$old = $value;
$value = $this->getReferenceFromValue($field, $value);
if (!$value) {
$warnings[] = "(" . $i . ", " . $this->getExcelCharForInteger($col) . ") " . $lng->txt("dcl_no_such_reference") . " " . $old;
}
} else {
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_DATETIME) {
$value = array('date' => date('Y-m-d', strtotime($value)), 'time' => '00:00:00');
}
}
$field->checkValidity($value, $record->getId());
if (!$simulate) {
$record->setRecordFieldValue($field->getId(), $value);
}
} catch (ilDataCollectionInputException $e) {
$warnings[] = "(" . $i . ", " . $this->getExcelCharForInteger($col) . ") " . $e;
}
}
if (!$simulate) {
$record->doUpdate();
}
if ($i - 1 > $this->max_imports) {
$warnings[] = $lng->txt("dcl_max_import") . ($excel->rowcount() - 1) . " > " . $this->max_imports;
break;
}
}
$this->endImport($i - 2, $warnings);
}
开发者ID:bheyser,项目名称:qplskl,代码行数:68,代码来源:class.ilDataCollectionRecordListGUI.php
注:本文中的ilDateTime类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论