本文整理汇总了PHP中Calendar::addEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::addEvents方法的具体用法?PHP Calendar::addEvents怎么用?PHP Calendar::addEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::addEvents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index(Request $request)
{
$titulo = "Calendario";
$cursillos = Cursillos::getCalendarCursillos($request);
$anyos = Cursillos::getAnyoCursillosList();
//Obtenemos los parámetros de la respuesta
$year = $request->input('anyo');
$week = $request->input('semana') > 0 ? $request->input('semana') : 1;
$semanas = array();
//A partir del número de semana obtenemos el mes
if ($year > 0 && $week > 0) {
$month = new \DateTime();
$month->setISODate($year, $week);
$mes = $month->format('m');
$year = $month->format('Y');
}
$date = $year > 0 ? date('Y-m-d', strtotime("{$year}-{$mes}-1")) : date('Y-m-d');
//Cargamos los cursillos
foreach ($cursillos as $cursillo) {
$event[] = \Calendar::event($cursillo->comunidad, $cursillo->cursillo, true, $cursillo->fecha_inicio, date('Y-m-d', strtotime($cursillo->fecha_final) + 86400), $cursillo->colorFondo, $cursillo->colorTexto, $cursillo->id);
}
if (count($cursillos) > 0) {
$calendar = \Calendar::addEvents($event)->setOptions(['lang' => '', 'defaultDate' => $date, 'buttonIcons' => true, 'editable' => false, 'weekNumbers' => true, 'eventLimit' => true, 'header' => array('left' => 'prev', 'center' => 'title', 'right' => 'next')])->setCallbacks(['eventClick' => 'function(calEvent, jsEvent, view) {
$(this).attr("href","curso/"+calEvent.id);
}']);
}
return view('autenticado', compact('calendar', 'anyos', 'semanas', 'titulo'));
}
示例2: index
public function index()
{
//code should be inside a method
$events[] = \Calendar::event('Event One', false, '2015-06-05T0800', '2015-06-05T0800', 0);
$eloquentEvent = EventModel::first();
//EventModel implements MaddHatter\LaravelFullcalendar\Event
$calendar = \Calendar::addEvents($events)->setOptions(['firstDay' => 1])->setCallbacks(['viewRender' => 'function() {alert("Callbacks!");}']);
return view('pages.calendar', compact('calendar'));
}
示例3: ViewCal
public function ViewCal()
{
$event = EventModel::all();
foreach ($event as $eve) {
$events[] = \MaddHatter\LaravelFullcalendar\Calendar::event($eve->title, $eve->allDay, $eve->start, $eve->end, $eve->id);
}
$eloquentEvent = EventModel::first();
//EventModel implements MaddHatter\LaravelFullcalendar\Event
$calendar = \Calendar::addEvents($events)->addEvent($eloquentEvent, ['color' => '#800'])->setOptions(['firstDay' => 1]);
return view('\\pages/Artist/ordCalendar', compact('calendar'));
}
示例4: ViewCal
/**
* Returns calendar object based on the event object passed.
* @param $event
* @return mixed
*/
public function ViewCal($event)
{
$events = array();
foreach ($event as $eve) {
$itemDets = DB::table('items')->join('itemorders', 'itemorders.itID', '=', 'items.itID')->join('orders', 'orders.ordID', '=', 'itemorders.ordID')->select('items.*', 'itemorders.qty')->where('itemorders.ordID', '=', $eve->id)->get();
if ($eve->title == 'Completed') {
$color = '#00a65a';
} elseif (Carbon::today()->subDay()->gte(Carbon::parse($eve->chkDate)) and $eve->title == 'Ongoing') {
$color = '#f39c12';
} else {
if (Carbon::today()->addDays(2)->eq(Carbon::parse($eve->chkDate)) or Carbon::today()->addDays(1)->eq(Carbon::parse($eve->chkDate)) or Carbon::today()->eq(Carbon::parse($eve->chkDate))) {
$color = '#f56954';
} else {
$color = '#00c0ef';
}
}
$name = $eve->name . " " . $eve->lname;
$events[] = Calendar::event("Order ID:-" . $eve->id, 1, $eve->start, $eve->end, $eve->id, $color, '', "<script>\n \$(\"#itOrdersTab\").DataTable();\n \$(\"#getOrdModBtn\").html(\"<button type=button class='btn btn-danger pull-left' onclick=document.location.href='/viewOrDets={$eve->id}'>Get more Details</button>\");\n </script>\n <div class=\"tabbable\">\n <ul class=\"nav nav-tabs\">\n <li class=\"active\"><a href=\"#tab1\" data-toggle=\"tab\"><span style=\"color:black\">Customer Details</span></a></li>\n <li><a href=\"#tab2\" data-toggle=\"tab\"><span style=\"color:black\">Order Details</span></a></li>\n </ul>\n <div class=\"tab-content\">\n <div class=\"tab-pane active\" id=\"tab1\">\n <label for='ordID'>Customer Name</label>\n <input type='text' class='form-control' readonly value=\"{$name}\">\n <label for='ordID'>Email</label>\n <a href=\"#emailOrd\" style=\"border-style:solid;border-color:#EBEBE4;background-color:#EBEBE4;\" class='form-control' data-toggle=\"modal\"><i class=\"fa fa-envelope\"></i> {$eve->email}</a>\n <label for='ordID'>Phone Number</label>\n <input type='text' class='form-control' readonly value=\"{$eve->PhoneNo}\">\n <label for='ordID'>Ordered Date</label>\n <input type='text' class='form-control' readonly value=\"{$eve->ordDate}\">\n <label for='ordID'>Due Date</label>\n <input type='text' class='form-control' readonly value=\"{$eve->chkDate}\">\n </div>\n <div class=\"tab-pane\" id=\"tab2\">\n <table class=\"table table-condensed table-hover table-bordered\" id=\"itOrdersTab\">\n <thead>\n <tr>\n <th class=\"col-md-2 text-center\">\n Item Name\n </th>\n <th class=\"col-md-2 text-center\">\n Item Description\n </th>\n <th class=\"col-md-2 text-center\">\n Item Size\n </th>\n <th class=\"col-md-2 text-center\">\n Quantity\n </th>\n <th class=\"col-md-2 text-center\">\n Price per Unit\n </th>\n </tr>\n </thead>\n\n <tbody>\n " . $this->printArr($itemDets) . "\n </tbody>\n </table>\n </div>\n </div>\n </div>");
}
$calendar = \Calendar::addEvents($events)->setOptions(['firstDay' => 1])->setCallbacks(['eventRender' => 'function(event, element){element.attr(\'href\', \'javascript:void(0);\');}', 'eventClick' => 'function(event, jsEvent, view) {
$(\'#modalTitle\').html(event.title);
$(\'#modalBody\').html(event.description);
$(\'#eventUrl\').attr(\'href\',event.url);
$(\'#fullCalModal\').modal();
}']);
return $calendar;
}