function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $this->set("list", biz_getShisetsuList()); //カレンダー表示用 require_once 'Calendar/Week.php'; $w = intval($_REQUEST['w']); if (empty($w)) { $w = 0; } $this->set('w', $w); $time = strtotime($w . " week"); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 0); $Week->build(); $calendar = array(); $dayofweek = array('日', '月', '火', '水', '木', '金', '土'); $i = 0; $schedule = array(); while ($Day = $Week->fetch()) { $y = sprintf("%02d", $Day->thisYear()); $m = sprintf("%02d", $Day->thisMonth()); $d = sprintf("%02d", $Day->thisDay()); $schedule = biz_getShisetsuSchedule($y, $m, $d); $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'schedule' => $schedule); if ($w == 0 && $d == date('d')) { $item['now'] = true; } $calendar[] = $item; } $list = biz_getShisetsuList(); $calendar = ''; foreach ($list as $key => $value) { $calendar .= biz_getScheduleWeek($u, $value['biz_shisetsu_id'], $requests['w'], 's_list', true, true, true); } $this->set('calendar', $calendar); $hours = biz_makeSerialArray(23); //時 $this->set("hours", $hours); $config = biz_getConfig(); $this->set('inc_navi', fetch_inc_navi('h')); $this->set('is_closed_shisetsu', $config['IS_CLOSED_SHISETSU']); return 'success'; }
private function getCalendar($w = 0, $community = null) { $old_error_level = error_reporting(); error_reporting($old_error_level & ~(E_STRICT | E_DEPRECATED)); include_once 'Calendar/Week.php'; $time = strtotime($w . ' week'); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 1); $Week->build(); $dayofweek = array('class' => array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'), 'item' => array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')); $calendar = array(); $i = 0; while ($Day = $Week->fetch()) { $y = $Day->thisYear(); $m = $Day->thisMonth(); $d = $Day->thisDay(); $item = array('year' => $y, 'month' => $m, 'day' => $d, 'today' => 0 === $w && (int) date('d') === $d, 'dayofweek_class_name' => $dayofweek['class'][$i], 'dayofweek_item_name' => $dayofweek['item'][$i], 'holidays' => Doctrine::getTable('Holiday')->getByYearAndMonthAndDay($y, $m, $d)); if (null === $community) { // member home or profile home calendar. $item['births'] = $this->isSelf ? opCalendarPluginExtension::getScheduleBirthMemberByTargetDay($m, $d) : array(); $item['events'] = $this->isSelf ? opCalendarPluginExtension::getMyCommunityEventByTargetDay($y, $m, $d) : array(); $item['schedules'] = Doctrine::getTable('Schedule')->getScheduleByThisDayAndMember($y, $m, $d, $this->member); } else { // community home calendar. $item['events'] = array(); $item['schedules'] = array(); if ('all' === $this->calendar_show_flag || 'only_community_event' === $this->calendar_show_flag) { // only open to all sns member schedule. $item['events'] = opCalendarPluginExtension::getMyCommunityEventByTargetDayInCommunity($community, $y, $m, $d); } if ('all' === $this->calendar_show_flag || 'only_member_schedule' === $this->calendar_show_flag) { // only open to all sns member schedule. $item['schedules'] = Doctrine::getTable('Schedule')->getScheduleByThisDayAndMemberInCommunity($community, $y, $m, $d, $this->member); } } $calendar[$i++] = $item; } error_reporting($old_error_level); return $calendar; }
public function getWeek() { require_once 'Calendar/Week.php'; $start_day = (int) PHPWS_Settings::get('calendar', 'starting_day'); $oWeek = new Calendar_Week($this->int_year, $this->int_month, $this->int_day, $start_day); $oWeek->build(); return $oWeek; }
function biz_getScheduleWeek($u, $member_id, $w, $cmd, $head = true, $value = true, $foot = true, $member_info = false, $start_day = 0) { $inc_smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']); $inc_smarty->assign("PHPSESSID", md5(session_id())); $inc_smarty->templates_dir = 'biz/templates'; $inc_smarty->assign("cmd", $cmd); //操作の対象ページ $inc_smarty->assign("target_id", $member_id); //予定参加者 require_once 'Calendar/Week.php'; $w = intval($w); if (empty($w)) { $w = 0; } $inc_smarty->assign('w', $w); $time = strtotime($w . " week"); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), $start_day); $Week->build(); $calendar = array(); $dayofweek = array('日', '月', '火', '水', '木', '金', '土'); $i = $start_day; $dayofweek = array_merge($dayofweek, array_slice($dayofweek, 0, $start_day + 1)); $schedule = array(); while ($Day = $Week->fetch()) { $y = sprintf("%02d", $Day->thisYear()); $m = sprintf("%02d", $Day->thisMonth()); $d = sprintf("%02d", $Day->thisDay()); $m_disp = sprintf("%2d", $Day->thisMonth()); $d_disp = sprintf("%2d", $Day->thisDay()); if ($cmd != 's_list') { $schedule = biz_getDateMemberSchedule($y, $m, $d, $member_id, $u); $banner = biz_isBannerSchedule($y, $m, $d, $member_id); if (!empty($banner)) { foreach ($banner as $value) { array_push($schedule, $value); } } } else { $schedule = biz_getShisetsuSchedule($y, $m, $d, $member_id); } $item = array('year' => $y, 'month' => $m, 'day' => $d, 'month_disp' => $m_disp, 'day_disp' => $d_disp, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'birth' => db_member_birth4c_member_id($m, $d, $member_id), 'event' => db_commu_event4c_member_id($y, $m, $d, $member_id), 'schedule' => $schedule, 'todo' => biz_schedule_todo4c_member_id($u, $member_id, $y, $m, $d), 'holiday' => db_c_holiday_list4date($m, $d)); if ($w == 0 && $d == date('d')) { $item['now'] = true; } $calendar[] = $item; } $daylist = $calendar; //コピー for ($i = 1; $i <= 2; $i++) { $j = $start_day; //曜日ポインタを示す $time = strtotime($w + $i . " week"); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), $start_day); $Week->build(); while ($Day = $Week->fetch()) { $y = sprintf("%02d", $Day->thisYear()); $m = sprintf("%02d", $Day->thisMonth()); $d = sprintf("%02d", $Day->thisDay()); $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$j++]); $daylist[] = $item; } } $inc_smarty->assign("daylist", $daylist); if ($cmd == 's_list') { $hours = biz_makeSerialArray(23); //時 $inc_smarty->assign("hours", $hours); $mins = biz_makeSerialArray(300, 30, 30); //分 $inc_smarty->assign("mins", $mins); $inc_smarty->assign("list", biz_getShisetsuData($member_id)); $config = biz_getConfig(); $inc_smarty->assign('is_closed_shisetsu', $config['IS_CLOSED_SHISETSU']); } $inc_smarty->assign('calendar', $calendar); $inc_smarty->assign('head', $head); $inc_smarty->assign('value', $value); $inc_smarty->assign('foot', $foot); if ($member_info) { $inc_smarty->assign('member_info', $member_info); } if ($cmd == 'h') { if (OPENPNE_USE_POINT_RANK) { // ポイント $point = db_point_get_point($member_id); $inc_smarty->assign("point", $point); // ランク $inc_smarty->assign("rank", db_point_get_rank4point($point)); } } $content = $inc_smarty->fetch('file:' . OPENPNE_MODULES_BIZ_DIR . '/biz/templates/inc_biz_schedule_week.tpl'); return $content; }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $this->set('tail', $GLOBALS['KTAI_URL_TAIL']); $c_member_secure = db_member_c_member_secure4c_member_id($u); $prof_id = $requests['prof_id']; $w = $requests['w']; if (empty($requests['target_id']) || $requests['target_id'] == $u) { //自分自身 $target_id = $u; $this->set('is_h', true); //判別フラグ } else { //他人 $target_id = $requests['target_id']; $this->set('is_f', true); //判別フラグ } require_once 'Calendar/Week.php'; $w = intval($requests['w']); if (empty($w)) { $w = 0; } $this->set('w', $w); $time = strtotime($w . " week"); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 0); $Week->build(); $calendar = array(); $schedule = array(); $dayofweek = array('日', '月', '火', '水', '木', '金', '土'); $i = 0; $n = 0; while ($Day = $Week->fetch()) { $y = sprintf("%02d", $Day->thisYear()); $m = sprintf("%02d", $Day->thisMonth()); $d = sprintf("%02d", $Day->thisDay()); $m_disp = sprintf("%2d", $Day->thisMonth()); if ($i == 0) { $this->set("y_disp", $y); $this->set("m_disp", $m_disp); } //イベント $event_list = db_commu_event4c_member_id($y, $m, $d, $target_id); // 誕生日 $birth_list = db_schedule_birth4c_member_id($m, $target_id); //スケジュール $schedule = biz_getDateMemberSchedule($y, $m, $d, $target_id, $u); $banner = biz_isBannerSchedule($y, $m, $d, $target_id); if (!empty($banner)) { foreach ($banner as $value) { array_push($schedule, $value); } } $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'event' => $event_list, 'birth' => $birth_list[intval($d)], 'schedule' => $schedule); if ($w == 0 && $d == date('d')) { $item['now'] = true; } $calendar[] = $item; } $this->set("calendar", $calendar); $c_member = db_member_c_member4c_member_id($target_id); $this->set("pref_list", p_regist_prof_c_profile_pref_list4null()); $this->set("c_member", $c_member); $this->set("msg", $requests['msg']); return 'success'; }
function testNextWeekObject() { $testWeek = new Calendar_Week(2003, 10, 13); $Week = $this->cal->nextWeek('object'); $this->assertEqual($testWeek->getTimeStamp(), $Week->getTimeStamp()); }
/** * メンバー情報取得関連のfunction cacheを削除する */ function cache_drop_c_member($c_member_id) { $c_member_id = (int) $c_member_id; pne_cache_drop('db_friend_c_friend_id_list4c_member_id', $c_member_id, 9); //フレンドリスト pne_cache_drop('db_friend_c_friend_list_random4c_member_id', $c_member_id, 5); pne_cache_drop('p_h_home_c_diary_friend_list4c_member_id', $c_member_id, 5); //最新日記フィード pne_cache_drop('db_rss_list_friend_c_rss_cache_list', $c_member_id, 5); pne_cache_drop('db_rss_list_friend_c_rss_cache_list', $c_member_id, 20); $c_member_id = (string) $c_member_id; pne_cache_drop('db_friend_c_friend_id_list4c_member_id', $c_member_id, 9); //フレンドリスト pne_cache_drop('db_friend_c_friend_list_random4c_member_id', $c_member_id, 5); pne_cache_drop('p_h_home_c_diary_friend_list4c_member_id', $c_member_id, 5); //最新日記フィード pne_cache_drop('db_rss_list_friend_c_rss_cache_list', $c_member_id, 5); pne_cache_drop('db_rss_list_friend_c_rss_cache_list', $c_member_id, 20); //誕生日フィード include_once 'Calendar/Week.php'; $Week = new Calendar_Week(date('Y'), date('m'), date('d'), 0); $Week->build(); while ($Day = $Week->fetch()) { $m = $Day->thisMonth(); $d = $Day->thisDay(); $c_member_id = (int) $c_member_id; pne_cache_drop('db_member_birth4c_member_id', $m, $d, $c_member_id); $c_member_id = (string) $c_member_id; pne_cache_drop('db_member_birth4c_member_id', $m, $d, $c_member_id); } cache_drop_c_friend_intro($c_member_id); //紹介文 }
$start = getmicrotime(); if (!@(include 'Calendar/Calendar.php')) { define('CALENDAR_ROOT', '../../'); } require_once CALENDAR_ROOT . 'Week.php'; if (!isset($_GET['y'])) { $_GET['y'] = date('Y'); } if (!isset($_GET['m'])) { $_GET['m'] = date('m'); } if (!isset($_GET['d'])) { $_GET['d'] = 1; } // Build the month $Week = new Calendar_Week($_GET['y'], $_GET['m'], $_GET['d']); /* $Validator = $Week->getValidator(); if (!$Validator->isValidWeek()) { die ('Please enter a valid week!'); } */ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> Paging Weeks </title> </head> <body> <h1>Paging Weeks</h1> <h2>Week: <?php
function get_calendar($u, $week, $start_day) { include_once 'Calendar/Week.php'; $w = intval($week); if (empty($w)) { $w = 0; } $this->set('w', $w); $time = strtotime($w . ' week'); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), $start_day); $Week->build(); $calendar = array(); $dayofweek = array('日', '月', '火', '水', '木', '金', '土'); $i = $start_day; $dayofweek = array_merge($dayofweek, array_slice($dayofweek, 0, $start_day + 1)); while ($Day = $Week->fetch()) { $y = $Day->thisYear(); $m = $Day->thisMonth(); $d = $Day->thisDay(); $birth = db_member_birth4c_member_id($m, $d, $u); $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'birth' => $birth, 'event' => db_commu_event4c_member_id($y, $m, $d, $u), 'schedule' => db_schedule_c_schedule_list4date($y, $m, $d, $u), 'holiday' => db_c_holiday_list4date($m, $d)); if ($w == 0 && $d == date('d')) { $item['now'] = true; } $calendar[] = $item; } return $calendar; }
if (!$event['event_isrecur']) { $eventsArray[] = $event; } else { $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startWeek, $endWeek); foreach ($recurEvents as $recurEvent) { $eventsArray[] = $recurEvent; } } } // Formating date $eventHandler->formatEventsDate($eventsArray, $xoopsModuleConfig['event_date_week']); // Assigning events to the template $xoopsTpl->assign('events', $eventsArray); // Retriving categories $cats = $catHandler->objectToArray($catHandler->getAllCat($xoopsUser)); // Assigning categories to the template $xoopsTpl->assign('cats', $cats); // Making navig data $weekCalObj = new Calendar_Week($year, $month, $day); $pWeekCalObj = $weekCalObj->prevWeek('object'); $nWeekCalObj = $weekCalObj->nextWeek('object'); $navig = array('prev' => array('uri' => 'year=' . $pWeekCalObj->thisYear() . '&month=' . $pWeekCalObj->thisMonth() . '&day=' . $pWeekCalObj->thisDay(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_week'], $pWeekCalObj->getTimestamp())), 'this' => array('uri' => 'year=' . $weekCalObj->thisYear() . '&month=' . $weekCalObj->thisMonth() . '&day=' . $weekCalObj->thisDay(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_week'], $weekCalObj->getTimestamp())), 'next' => array('uri' => 'year=' . $nWeekCalObj->thisYear() . '&month=' . $nWeekCalObj->thisMonth() . '&day=' . $nWeekCalObj->thisDay(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_week'], $nWeekCalObj->getTimestamp()))); // Assigning navig data to the template $xoopsTpl->assign('navig', $navig); // Assigning current form navig data to the template $xoopsTpl->assign('selectedCat', $cat); $xoopsTpl->assign('year', $year); $xoopsTpl->assign('month', $month); $xoopsTpl->assign('day', $day); $xoopsTpl->assign('view', "week"); include XOOPS_ROOT_PATH . '/footer.php';