function dt_list_member_reservations() { if (!empty($_REQUEST['id'])) { $mid = $_REQUEST['id']; $start = $_REQUEST['start']; $end = $_REQUEST['end']; $result = array('events' => array(), 'freebusys' => array()); # To generate events global $wpdb; $q = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '_dt_reservation_mid_{$mid}%' ORDER BY option_id ASC"; $rows = $wpdb->get_results($q); if ($rows) { foreach ($rows as $row) { $result['events'][] = get_option($row->option_name); } } # To generate freebusys $timer = get_post_meta($mid, "_timer", true); $timer = is_array($timer) ? $timer : array(); $days = array(); foreach (array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday') as $day) { if (!empty($timer["{$day}_start"])) { $days[$day] = array('start' => $timer["{$day}_start"], 'end' => $timer["{$day}_end"]); } } $working_days = dates_range($start, $end, array_keys($days)); foreach ($working_days as $working_day) { $date = date_i18n('Y-m-d', strtotime($working_day)); $wdate = new DateTime($date); $day = strtolower($wdate->format('l')); $s = new DateTime($date . ' ' . $timer["{$day}_start"]); $s = $s->format('m/d/Y H:i'); $e = new DateTime($date . ' ' . $timer["{$day}_end"]); $e = $e->format('m/d/Y H:i'); $result['freebusys'][] = array("start" => $s, "end" => $e, "free" => true); } echo json_encode($result); } die(''); }
<?php include_once "header.php"; $dates = dates_range($_POST['start'], $_POST['end']); $myts =& MyTextSanitizer::getInstance(); $sitename = $myts->addSlashes($xoopsConfig['sitename']); $page_title = "{$sitename} {$_POST['start']}~{$_POST['end']}" . _MD_TADCAL_SIMPLE_CAL; $filename = str_replace(" ", "", $page_title); require_once XOOPS_ROOT_PATH . "/modules/tadtools/PHPWord.php"; $PHPWord = new PHPWord(); $PHPWord->setDefaultFontSize(9); //設定預設字型大小 $sectionStyle = array('orientation' => 'portrait', 'marginTop' => 900, 'marginLeft' => 900, 'marginRight' => 900, 'marginBottom' => 900); $cw = array(_MD_TADCAL_SU, _MD_TADCAL_MO, _MD_TADCAL_TU, _MD_TADCAL_WE, _MD_TADCAL_TH, _MD_TADCAL_FR, _MD_TADCAL_SA); $section = $PHPWord->createSection($sectionStyle); $fontStyle = array('color' => '000000', 'size' => 16, 'bold' => true); $PHPWord->addTitleStyle(1, $fontStyle); $section->addTitle($page_title, 1); $contentfontStyle = array('color' => '000000', 'size' => 9, 'bold' => false); $styleTable = array('borderColor' => '000000', 'borderSize' => 6, 'cellMargin' => 50); $styleFirstRow = array('bgColor' => 'CFCFCF'); //首行樣式 $PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow); //建立表格樣式 $table = $section->addTable('myTable'); //建立表格 $cellStyle = array('valign' => 'center'); //儲存格樣式(設定項:valign、textDirection、bgColor、borderTopSize、borderTopColor、borderLeftSize、borderLeftColor、borderRightSize、borderRightColor、borderBottomSize、borderBottomColor) $paraStyle = array('align' => 'center'); $headStyle = array('bold' => true); //取得目前使用者可讀的群組