本文整理汇总了PHP中Calendar类的典型用法代码示例。如果您正苦于以下问题:PHP Calendar类的具体用法?PHP Calendar怎么用?PHP Calendar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Calendar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetInputField
function GetInputField($paramDTO)
{
$calendar = new Calendar();
switch ($paramDTO->tipoParametro) {
// case 1 INTEIRO - input simples, cai no caso default
// case 2 STRING - input simples, cai no caso default
case 3:
$properties = 'style="width:50%;"';
// DATETIME - cria um datetime picker
return '<input ' . $properties . ' class="datepick" type="text" readonly="readonly" name="parametro' . $paramDTO->id . '" value="' . $paramDTO->valor . '" />';
case 4:
$properties = 'style="width:50%;"';
// BOOLEAN - cria um combobox com opções sim e não
$trueSelected = $paramDTO->valor == 'true' ? 'selected="selected"' : '';
$falseSelected = $paramDTO->valor == 'false' ? 'selected="selected"' : '';
return '<select ' . $properties . ' name="parametro' . $paramDTO->id . '" ><option ' . $trueSelected . ' value="true" >Sim</option><option ' . $falseSelected . ' value="false" >Não</option></select>';
case 5:
$properties = 'style="width:50%;"';
// MÊS - cria um combobox com os meses
return '<select ' . $properties . ' name="parametro' . $paramDTO->id . '" >' . $calendar->GetMonthOptions($paramDTO->valor) . '</select>';
default:
$properties = 'style="width:50%;"';
return '<input ' . $properties . ' type="text" name="parametro' . $paramDTO->id . '" value="' . $paramDTO->valor . '" />';
}
}
示例2: calendar
/**
* возвращает календарь. хтмл.
*/
public function calendar()
{
$this->__loadLib("calendar.php");
$this->__implement("calendar");
$year = getRequest('year') ? (int) getRequest('year') : date('Y');
$month = getRequest('month') ? (int) getRequest('month') : date('m');
$calendar = new Calendar();
$lang_id = cmsController::getInstance()->getCurrentLang()->getId();
$lang = langsCollection::getInstance()->getLang($lang_id);
if ($lang->getPrefix() == "ru")
{
$calendar->setMonthNames(array("Январь", "Февраль", "Март", "Апрель", "Май", "Июнь",
"Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"));
$calendar->setDayNames(array("Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"));
$calendar->setStartDay(1);
}
$result = $calendar->getMonthView($month, $year);
return $result;
}
示例3: action_index
public function action_index()
{
$calendar = new Calendar(Arr::get($_GET, 'month', date('m')), Arr::get($_GET, 'year', date('Y')));
$calendar->attach($calendar->event()->condition('timestamp', time())->output(html::anchor('http://google.de', 'google')));
$data = array('content' => $calendar->render());
$this->request->response = new View('index', $data);
}
示例4: absensi
public function absensi()
{
//ambil tahun ajaran utk absensinya
$ta = TahunAjaran::ta();
/*
* Ambil kelas yang mau dicari absensinya
*/
$id = isset($_GET['klsid']) ? addslashes($_GET['klsid']) : Kelas::getFirstKelasID();
$kls = new Kelas();
$kls->getByID($id);
//amnbil murid dikelas
$murid = new Murid();
$arrOfMurid = $murid->getMuridDiKelas($kls, $ta);
if (count($arrOfMurid) < 1) {
die('Murid Belum ada yang dikelas ini');
}
//di get set bulan dantahun di getAbsensi
$absensi = new Absensi();
$return = $absensi->getAbsensi($arrOfMurid);
//ambil kejadian dlm bulan
$cal = new Calendar();
$return['calendar'] = $cal->getCalinMonth(Absensi::getBulan());
//pr($arrOfMurid);
//ambil absensi untuk kelas
//pr($kls);
$return['webClass'] = __CLASS__;
$return['method'] = __FUNCTION__;
$return['ta'] = $ta;
$return['kls'] = $kls;
Mold::both("studentsetup/absensi", $return);
}
示例5: print_calendars
/**
* Prints out the navigational calendars
* @param Calendar $prev previous month calendar
* @param Calendar $next next month calendar
* @param Calendar $curr current month calendar
*/
function print_calendars(&$prev, &$next, &$curr)
{
?>
<!-- Start calendars -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><?php
$prev->printCalendar();
?>
</td>
<?php
if ($curr != null) {
echo '<td align="center" valign="top">';
$curr->printCalendar();
echo '</td>';
}
?>
<td align="center" valign="top"><?php
$next->printCalendar();
?>
</td>
</tr>
</table>
<!-- End calendars -->
<?php
}
示例6: indexAction
/** Index page showing calendrical interface to dates of recording
*/
public function indexAction()
{
$date = $this->_getParam('date') ? $this->_getParam('date') : $this->getTimeForForms();
$this->view->years = $this->years();
$calendar = new Calendar($date);
$cases = new Finds();
$cases = $cases->getFindsByDay();
$lists = array();
foreach ($cases as $value) {
$lists[] = $value['createdOn'];
}
$caseslisted = $lists;
$calendar->highlighted_dates = $caseslisted;
$calendar->formatted_link_to = $this->view->baseUrl() . '/database/search/results/created/%Y-%m-%d';
print '<div id="calendar">';
print "<ul id=\"year\">\n";
for ($i = 1; $i <= 12; $i++) {
print "<li>";
if ($i == $calendar->month) {
print $calendar->output_calendar();
} else {
print $calendar->output_calendar($calendar->year, $i);
}
print "</li>\n";
}
print "</ul></div>";
}
示例7: create
public function create($data)
{
// setting defaults
$data['PRO_UID'] = array_key_exists('PRO_UID', $data) ? $data['PRO_UID'] : Common::generateUID();
$data['USR_UID'] = array_key_exists('PRO_CREATE_USER', $data) ? $data['PRO_CREATE_USER'] : null;
$data['PRO_TITLE'] = array_key_exists('PRO_TITLE', $data) ? trim($data['PRO_TITLE']) : "";
$data['PRO_CATEGORY'] = array_key_exists('PRO_CATEGORY', $data) ? $data['PRO_CATEGORY'] : "";
try {
self::log("Create Process with data:", $data);
//validate if process with specified name already exists
if (Process::existsByProTitle($data["PRO_TITLE"])) {
throw new Exception\ProjectAlreadyExists($this, $data["PRO_TITLE"]);
}
// Create project
$process = new Process();
$this->proUid = $process->create($data, false);
// Call Plugins
$pluginData['PRO_UID'] = $this->proUid;
$pluginData['PRO_TEMPLATE'] = empty($data["PRO_TEMPLATE"]) ? "" : $data["PRO_TEMPLATE"];
$pluginData['PROCESSMAP'] = null;
$pluginRegistry = \PMPluginRegistry::getSingleton();
$pluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $pluginData);
// Save Calendar ID for this process
if (!empty($data["PRO_CALENDAR"])) {
//G::LoadClass( "calendar" );
$calendar = new \Calendar();
$calendar->assignCalendarTo($this->proUid, $data["PRO_CALENDAR"], 'PROCESS');
}
self::log("Create Process Success!");
} catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e;
}
}
示例8: getcalendar
protected function getcalendar()
{
global $user;
global $objPDO;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin() == true || $student->checkTeacher() || $student->checkStudent()) {
$role = $student->getacctType();
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/calendar_class.php';
$calendar = new Calendar();
$month = $calendar->getmonth();
$year = $calendar->getyear();
if (isset($_GET['uid']) && isset($_GET['ref'])) {
$month = $_GET['uid'];
$year = $_GET['ref'];
$calendar->setmonth($month);
$calendar->setyear($year);
}
$calendar->create();
$week = $calendar->getweek();
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/events_class.php';
$event = new Events($objPDO);
$datePattern = "-" . $calendar->getmonth() . "-" . $calendar->getyear();
$events_array = $event->getByDateLike($datePattern);
$day_events = array();
foreach ($events_array as $key => $value) {
$day_events[$value['date']][] = $key;
}
$events_type = array('1' => 'holiday.png', '2' => 'fees.png', '3' => 'function.png', '4' => 'test.png');
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/events_calendar.php';
} else {
header('Location:http://localhost/cloud');
}
}
示例9: month
private function month($page_name, $tool_id, $date)
{
valid::id_key($tool_id);
if (empty($date)) {
$year = date('Y');
$month = date('m');
} else {
$date = explode('-', $date);
# strictly need the formated date, else throw page not found.
if (1 > count($date) or count($date) > 3) {
Event::run('system.404');
}
list($year, $month) = $date;
valid::year($year);
valid::month($month);
}
$date_array = array();
$dates = ORM::factory('calendar_item')->where(array('fk_site' => $this->site_id, 'calendar_id' => $tool_id, 'year' => $year, 'month' => $month))->find_all();
/*
* Create an array with key/value pairs = day/number of events on day
* This lets the calendar know which dates to show links for.
*/
for ($x = 0; $x <= 31; ++$x) {
$date_array[$x] = 0;
}
foreach ($dates as $date) {
(int) ++$date_array[$date->day];
}
$calendar = new Calendar();
return $calendar->getPhpAjaxCalendar($page_name, $month, $year, $date_array, 'day_function');
}
示例10: display
function display()
{
ob_start();
if (isset($GLOBALS['cal_strings'])) {
return parent::display() . "Only one Calendar dashlet is allowed.";
}
require_once 'modules/Calendar/Calendar.php';
require_once 'modules/Calendar/CalendarDisplay.php';
require_once "modules/Calendar/CalendarGrid.php";
global $cal_strings, $current_language;
$cal_strings = return_module_language($current_language, 'Calendar');
if (!ACLController::checkAccess('Calendar', 'list', true)) {
ACLController::displayNoAccess(true);
}
$cal = new Calendar($this->view);
$cal->dashlet = true;
$cal->add_activities($GLOBALS['current_user']);
$cal->load_activities();
$display = new CalendarDisplay($cal, $this->id);
$display->display_calendar_header(false);
$display->display();
$str = ob_get_contents();
ob_end_clean();
return parent::display() . $str;
}
示例11: home
private function home()
{
if (!eval(Hooks::get('HOME'))) {
return;
}
NewVersionCheck::getNews();
$dashboard = new Dashboard($this->_siteID);
$placedRS = $dashboard->getPlacements();
$calendar = new Calendar($this->_siteID);
$upcomingEventsHTML = $calendar->getUpcomingEventsHTML(7, UPCOMING_FOR_DASHBOARD);
$calendar = new Calendar($this->_siteID);
$upcomingEventsFupHTML = $calendar->getUpcomingEventsHTML(7, UPCOMING_FOR_DASHBOARD_FUP);
/* Important cand datagrid */
$dataGridProperties = array('rangeStart' => 0, 'maxResults' => 15, 'filterVisible' => false);
$dataGrid = DataGrid::get("home:ImportantPipelineDashboard", $dataGridProperties);
$this->_template->assign('dataGrid', $dataGrid);
$dataGridProperties = array('rangeStart' => 0, 'maxResults' => 15, 'filterVisible' => false);
/* Only show a month of activities. */
$dataGridProperties['startDate'] = '';
$dataGridProperties['endDate'] = '';
$dataGridProperties['period'] = 'DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
$dataGrid2 = DataGrid::get("home:CallsDataGrid", $dataGridProperties);
$this->_template->assign('dataGrid2', $dataGrid2);
$this->_template->assign('active', $this);
$this->_template->assign('placedRS', $placedRS);
$this->_template->assign('upcomingEventsHTML', $upcomingEventsHTML);
$this->_template->assign('upcomingEventsFupHTML', $upcomingEventsFupHTML);
$this->_template->assign('wildCardQuickSearch', '');
$this->_template->display('./modules/home/Home.tpl');
}
示例12: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
if ($this->isInsert) {
$blog = new BlogHolder();
$blog->ParentID = $this->ID;
$blog->Title = "News";
$blog->ShowInMenus = false;
$blog->write();
$blog->publish('Stage', 'Live');
$calendar = new Calendar();
$calendar->ParentID = $this->ID;
$calendar->Title = "Calendar";
$calendar->ShowInMenus = false;
$calendar->write();
$calendar->publish('Stage', 'Live');
$leaders = new ScoutGroupLeaders();
$leaders->ParentID = $this->ID;
$leaders->Title = "Leaders";
$leaders->ShowInMenus = false;
$leaders->write();
$leaders->publish('Stage', 'Live');
}
$this->isInsert = false;
}
示例13: __calendar
public function __calendar()
{
if ($this->month && $this->year) {
$cal_year = $this->year;
$cal_month = $this->month;
} else {
if (!($cal_month = Request::get('month'))) {
$cal_month = date("m");
} elseif ($cal_month < 10) {
$cal_month = "0" . str_replace("0", "", $cal_month);
}
if (!($cal_year = Request::get('year'))) {
$cal_year = date("Y");
}
}
$model = new $this->cms_content_class();
$model = $model->scope($this->cms_list_scope);
$cal = new Calendar();
if (($events = $cal->event_range_filter($model, $cal_year, $cal_month)->all()) && $events->count()) {
foreach ($events as $event) {
$index = date("Y-n-j", strtotime($event->event_date_start));
$this->months_events[$index][$event->primval] = $event;
$start = date("Ymd", strtotime($event->event_date_start));
$end = date("Ymd", strtotime($event->event_date_end));
if ($end > $start) {
foreach (range($start, $end) as $i) {
$ind = date("Y-n-j", strtotime($i));
$this->months_events[$ind][$event->primval] = $event;
}
}
}
}
}
示例14: mailos_followup
function mailos_followup($id, $subject, $from, $days, $account)
{
$localtime = time();
$followup = <<<EOF
\t\tCalendar alert to follow up via email:
\t\t
\t\tFrom: {$from}
\t\tSubject = {$subject}
\t\tMessageID = ({$id})
\t\t
\t\tAdded = {$localtime}
\t\tDays = {$days}
EOF;
$title = "Follow up {$from} ({$subject})";
// Starts today
$start = time();
// Due in X days from today
$due = $start + $days * 86400;
$end = $start + $days * 86400 + 3600;
$startdate = strftime("%Y-%m-%d %R:00", time($due));
$enddate = strftime("%Y-%m-%d %R:00", time($end));
list($username, $pop3host) = explode('@', $account);
$cal = new Calendar(array('username' => $username, 'pop3host' => $pop3host, 'userfrom' => $account));
// Add to our own Personal calendar
$cal->addrecord(array('UserTo' => $account, 'UserFrom' => $account, 'Title' => $title, 'CalMessage' => $followup, 'Type' => 'Pending', 'Importance' => '1', 'Alert' => '', 'DateStart' => "{$startdate}", 'DateEnd' => "{$enddate}", 'Permission' => '1'));
}
示例15: index
function index()
{
global $viewhelper;
require CACHE_COMMON_PATH . "cache_type.php";
$title = L("industry_info", "tpl");
//cal
require CLASS_PATH . "calendar.class.php";
$cal = new Calendar();
$cal->setMonthNames(explode(",", L("month_unit", "tpl")));
$cal->setDayNames(explode(",", L("week_unit", "tpl")));
$d = getdate(time());
$day = $_GET['day'];
if ($day == "") {
$day = $d['mday'];
}
$month = $_GET['month'];
if ($month == "") {
$month = $d["mon"];
}
$year = $_GET['year'];
if ($year == "") {
$year = $d["year"];
}
if (isset($_GET['year']) && isset($_GET['month']) && isset($_GET['day'])) {
$title .= L("journal", "tpl", $year . $month . $day);
setvar("date_line", $year . "-" . $month . "-" . $day);
}
$viewhelper->setTitle($title);
setvar("Calendar", $cal->getMonthView($month, $year));
$cache_id = $year . $month . $day;
//end cal
render("news/index");
}