<?php global $modx; $firstmonth = abs($this->bloxconfig['month']); $year = $this->bloxconfig['year']; $timestampfirstday = xetadodb_mktime(0, 0, 0, $firstmonth, 01, $year); $cal = $this->xettcal->getMonthDays($year, $firstmonth); //print_r($cal); $timestampday = xetadodb_strftime("%d", $this->bloxconfig['nowtimestamp']); $timestampmonth = xetadodb_strftime("%m", $this->bloxconfig['nowtimestamp']); $timestampyear = xetadodb_strftime("%Y", $this->bloxconfig['nowtimestamp']); $monthlist = array(); for ($monthcount = 1; $monthcount <= 12; $monthcount++) { $monthlist[$monthcount]['tsmonth'] = xetadodb_mktime(0, 0, 0, $timestampmonth + $monthcount - 1, 01, $timestampyear); } //Caching for template monthTpl $cachename = 'month_' . $year . '_' . $this->bloxconfig['month'] . '_' . $this->bloxconfig['canedit'] . '.cache.php'; if (($cacheoutput = $this->cache->readCache($cachename)) === false) { $cacheaction = '1'; //render new and save cachefile } else { $cacheaction = '2'; //use cached output } if ($cacheaction !== '2') { $roomsparent = $this->bloxconfig['custom']['docids']['rooms']; // Wohnungen suchen $tablename1 = $modx->getFullTableName('site_content') . ' sc'; $query = "select sc.id as room_ID,sc.pagetitle as room_title"; $query .= " from " . $tablename1; $query .= " where parent= " . $roomsparent;
$doc->Set('cacheable', '0'); $doc->Set('hidemenu', '1'); $doc->Set('published', $row['`published`']); $doc->Set('isfolder', '0'); $doc->Set('createdby', $createdby); $doc->Set('tvEasyEvents_HideTime', $row['`hide_time`']); $doc->Set('tvEasyEvents_Start', xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Time`'])); $doc->Set('tvEasyEvents_End', xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Timeend`'])); $doc->Save(); $parent = $doc->fields['id']; $tsmonth = xetadodb_mktime(0, 0, 0, xetadodb_strftime("%m", $row['`Time`']), 01, xetadodb_strftime("%Y", $row['`Time`'])); $monthend = xetadodb_mktime(0, 0, 0, xetadodb_strftime("%m", $row['`Timeend`']), 01, xetadodb_strftime("%Y", $row['`Timeend`'])); $oldtsmonth = xetadodb_mktime(0, 0, 0, xetadodb_strftime("%m", $_POST['oldTime']), 01, xetadodb_strftime("%Y", $_POST['oldTime'])); $oldmonthend = xetadodb_mktime(0, 0, 0, xetadodb_strftime("%m", $_POST['oldTimeend']), 01, xetadodb_strftime("%Y", $_POST['oldTimeend'])); if (isset($_POST['oldTime'])) { $tsmonth = $oldtsmonth < $tsmonth ? $oldtsmonth : $tsmonth; $monthend = $oldmonthend > $monthend ? $oldmonthend : $monthend; } $i = 1; while ($tsmonth <= $monthend) { $month = xetadodb_strftime("%m", $tsmonth); $year = xetadodb_strftime("%Y", $tsmonth); $cachename = 'month_' . $year . '_' . $month . '_1.cache.php'; $this->cache->deleteCache($cachename); $cachename = 'month_' . $year . '_' . $month . '_.cache.php'; $this->cache->deleteCache($cachename); $tsmonth = xetadodb_mktime(0, 0, 0, xetadodb_strftime("%m", $row['`Time`']) + $i, 01, xetadodb_strftime("%Y", $row['`Time`'])); $i++; } } $this->messages[] = $message;
<?php $timestampstart = $this->xettcal->get_ts_daystart($row['tsday']); $timestampend = $this->xettcal->get_ts_dayend($row['tsday']); $startDate = xetadodb_strftime("%Y-%m-%d", $timestampstart); $endDate = xetadodb_strftime("%Y-%m-%d", $timestampend); $contentFields = 'id,pagetitle,description'; $limit = 0; // Include Easy Events class and instantiate object include_once $modx->config['base_path'] . 'assets/snippets/EasyEvents/EasyEvents.class.php'; $ee = new EasyEvents($row['room_ID']); $easyevents = $ee->getEvents($startDate, $endDate, $contentFields, $limit); $events = array(); if (count($easyevents) > 0) { foreach ($easyevents as $event) { $eedate = $ee->getDateFromTV($event['startDate']); $eetime = $ee->getTimeFromTV($event['startDate']); $arrdate = explode('-', $eedate); $arrtime = explode(':', $eetime); $event['Time'] = xetadodb_mktime($arrtime[0], $arrtime[1], $arrtime[2], $arrdate[1], $arrdate[2], $arrdate[0]); $eedate = $ee->getDateFromTV($event['endDate']); $eetime = $ee->getTimeFromTV($event['endDate']); $arrdate = explode('-', $eedate); $arrtime = explode(':', $eetime); $event['Timeend'] = xetadodb_mktime($arrtime[0], $arrtime[1], $arrtime[2], $arrdate[1], $arrdate[2], $arrdate[0]); //array_push($events, $event); $events[] = $event; } } $xettdatas = $events[0]; $xettdatas['groupeventscount'] = count($easyevents);
function makeevents() { $rows = $this->getformfields(); foreach ($rows as $row) { if ($this->xetconfig['lasthour'] == '' || $this->xetconfig['lastminute'] == '') { $this->xetconfig['lasthour'] = $this->xetconfig['starthour']; $this->xetconfig['lastminute'] = $this->xetconfig['startminute']; } if ($this->xetconfig['lastday'] == '' || $this->xetconfig['lastmonth'] == '' || $this->xetconfig['lastyear'] == '') { $this->xetconfig['lastday'] = $this->xetconfig['startday']; $this->xetconfig['lastmonth'] = $this->xetconfig['startmonth']; $this->xetconfig['lastyear'] = $this->xetconfig['startyear']; } $starttimestamp = $row['`Time`']; if (isset($_POST['lastdate']) || isset($_POST['lasttime'])) { $dateformatarr = explode(',', $this->xetconfig['date_format']); $datearr = explode($this->xetconfig['date_divider'], $_POST['lastdate']); $key = array_search('d', $dateformatarr); $this->xetconfig['lastday'] = $datearr[$key]; $key = array_search('m', $dateformatarr); $this->xetconfig['lastmonth'] = $datearr[$key]; $key = array_search('y', $dateformatarr); $this->xetconfig['lastyear'] = $datearr[$key]; $timearr = explode(':', $_POST['lasttime']); $this->xetconfig['lasthour'] = $timearr[0]; $this->xetconfig['lastminute'] = $timearr[1]; } $lasttimestamp = xetadodb_mktime($this->xetconfig['lasthour'], $this->xetconfig['lastminute'], 0, $this->xetconfig['lastmonth'], $this->xetconfig['lastday'], $this->xetconfig['lastyear']); $adddays = 0; $thetime = $starttimestamp; $theDate = $thetime; while ($thetime <= $lasttimestamp) { $theday = xetadodb_strftime("%d", $theDate); $theyear = xetadodb_strftime("%Y", $theDate); $themonth = xetadodb_strftime("%m", $theDate); $lasttime = xetadodb_mktime($this->xetconfig['lasthour'], $this->xetconfig['lastminute'], 0, $themonth, $theday, $theyear); $i = 0; $thetime = $theDate; while ($thetime <= $lasttime) { $Time = $thetime; $fields = $row; $fields['`Time`'] = $Time; if (isset($_POST['lenminutes']) || isset($_POST['lenhours']) || isset($_POST['lendays'])) { $datelen = $_POST['lenminutes'] * 60 + $_POST['lenhours'] * 3600 + $_POST['lendays'] * 86400; $fields['`Timeend`'] = $Time + $datelen; } else { $fields['`Timeend`'] = $row['`Timeend`']; } $this->dbinsert($fields); $i++; if (isset($_POST['shiftminutes']) || isset($_POST['shifthours']) || isset($_POST['shiftdays'])) { $timeshift = $_POST['shiftminutes'] * 60 + $_POST['shifthours'] * 3600 + $_POST['shiftdays'] * 86400; } else { $timeshift = $this->xetconfig['timeshift']; } $addtime = $i * $timeshift; $thetime = $theDate + $addtime; } $adddays++; $theDate = $starttimestamp + $adddays * 86400; } } return; }
$bloxconfig['tplpath'] = isset($tpl_path) ? $bloxconfig['projectpath'] . "templates/" . $tpl_path : ''; $bloxconfig['tplpath'] = $bloxconfig['tplpath'] == '' ? $bloxconfig['projectpath'] . $bloxconfig['task'] . "/templates" : $bloxconfig['tplpath']; //echo $bloxconfig['tplpath']; $bloxconfig['includespath'] = isset($includes_path) ? $bloxconfig['projectpath'] . $includes_path : ''; $bloxconfig['includespath'] = $bloxconfig['includespath'] == '' ? $bloxconfig['projectpath'] . $bloxconfig['task'] . "/includes" : $bloxconfig['includespath']; //$xetconfig['cachepath']=(isset($cache_path))?$xetconfig['projectpath'].$cache_path:''; //$xetconfig['cachepath']=($xetconfig['cachepath']=='')?$xetconfig['projectpath'].$xetconfig['task']."/cache":$xetconfig['cachepath']; $bloxconfig['cachepath'] = $bloxconfig['path'] . 'cache'; $bloxconfig['includesfile'] = $bloxconfig['includespath'] . "/getdatas.php"; // [ file ] $bloxconfig['onsavefile'] = $bloxconfig['includespath'] . "/onsavedatas.php"; // [ file ] $timestamp = time(); $timestampday = xetadodb_strftime("%d", $timestamp); $timestampmonth = xetadodb_strftime("%m", $timestamp); $timestampyear = xetadodb_strftime("%Y", $timestamp); $bloxconfig['nowtimestamp'] = $timestamp; $bloxconfig['day'] = isset($day) ? $day : $timestampday; $bloxconfig['day'] = isset($_REQUEST['day']) && trim($_REQUEST['day'] !== '') ? $_REQUEST['day'] : $bloxconfig['day']; //$bloxconfig['month']=(isset($month))?$month:$bloxconfig['months'][0]; $bloxconfig['month'] = isset($month) ? $month : $timestampmonth; $bloxconfig['month'] = isset($_REQUEST['month']) && trim($_REQUEST['month'] !== '') ? $_REQUEST['month'] : $bloxconfig['month']; $bloxconfig['year'] = isset($year) ? $year : $timestampyear; $bloxconfig['year'] = isset($_REQUEST['year']) && trim($_REQUEST['year'] !== '') ? $_REQUEST['year'] : $bloxconfig['year']; $bloxconfig['processpost'] = isset($processpost) ? $processpost : '1'; $bloxconfig['custom'] = isset($custom) ? $custom : array(); $bloxconfig['permissions'] = isset($permissions) ? $permissions : array(); $bloxconfig['path'] = $bloxpath; // [ path ] $bloxconfig['userID'] = $modx->getLoginUserID(); //$bloxtpl['bloxouterTpl']= (isset($bloxouterTpl)) ? $bloxouterTpl : "@FILE:".$bloxconfig['tplpath']."/bloxouterTpl.html"; // [ path | chunkname | text ]
$query .= " and published = '1' "; $query .= " order by Time limit 1"; $rs = $modx->db->query($query); $events = $modx->db->makeArray($rs); if (count($events) > 0) { $tmpevent = $events[0]; $timestamp_high = $tmpevent['Time']; } $event['range_high'] = xetadodb_strftime("%Y-%m-%d", $timestamp_high); //////////////////////////// //find prev reservation //////////////////////////// $timestamp_low = $event['Time'] - 86400 * 30; $timestampend = $event['Time'] - 86400; $query = "select *"; $query .= " from " . $tablename; $query .= " where room_ID= " . $room_ID; $query .= " and Time <= '{$timestampend}' "; $query .= " and Timeend >= '{$timestamp_low}' "; $query .= " and published = '1' "; $query .= " order by Time DESC limit 1"; $rs = $modx->db->query($query); $events = $modx->db->makeArray($rs); if (count($events) > 0) { $tmpevent = $events[0]; $timestamp_low = $tmpevent['Timeend']; } $event['range_low'] = xetadodb_strftime("%Y-%m-%d", $timestamp_low); $xettdatas = $event; unset($easyevents); unset($tmpevent);
<?php $Xettpath = './' . XETT_PATH; require_once $Xettpath . 'document.class.inc.php'; $createdby = $modx->getLoginUserID(); $rows = $this->getformfields(); foreach ($rows as $row) { $doc = new Document($row['`docid`']); $doc->Set('parent', $row['`room_ID`']); $doc->Set('content', $row['`content`']); $doc->Set('description', $row['`description`']); $doc->Set('template', $this->xetconfig['docids']['eventtemplate']); $doc->Set('pagetitle', $row['`pagetitle`']); $doc->Set('longtitle', $row['`longtitle`']); $doc->Set('menutitle', $row['`menutitle`']); $doc->Set('cacheable', '0'); $doc->Set('hidemenu', '1'); $doc->Set('published', $row['`published`']); $doc->Set('isfolder', '0'); $doc->Set('createdby', $createdby); $doc->Set('tvEasyEvents_HideTime', $row['`hide_time`']); $doc->Set('tvEasyEvents_Start', xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Time`'])); $doc->Set('tvEasyEvents_End', xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Timeend`'])); $doc->Save(); $parent = $doc->fields['id']; //$output.='$docids'."['vcal_eventcal']='".$parent."';<br/>"; } //$savenormal='0';
function xetadodb_gmstrftime($fmt, $ts = false) { return xetadodb_strftime($fmt, $ts, true); }
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale %r - time in a.m. and p.m. notation %R - time in 24 hour notation %S - second as a decimal number %t - tab character %T - current time, equal to %H:%M:%S %x - preferred date representation for the current locale without the time %X - preferred time representation for the current locale without the date %y - year as a decimal number without a century (range 00 to 99) %Y - year as a decimal number including the century %Z - time zone or name or abbreviation %% - a literal `%' character */ $options = explode('||', $options); //path where adodb-time.inc.php is installed. $dateoptions = isset($options[0]) ? $options[0] : ''; $format = strlen($options[0]) > 0 ? $options[0] : '%A, %e. %B %Y'; if ($format == '') { return $output; } $adodbpath = isset($options[1]) ? $options[1] : "assets/snippets/Xett/"; $adodbFile = $modx->config['base_path'] . $adodbpath . 'adodb-time.inc.php'; $useadodbtime = '0'; if (file_exists($adodbFile)) { include_once $adodbFile; $useadodbtime = '1'; } $output = is_numeric($output) ? $output : time(); setlocale(LC_TIME, 'de_DE.UTF-8'); $date_ger = $useadodbtime == '1' ? xetadodb_strftime($format, 0 + $output) : strftime($format, 0 + $output); return $date_ger;