本文整理汇总了PHP中get_timezone_offset函数的典型用法代码示例。如果您正苦于以下问题:PHP get_timezone_offset函数的具体用法?PHP get_timezone_offset怎么用?PHP get_timezone_offset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_timezone_offset函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getRemoteTime
function getRemoteTime($originTime, $remote_tz, $origin_tz)
{
//convert origin time to UNIX time
$unixTimeOrigin = strtotime($originTime);
$offset = get_timezone_offset($remote_tz, $origin_tz);
//echo "<br>$offset<br>";
$unixRemoteTime = $unixTimeOrigin - $offset;
//return time at remote office
$remoteTime = date('M d H:i', $unixRemoteTime);
return $remoteTime;
}
开发者ID:Redlord1977,项目名称:oocms,代码行数:11,代码来源:cms_include_old.php
示例2: get_timestamp
function get_timestamp($tz, $timestamp)
{
$offset = get_timezone_offset($tz, $timestamp);
$timestamp -= $offset;
return $timestamp;
}
开发者ID:baki250,项目名称:angular-io-app,代码行数:6,代码来源:lib.global.php
示例3: parse_vevent
/**
* Parses a VEVENT into an array with fields.
*
* @param vevent VEVENT.
* @param dateFormat dateformat for displaying the start and end date.
*
* @return array().
*/
function parse_vevent($vevent, $dateFormat = "%Y-%m-%d", $timeFormat = "%H:%M")
{
// Regex for the different fields
$regex_summary = '/SUMMARY:(.*?)\\n/';
$regex_location = '/LOCATION:(.*?)\\n/';
// descriptions may be continued with a space at the start of the next line
// BUGFIX: OR descriptions can be the last item in the VEVENT string
$regex_description = '/DESCRIPTION:(.*?)\\n([^ ]|$)/s';
// normal events with time
$regex_dtstart = '/DTSTART.*?:([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})/';
$regex_dtend = '/DTEND.*?:([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})/';
// Timezones can be passed for individual dtstart and dtend by the ics
$regex_dtstart_timezone = '/DTSTART;TZID=(.*?):([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})/';
$regex_dtend_timezone = '/DTEND;TZID=(.*?):([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})/';
// all day event
$regex_alldaystart = '/DTSTART;VALUE=DATE:([0-9]{4})([0-9]{2})([0-9]{2})/';
$regex_alldayend = '/DTEND;VALUE=DATE:([0-9]{4})([0-9]{2})([0-9]{2})/';
// Make the entry
$entry = array();
$entry['vevent'] = "BEGIN:VEVENT\r\n" . $vevent . "END:VEVENT\r\n";
// Get the summary
if (preg_match($regex_summary, $vevent, $summary)) {
$entry['summary'] = str_replace('\\,', ',', $summary[1]);
}
// Get the starting time timezone
if (preg_match($regex_dtstart_timezone, $vevent, $timezone)) {
$start_timezone = $timezone[1];
} else {
$start_timezone = 'UTC';
}
// Get the end time timezone
if (preg_match($regex_dtend_timezone, $vevent, $timezone)) {
$end_timezone = $timezone[1];
} else {
$end_timezone = 'UTC';
}
// Get the start and end times
if (preg_match($regex_dtstart, $vevent, $dtstart)) {
# hour minute second month day year
$entry['startunixdate'] = mktime($dtstart[4], $dtstart[5], $dtstart[6], $dtstart[2], $dtstart[3], $dtstart[1]);
#Calculate the timezone offset
$start_timeOffset = get_timezone_offset($start_timezone, $entry['startunixdate']);
$entry['startunixdate'] = $entry['startunixdate'] + $start_timeOffset;
$entry['startdate'] = strftime($dateFormat, $entry['startunixdate']);
$entry['starttime'] = strftime($timeFormat, $entry['startunixdate']);
preg_match($regex_dtend, $vevent, $dtend);
$entry['endunixdate'] = mktime($dtend[4], $dtend[5], $dtend[6], $dtend[2], $dtend[3], $dtend[1]) + $timeOffset;
$end_timeOffset = get_timezone_offset($end_timezone, $entry['endunixdate']);
$entry['endunixdate'] = $entry['endunixdate'] + $end_timeOffset;
$entry['enddate'] = strftime($dateFormat, $entry['endunixdate']);
$entry['endtime'] = strftime($timeFormat, $entry['endunixdate']);
$entry['allday'] = false;
}
if (preg_match($regex_alldaystart, $vevent, $alldaystart)) {
$entry['startunixdate'] = mktime(0, 0, 0, $alldaystart[2], $alldaystart[3], $alldaystart[1]);
# Calculate the timezone offset
$start_timeOffset = get_timezone_offset($start_timezone, $entry['startunixdate']);
$entry['startunixdate'] = $entry['startunixdate'] + $start_timeOffset;
$entry['startdate'] = strftime($dateFormat, $entry['startunixdate']);
preg_match($regex_alldayend, $vevent, $alldayend);
$entry['endunixdate'] = mktime(0, 0, 0, $alldayend[2], $alldayend[3], $alldayend[1]);
$end_timeOffset = get_timezone_offset($end_timezone, $entry['endunixdate']);
$entry['endunixdate'] = $entry['endunixdate'] + $end_timeOffset - 1;
$entry['enddate'] = strftime($dateFormat, $entry['endunixdate']);
$entry['allday'] = true;
}
# also filter PalmPilot internal stuff
if (preg_match('/@@@/', $entry['description'])) {
continue;
}
if (preg_match($regex_description, $vevent, $description)) {
$entry['description'] = $description[1];
$entry['description'] = preg_replace("/[\r\n] ?/", "", $entry['description']);
$entry['description'] = str_replace('\\,', ',', $entry['description']);
}
if (preg_match($regex_location, $vevent, $location)) {
$entry['location'] = str_replace('\\,', ',', $location[1]);
}
return $entry;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:88,代码来源:functions.php
示例4: today_timeFN
$event_time = today_timeFN();
} else {
$event_time = $ora_evento;
}
if (!isset($data_evento)) {
$event_date = today_dateFN();
} else {
$event_date = $data_evento;
}
/*
$event_time = today_timeFN();
$event_date = today_dateFN();
*/
$ada_address_book = EventsAddressBook::create($userObj);
$tester_TimeZone = MultiPort::getTesterTimeZone($sess_selected_tester);
$time = time() + get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
/*
* Last access link
*/
if (isset($_SESSION['sess_id_course_instance'])) {
$last_access = $userObj->get_last_accessFN($_SESSION['sess_id_course_instance'], "UT", null);
$last_access = AMA_DataHandler::ts_to_date($last_access);
} else {
$last_access = $userObj->get_last_accessFN(null, "UT", null);
$last_access = AMA_DataHandler::ts_to_date($last_access);
}
if ($last_access == '' || is_null($last_access)) {
$last_access = '-';
}
$content_dataAr = array('user_name' => $user_name, 'user_type' => $user_type, 'user_level' => $user_level, 'titolo' => $titolo, 'testo' => isset($testo) ? trim($testo) : '', 'destinatari' => isset($destinatari) ? trim($destinatari) : '', 'course_title' => '<a href="../browsing/main_index.php">' . $course_title . '</a>', 'status' => $err_msg, 'timezone' => $tester_TimeZone, 'event_time' => $event_time, 'event_date' => $event_date, 'last_visit' => $last_access, 'rubrica' => $ada_address_book->getHtml(), 'status' => $err_msg);
$options_Ar = array('onload_func' => "load_addressbook();updateClock({$time});");
开发者ID:eguicciardi,项目名称:ada,代码行数:31,代码来源:send_event.php
示例5: stats_get_base_monthly
/**
* Start of month
* @param int $time timestamp
* @return start of month
*/
function stats_get_base_monthly($time = 0)
{
global $CFG;
if (empty($time)) {
$time = time();
}
if ($CFG->timezone == 99) {
return strtotime(date('1-M-Y', $time));
} else {
$time = stats_get_base_daily($time);
$offset = get_timezone_offset($CFG->timezone);
$gtime = $time + $offset;
$day = gmdate('d', $gtime);
if ($day == 1) {
return $time;
}
return $gtime - ($day - 1) * 60 * 60 * 24;
}
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:24,代码来源:statslib.php
示例6: test_get_timezone_offset
public function test_get_timezone_offset()
{
// This is a useless function, the timezone offset may be changing!
$this->assertSame(60 * 60 * -5, get_timezone_offset('America/New_York'));
$this->assertDebuggingCalled();
$this->assertSame(60 * 60 * -1, get_timezone_offset(-1));
$this->assertSame(60 * 60 * 1, get_timezone_offset(1));
$this->assertSame(60 * 60 * 1, get_timezone_offset('Europe/Prague'));
$this->assertSame(60 * 60 * 8, get_timezone_offset('Australia/Perth'));
$this->assertSame(60 * 60 * 12, get_timezone_offset('Pacific/Auckland'));
// Known half an hour offsets.
$this->assertEquals(60 * 60 * -4.5, get_timezone_offset('-4.5'));
$this->assertEquals(60 * 60 * -4.5, get_timezone_offset('America/Caracas'));
$this->assertEquals(60 * 60 * 4.5, get_timezone_offset('4.5'));
$this->assertEquals(60 * 60 * 4.5, get_timezone_offset('Asia/Kabul'));
$this->assertEquals(60 * 60 * 5.5, get_timezone_offset('5.5'));
$this->assertEquals(60 * 60 * 5.5, get_timezone_offset('Asia/Kolkata'));
$this->assertEquals(60 * 60 * 6.5, get_timezone_offset('6.5'));
$this->assertEquals(60 * 60 * 6.5, get_timezone_offset('Asia/Rangoon'));
$this->assertEquals(60 * 60 * 9.5, get_timezone_offset('9.5'));
$this->assertEquals(60 * 60 * 9.5, get_timezone_offset('Australia/Darwin'));
$this->assertEquals(60 * 60 * 11.5, get_timezone_offset('11.5'));
$this->assertEquals(60 * 60 * 11.5, get_timezone_offset('Pacific/Norfolk'));
$this->resetDebugging();
}
开发者ID:Keneth1212,项目名称:moodle,代码行数:25,代码来源:date_legacy_test.php
示例7: timezone_offset
function timezone_offset($zones)
{
return get_timezone_offset($zones);
}
开发者ID:Archie22is,项目名称:wp-post-expiry-date-checker,代码行数:4,代码来源:wp-post-date-checker.php
示例8: test_statslib_temp_table_fill
/**
* Test the temporary table creation and deletion.
*
* @depends test_statslib_temp_table_create_and_drop
*/
public function test_statslib_temp_table_fill()
{
global $CFG, $DB, $USER;
$dataset = $this->load_xml_data_file(__DIR__ . "/fixtures/statslib-test09.xml");
$this->prepare_db($dataset[0], array('log'));
$start = self::DAY - get_timezone_offset($CFG->timezone);
$end = $start + 24 * 3600;
stats_temp_table_create();
stats_temp_table_fill($start, $end);
$this->assertEquals(1, $DB->count_records('temp_log1'));
$this->assertEquals(1, $DB->count_records('temp_log2'));
stats_temp_table_drop();
// New log stores.
$this->preventResetByRollback();
stats_temp_table_create();
$course = $this->getDataGenerator()->create_course();
$context = context_course::instance($course->id);
$fcontext = context_course::instance(SITEID);
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
$this->assertFileExists("{$CFG->dirroot}/{$CFG->admin}/tool/log/store/standard/version.php");
set_config('enabled_stores', 'logstore_standard', 'tool_log');
set_config('buffersize', 0, 'logstore_standard');
set_config('logguests', 1, 'logstore_standard');
get_log_manager(true);
$DB->delete_records('logstore_standard_log');
\core_tests\event\create_executed::create(array('context' => $fcontext, 'courseid' => SITEID))->trigger();
\core_tests\event\read_executed::create(array('context' => $context, 'courseid' => $course->id))->trigger();
\core_tests\event\update_executed::create(array('context' => context_system::instance()))->trigger();
\core_tests\event\delete_executed::create(array('context' => context_system::instance()))->trigger();
\core\event\user_loggedin::create(array('userid' => $USER->id, 'objectid' => $USER->id, 'other' => array('username' => $USER->username)))->trigger();
$DB->set_field('logstore_standard_log', 'timecreated', 10);
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
\core_tests\event\delete_executed::create(array('context' => context_system::instance()))->trigger();
\core_tests\event\delete_executed::create(array('context' => context_system::instance()))->trigger();
// Fake the origin of events.
$DB->set_field('logstore_standard_log', 'origin', 'web', array());
$this->assertEquals(7, $DB->count_records('logstore_standard_log'));
stats_temp_table_fill(9, 11);
$logs1 = $DB->get_records('temp_log1');
$logs2 = $DB->get_records('temp_log2');
$this->assertCount(5, $logs1);
$this->assertCount(5, $logs2);
// The order of records in the temp tables is not guaranteed...
$viewcount = 0;
$updatecount = 0;
$logincount = 0;
foreach ($logs1 as $log) {
if ($log->course == $course->id) {
$this->assertEquals('view', $log->action);
$viewcount++;
} else {
$this->assertTrue(in_array($log->action, array('update', 'login')));
if ($log->action === 'update') {
$updatecount++;
} else {
$logincount++;
}
$this->assertEquals(SITEID, $log->course);
}
$this->assertEquals($user->id, $log->userid);
}
$this->assertEquals(1, $viewcount);
$this->assertEquals(3, $updatecount);
$this->assertEquals(1, $logincount);
set_config('enabled_stores', '', 'tool_log');
get_log_manager(true);
stats_temp_table_drop();
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:74,代码来源:statslib_test.php
示例9: printSfiCalendar
function printSfiCalendar($userName, $pass, $ownerId, $baseUrl, $showDetail)
{
function calguid($str)
{
$charid = strtoupper(md5($str));
$hyphen = chr(45);
// "-"
$uuid = "" . substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12);
return $uuid;
}
function get_timezone_offset($remote_tz, $origin_tz = null)
{
if ($origin_tz === null) {
if (!is_string($origin_tz = date_default_timezone_get())) {
return false;
// A UTC timestamp was returned -- bail out!
}
}
$origin_dtz = new DateTimeZone($origin_tz);
$remote_dtz = new DateTimeZone($remote_tz);
$origin_dt = new DateTime("now", $origin_dtz);
$remote_dt = new DateTime("now", $remote_dtz);
$offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt);
return $offset;
}
function escapeText($s)
{
$v = str_replace("\r\n", "\n", $s);
$v = str_replace("\r", "\n", $s);
$v = str_replace("\t", " ", $v);
$v = str_replace("\v", " ", $v);
$v = str_replace("\\", "\\\\", $v);
$v = str_replace("\n", "\\n", $v);
$v = str_replace(";", "\\;", $v);
$v = str_replace(",", "\\,", $v);
return $v;
}
try {
$calGuid = calguid($userName . $ownerId);
$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR . '/enterprise.wsdl.xml');
$mylogin = $mySforceConnection->login($userName, $pass);
$nowDate = new DateTime();
$startDate = clone $nowDate;
$startDate = $startDate->sub(new DateInterval('P366D'));
$endDate = clone $nowDate;
$endDate = $endDate->add(new DateInterval('P400D'));
$query = 'SELECT Id, Name, TimeZoneSidKey from User where Id = \'' . $ownerId . '\'';
$users = $mySforceConnection->query($query);
if (count($users->records) == 0) {
header('HTTP/1.1 403 Forbidden');
echo 'no data';
exit;
}
$query = '
SELECT
Id
, Subject
, ActivityDateTime
, StartDateTime
, EndDateTime
, Location ' . ($showDetail ? ' , Description ' : '') . '
, IsAllDayEvent
, OwnerId
from Event
where
OwnerId = \'' . $ownerId . '\'
and StartDateTime >= ' . gmdate('Y-m-d\\TH:i:s\\Z', $startDate->getTimestamp()) . '
and StartDateTime < ' . gmdate('Y-m-d\\TH:i:s\\Z', $endDate->getTimestamp()) . '
order by StartDateTime limit 10000';
$response = $mySforceConnection->query($query);
header("Cache-Control: no-cache");
header('Content-type: text/plain; charset=utf-8');
//header('Content-Disposition: attachment; filename="' . $calGuid . '.ics"');
$tzoffset = get_timezone_offset('UTC', $users->records[0]->TimeZoneSidKey);
$tzoffset = (int) ($tzoffset / 3600) * 100 + (int) ($tzoffset / 60) % 60;
echo "BEGIN:VCALENDAR\r\n", "PRODID:My Cal\r\n", "VERSION:2.0\r\n", "METHOD:PUBLISH\r\n", "CALSCALE:GREGORIAN\r\n", "BEGIN:VTIMEZONE\r\n", "TZID:", $users->records[0]->TimeZoneSidKey, "\r\n", "BEGIN:STANDARD\r\n", "DTSTART:19700101T000000Z\r\n", "TZOFFSETFROM:", sprintf('%1$+05d', $tzoffset), "\r\n", "TZOFFSETTO:", sprintf('%1$+05d', $tzoffset), "\r\n", "END:STANDARD\r\n", "END:VTIMEZONE\r\n", "X-WR-CALNAME:", escapeText($users->records[0]->Name), "'s calendar\r\n", "X-WR-CALDESC:", escapeText($users->records[0]->Name), "'s calendar\r\n", "X-WR-RELCALID:", $calGuid, "\r\n", "X-WR-TIMEZONE:Asia/Tokyo\r\n";
foreach ($response->records as $record) {
$dateFmt = 'Ymd\\THis\\Z';
$timeAdd = 0;
if ($record->IsAllDayEvent) {
$dateFmt = 'Ymd';
$timeAdd = 3600 * 24;
}
echo "BEGIN:VEVENT\r\n", "UID:mycal/", $calGuid, "/", $record->Id, "\r\n", !$record->IsAllDayEvent ? "DTSTAMP:" . gmdate('Ymd\\THis\\Z', strtotime($record->StartDateTime)) . "\r\n" : '', "DTSTART:", gmdate($dateFmt, strtotime($record->StartDateTime)), "\r\n", "DTEND:", gmdate($dateFmt, strtotime($record->EndDateTime) + $timeAdd), "\r\n", "SUMMARY:", escapeText($record->Subject), "\r\n", "DESCRIPTION:", $baseUrl, "/", $record->Id, $showDetail && isset($record->Description) ? '\\n\\n' . escapeText($record->Description) : '', "\r\n", "LOCATION:", isset($record->Location) ? escapeText($record->Location) : '', "\r\n", "END:VEVENT\r\n";
}
echo "END:VCALENDAR\r\n";
} catch (Exception $e) {
echo $e;
exit;
}
}
开发者ID:sirokuma0402,项目名称:iCalForce,代码行数:92,代码来源:icalendar.inc.php
示例10: ADA_Error
* We are inside a tester
*/
$tester = $sess_selected_tester;
}
/*
* Find the appointment
*/
$msg_ha = MultiPort::getUserAppointment($userObj, $msg_id);
if (AMA_DataHandler::isError($msg_ha)) {
$errObj = new ADA_Error($msg_ha, translateFN('Errore durante la lettura di un evento'), NULL, NULL, NULL, 'comunica/list_events.php?status=' . urlencode(translateFN('Errore durante la lettura')));
}
/**
* Conversione Time Zone
*/
$tester_TimeZone = MultiPort::getTesterTimeZone($tester);
$offset = get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
$date_time = $msg_ha['data_ora'];
$date_time_zone = $date_time + $offset;
$zone = translateFN("Time zone:") . " " . $tester_TimeZone;
$Data_messaggio = AMA_DataHandler::ts_to_date($date_time_zone, "%d/%m/%Y - %H:%M:%S") . " " . $zone;
//$Data_messaggio = AMA_DataHandler::ts_to_date($msg_ha['data_ora'], "%d/%m/%Y - %H:%M:%S");
/*
* Check if the subject has an internal identifier and remove it
*/
$oggetto = ADAEventProposal::removeEventToken($msg_ha['titolo']);
$mittente = $msg_ha['mittente'];
$destinatario = str_replace(",", ", ", $msg_ha['destinatari']);
// $destinatario = $msg_ha['destinatari'];
$dest_encode = urlencode($mittente);
if (isset($message_text) && strlen($message_text) > 0) {
$testo = urlencode(trim($message_text));
开发者ID:eguicciardi,项目名称:ada,代码行数:31,代码来源:read_event.php
示例11: canProposeThisDateTime
/**
* Checks if an event can be proposed in the given date and time
*
* @param string $date
* @param string $time
* @return TRUE on success, a ADA error code on failure
*/
public static function canProposeThisDateTime(ADALoggableUser $userObj, $date, $time, $tester = NULL)
{
$date = DataValidator::validate_date_format($date);
if ($date === FALSE) {
return ADA_EVENT_PROPOSAL_ERROR_DATE_FORMAT;
} else {
$current_timestamp = time();
/**
* @var timezone management
*/
$offset = 0;
if ($tester === NULL) {
$tester_TimeZone = SERVER_TIMEZONE;
} else {
$tester_TimeZone = MultiPort::getTesterTimeZone($tester);
$offset = get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
}
$timestamp_time_zone = sumDateTimeFN(array($date, "{$time}:00"));
$timestamp = $timestamp_time_zone - $offset;
if ($current_timestamp >= $timestamp) {
return ADA_EVENT_PROPOSAL_ERROR_DATE_IN_THE_PAST;
}
if (MultiPort::hasThisUserAnAppointmentInThisDate($userObj, $timestamp)) {
return ADA_EVENT_PROPOSAL_ERROR_DATE_IN_USE;
}
}
return TRUE;
}
开发者ID:eguicciardi,项目名称:ada,代码行数:35,代码来源:ADAEventProposal.inc.php
示例12: test_statslib_temp_table_fill
/**
* Test the temporary table creation and deletion.
*
* @depends test_statslib_temp_table_create_and_drop
*/
public function test_statslib_temp_table_fill() {
global $CFG, $DB;
$dataset = $this->load_xml_data_file(__DIR__."/fixtures/statslib-test09.xml");
$this->prepare_db($dataset[0], array('log'));
$start = self::DAY - get_timezone_offset($CFG->timezone);
$end = $start + (24 * 3600);
stats_temp_table_create();
stats_temp_table_fill($start, $end);
$this->assertEquals(1, $DB->count_records('temp_log1'));
$this->assertEquals(1, $DB->count_records('temp_log2'));
stats_temp_table_drop();
}
开发者ID:Burick,项目名称:moodle,代码行数:23,代码来源:statslib_test.php
示例13: error_log
}
error_log("Modifying event. Data: " . var_export($_POST, true));
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
// check required fields
$validated = 1;
if (!isset($_POST["event_id"])) {
// do we have a title?
$validated = 0;
}
if ($validated == 1) {
$db = new \creamy\DbHandler();
// retrieve data for the event.
$eventid = $_POST["event_id"];
// calculate proper start and end date, including timezone offset
$offset = get_timezone_offset($db->getTimezoneSetting(), "UTC");
$startDate = null;
$endDate = null;
$allDay = null;
if (isset($_POST["start_date"])) {
$startDate = intval($_POST["start_date"]) / 1000 + intval($offset);
}
if (isset($_POST["end_date"])) {
$endDate = intval($_POST["end_date"] / 1000) + intval($offset);
}
if (isset($_POST["all_day"])) {
$allDay = filter_var($_POST["all_day"], FILTER_VALIDATE_BOOLEAN);
}
// modify event
$result = $db->modifyEvent($user->getUserId(), $eventid, $startDate, $endDate, $allDay);
// return result
开发者ID:kisorbiswal,项目名称:Creamy,代码行数:31,代码来源:ModifyEvent.php
示例14: display_messages_as_form
private static function display_messages_as_form($data_Ar = array(), $message_type = ADA_MSG_SIMPLE, $testers_dataAr = array())
{
$common_dh = $GLOBALS['common_dh'];
$javascript_ok = check_javascriptFN($_SERVER['HTTP_USER_AGENT']);
$appointments_Ar = array();
if ($message_type == ADA_MSG_SIMPLE) {
$list_module = 'list_messages.php';
$read_module = 'read_message.php';
$del_img = CDOMElement::create('img', 'src:img/delete.png, name:del_icon');
$del_img->setAttribute('alt', translateFN('Rimuovi il messaggio'));
$del_text = translateFN('Cancella');
} else {
$list_module = 'list_events.php';
$read_module = 'read_event.php';
$del_text = '';
}
$order_by_author_link = CDOMElement::create('a', "href:{$list_module}?sort_field=id_mittente");
$order_by_author_link->addChild(new CText(translateFN('Autore')));
$order_by_time_link = CDOMElement::create('a', "href:{$list_module}?sort_field=data_ora");
$order_by_time_link->addChild(new CText(translateFN('Data ed ora')));
$order_by_subject_link = CDOMElement::create('a', "href:{$list_module}?sort_field=titolo");
$order_by_subject_link->addChild(new CText(translateFN('Oggetto')));
$order_by_priority_link = CDOMElement::create('a', "href:{$list_module}?sort_field=priorita");
$order_by_priority_link->addChild(new CText(translateFN('Priorità')));
$thead_data = array($order_by_author_link, $order_by_time_link, $order_by_subject_link, $order_by_priority_link, $del_text, translateFN('Letto'), '');
foreach ($data_Ar as $tester => $appointment_data_Ar) {
//$udh = UserDataHandler::instance(self::getDSN($tester));
//$tester_info_Ar = $common_dh->get_tester_info_from_pointer($tester);
$tester_id = $testers_dataAr[$tester];
// if (AMA_Common_DataHandler::isError($tester_info_Ar)) {
// /*
// * Return a ADA_Error with delayed error handling.
// */
// return new ADA_Error($tester_info_Ar,translateFN('Errore in ottenimento informazioni tester'),
// NULL,NULL,NULL,NULL,TRUE);
// }
$tester_TimeZone = MultiPort::getTesterTimeZone($tester);
$offset = get_timezone_offset($tester_TimeZone, SERVER_TIMEZONE);
foreach ($appointment_data_Ar as $appointment_id => $appointment_Ar) {
// trasform message content into variable names
$sender_id = $appointment_Ar[0];
$date_time = $appointment_Ar[1];
//$subject = $appointment_Ar[2];
/*
* Check if the subject has an internal identifier and remove it.
*/
//$subject = preg_replace('/[0-9]+#/','',$appointment_Ar[2],1);
$subject = ADAEventProposal::removeEventToken($appointment_Ar[2]);
$priority = $appointment_Ar[3];
$read_timestamp = $appointment_Ar[4];
$date_time_zone = $date_time + $offset;
$zone = translateFN("Time zone:") . " " . $tester_TimeZone;
$data_msg = AMA_DataHandler::ts_to_date($date_time_zone, "%d/%m/%Y - %H:%M:%S") . " " . $zone;
// $data_msg = AMA_DataHandler::ts_to_date($date_time, "%d/%m/%Y - %H:%M:%S");
// transform sender's id into sender's name
// $res_ar = $udh->find_users_list(array("username"), "id_utente=$sender_id");
// if (AMA_DataHandler::isError($res_ar)) {
// $sender_username = '';
// }
// else {
// $sender_username = $res_ar[0][1];
// }
$sender_username = $appointment_Ar[6];
//$msg_id = $tester_info_Ar[0].'_'.$appointment_id;
$msg_id = $tester_id . '_' . $appointment_id;
$url = HTTP_ROOT_DIR . '/comunica/' . $read_module . '?msg_id=' . $msg_id;
$subject_link = CDOMElement::create('a', "href:{$url}");
$subject_link->addChild(new CText($subject));
/*
* If this is a list of simple messages, then deleting is allowed.
* Otherwise it is disabled.
*/
if ($message_type == ADA_MSG_SIMPLE) {
$delete = CDOMElement::create('checkbox', "name:form[del][{$msg_id}],value:{$msg_id}");
$action_link = CDOMElement::create('a', "href:{$list_module}?del_msg_id={$msg_id}");
$action_link->addChild($del_img);
} else {
$delete = '';
$delete_link = '';
// PROVA, POI RIMETTERE A POSTO
$userObj = $_SESSION['sess_userObj'];
/*
if($userObj instanceof ADAPractitioner) {
$event_token = ADAEventProposal::extractEventToken($appointment_Ar[2]);
$href = HTTP_ROOT_DIR . '/tutor/eguidance_tutor_form.php?event_token=' . $event_token;
$action_link = CDOMElement::create('a', "href:$href");
$action_link->addChild(new CText(translateFN('View eguidance session data')));
}
*
*/
}
$read = CDOMElement::create('checkbox', "name:form[read][{$msg_id}],value:{$msg_id}");
if ($read_timestamp != 0) {
$read->setAttribute('checked', 'checked');
}
if (!isset($action_link)) {
$action_link = null;
}
$appointments_Ar[] = array($sender_username, $data_msg, $subject_link, $priority, $delete, $read, $action_link);
}
//.........这里部分代码省略.........
开发者ID:eguicciardi,项目名称:ada,代码行数:101,代码来源:CommunicationModuleHtmlLib.inc.php
注:本文中的get_timezone_offset函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论