function pical_monthly_calendar_show($options)
 {
     global $xoopsConfig, $xoopsDB;
     $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
     // setting physical & virtual paths
     $mod_path = XOOPS_ROOT_PATH . "/modules/{$mydirname}";
     $mod_url = XOOPS_URL . "/modules/{$mydirname}";
     // defining class of piCal
     if (!class_exists('piCal_xoops')) {
         require_once "{$mod_path}/class/piCal.php";
         require_once "{$mod_path}/class/piCal_xoops.php";
     }
     // creating an instance of piCal
     $cal = new piCal_xoops("", $xoopsConfig['language'], true);
     // ignoring cid from GET
     $cal->now_cid = 0;
     // setting properties of piCal
     $cal->conn = $xoopsDB->conn;
     include "{$mod_path}/include/read_configs.php";
     $cal->base_url = $mod_url;
     $cal->base_path = $mod_path;
     $cal->images_url = "{$mod_url}/images/{$skin_folder}";
     $cal->images_path = "{$mod_path}/images/{$skin_folder}";
     $original_level = error_reporting(E_ALL ^ E_NOTICE);
     require_once "{$mod_path}/include/patTemplate.php";
     $tmpl = new PatTemplate();
     $tmpl->readTemplatesFromFile("{$cal->images_path}/block_monthly.tmpl.html");
     // setting skin folder
     $tmpl->addVar("WholeBoard", "SKINPATH", $cal->images_url);
     // setting language
     $tmpl->addVar("WholeBoard", "LANG_PREV_MONTH", _MB_PICAL_PREV_MONTH);
     $tmpl->addVar("WholeBoard", "LANG_NEXT_MONTH", _MB_PICAL_NEXT_MONTH);
     $tmpl->addVar("WholeBoard", "LANG_YEAR", _MB_PICAL_YEAR);
     $tmpl->addVar("WholeBoard", "LANG_MONTH", _MB_PICAL_MONTH);
     $tmpl->addVar("WholeBoard", "LANG_JUMP", _MB_PICAL_JUMP);
     // Static parameter for the request
     $tmpl->addVar("WholeBoard", "GET_TARGET", "{$mod_url}/index.php");
     $tmpl->addVar("WholeBoard", "QUERY_STRING", '');
     // Variables required in header part etc.
     $tmpl->addVars("WholeBoard", $cal->get_calendar_information('M'));
     // BODY of the calendar
     $tmpl->addVar("WholeBoard", "CALENDAR_BODY", $cal->get_monthly_html("{$mod_url}/index.php"));
     // legends of long events
     foreach ($cal->long_event_legends as $bit => $legend) {
         $tmpl->addVar("LongEventLegends", "BIT_MASK", 1 << $bit - 1);
         $tmpl->addVar("LongEventLegends", "LEGEND_ALT", _PICAL_MB_ALLDAY_EVENT . " {$bit}");
         $tmpl->addVar("LongEventLegends", "LEGEND", $legend);
         $tmpl->addVar("LongEventLegends", "SKINPATH", $cal->images_url);
         $tmpl->parseTemplate("LongEventLegends", "a");
     }
     // content generated from patTemplate
     $block['content'] = $tmpl->getParsedTemplate("WholeBoard");
     error_reporting($original_level);
     return $block;
 }
Esempio n. 2
0
 function get_monthly($get_target = '', $query_string = '', $for_print = false)
 {
     // $PHP_SELF = $_SERVER['SCRIPT_NAME'] ;
     // if( $get_target == '' ) $get_target = $PHP_SELF ;
     $original_level = error_reporting(E_ALL ^ E_NOTICE);
     require_once "{$this->base_path}/include/patTemplate.php";
     $tmpl = new PatTemplate();
     $tmpl->readTemplatesFromFile("{$this->images_path}/monthly.tmpl.html");
     // setting skin folder
     $tmpl->addVar("WholeBoard", "SKINPATH", $this->images_url);
     // Static parameter for the request
     $tmpl->addVar("WholeBoard", "GET_TARGET", $get_target);
     $tmpl->addVar("WholeBoard", "QUERY_STRING", $query_string);
     $tmpl->addVar("WholeBoard", "YEAR_MONTH_TITLE", sprintf(_PICAL_FMT_YEAR_MONTH, $this->year, $this->month_middle_names[$this->month]));
     $tmpl->addVar("WholeBoard", "PRINT_LINK", "{$this->base_url}/print.php?cid={$this->now_cid}&amp;smode=Monthly&amp;caldate={$this->caldate}");
     $tmpl->addVar("WholeBoard", "LANG_PRINT", _PICAL_BTN_PRINT);
     if ($for_print) {
         $tmpl->addVar("WholeBoard", "PRINT_ATTRIB", "width='0' height='0'");
     }
     // カテゴリー選択ボックス
     $tmpl->addVar("WholeBoard", "CATEGORIES_SELFORM", $this->get_categories_selform($get_target));
     $tmpl->addVar("WholeBoard", "CID", $this->now_cid);
     // Variables required in header part etc.
     $tmpl->addVars("WholeBoard", $this->get_calendar_information('M'));
     $tmpl->addVar("WholeBoard", "LANG_JUMP", _PICAL_BTN_JUMP);
     // BODY of the calendar
     $tmpl->addVar("WholeBoard", "CALENDAR_BODY", $this->get_monthly_html($get_target, $query_string));
     // legends of long events
     foreach ($this->long_event_legends as $bit => $legend) {
         $tmpl->addVar("LongEventLegends", "BIT_MASK", 1 << $bit - 1);
         $tmpl->addVar("LongEventLegends", "LEGEND_ALT", _PICAL_MB_ALLDAY_EVENT . " {$bit}");
         $tmpl->addVar("LongEventLegends", "LEGEND", $legend);
         $tmpl->addVar("LongEventLegends", "SKINPATH", $this->images_url);
         $tmpl->parseTemplate("LongEventLegends", "a");
     }
     // 先月・翌月のミニカレンダー
     // $this->caldate のバックアップ
     $backuped_caldate = $this->caldate;
     // 前月末の日付をセットし、前月のミニカレンダーをセット
     $this->set_date(date("Y-n-j", mktime(0, 0, 0, $this->month, 0, $this->year)));
     $tmpl->addVar("WholeBoard", "PREV_MINICAL", $this->get_mini_calendar_html($get_target, $query_string, "NO_NAVIGATE"));
     // 翌月始の日付をセットし、ミニカレンダーを表示
     $this->set_date(date("Y-n-j", mktime(0, 0, 0, $this->month + 2, 1, $this->year)));
     $tmpl->addVar("WholeBoard", "NEXT_MINICAL", $this->get_mini_calendar_html($get_target, $query_string, "NO_NAVIGATE"));
     // $this->caldate のリストア
     $this->set_date($backuped_caldate);
     // content generated from patTemplate
     $ret = $tmpl->getParsedTemplate("WholeBoard");
     error_reporting($original_level);
     return $ret;
 }