2017 © Pedro Peláez
 

library julius

A PHP package mainly developed for Laravel to manage calendar and events.

image

sukohi/julius

A PHP package mainly developed for Laravel to manage calendar and events.

  • Thursday, April 21, 2016
  • by Sukohi
  • Repository
  • 3 Watchers
  • 8 Stars
  • 172 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 8 Versions
  • 2 % Grown

The README.md

Julius

A PHP package mainly developed for Laravel to manage calendar and events.
(This package was inspired by laravel-calendar ).
Thank you makzumi!
(This is for Laravel 5+. For Laravel 4.2), (*1)

Demo, (*2)

Imgur, (*3)

Installation

Add this package name in composer.json, (*4)

"require": {
  "sukohi/julius": "2.*"
}

Execute composer command., (*5)

composer update

Register the service provider in app.php, (*6)

'providers' => [
    ...Others...,  
    Sukohi\Julius\JuliusServiceProvider::class,
]

Also alias, (*7)

'aliases' => [
    ...Others...,  
    'Julius'   => Sukohi\Julius\Facades\Julius::class
]

Usage

Minimal Way, (*8)

echo \Julius::make();

with Options, (*9)

See Methods for the details., (*10)

$events = [
    date('Y-m') .'-11 10:15:00' => ['Event 1', 'Event 2'],
    date('Y-m') .'-09 10:26:00' => ['Event 3', '<strong>Event 4</strong>'],
    date('Y-m') .'-07 14:12:23' => ['Event 5'],
    date('Y-m') .'-15 12:39:00' => ['Event 6'],
    date('Y-m') .'-17 25:50:00' => ['Event 7'], // You can use times over 24:00
];

$julius = \Julius::make();

$julius->setStartDate(\Request::get('base_date'))   //Set base date
    ->showNavigation(true)  // Show or hide the navigation
    ->showDayOfWeek(true)   // Show or hide the day of week for "week" or "day" mode.
    ->setMode(\Request::get('mode'))    // month, week or day
    ->setHours('8:10', '18:20') // Set the hour range for day and week mode. And you can use times over 24:00
    ->setClasses([  // Set classes
            'table' => 'table table-bordered', 
            'header' => 'table-header', 
            'time' => 'time', 
            'prev' => 'btn', 
            'next' => 'btn', 
            'day_label' => 'text-success', // You can use array like ['0' => 'sunday-class', '6' => 'saturday-class']
            'today' => 'text-danger',
            'year_month' => 'text-center', 
            'day' => 'text-muted', // You can use array like ['0' => 'sunday-class', '6' => 'saturday-class']
    ])
    ->setWraps([    // Set wrapers
            'event' => ['<p>', '</p>'], 
            'day' => ['<div>', '</div>'], 
            'date' => ['<span>', '</span>']
    ])
    ->setIcons([    // Set navigation icons (You can use HTML tags)
            'prev' => '<span class="glyphicon glyphicon-arrow-left"></span> Prev', 
            'next' => 'Next <span class="glyphicon glyphicon-arrow-right"></span>'
    ])
    ->setNavigationJsFunction('your_function_name')    // When using this method, the navigation icon link has onclick event. e.g) onclick="your_function_name(date)".
    ->setDayLabels(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])   // Set week day names
    ->setMonthLabels(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'])    // Set month names
    ->setInterval('+10 minutes')    // e.g.) +3 hours, +30 minutes etc...
    ->setEvents($events, $callback = function($events, $start_dt, $end_dt){ // Set events and its callback function(Callback is optional)

        $html = '<div>'. $start_dt->day .'</div>';
        $html .=  '<pre>'. print_r($events, true) .'</pre>';
        $html .= '<pre>'. print_r($start_dt, true) .'</pre>';
        $html .= '<pre>'. print_r($end_dt, true) .'</pre>';
        return $html;

    })
    ->setDateFormats([  // Set date formats
         'year_month' => 'm Y',
         'day' => 'w j',
         'time' => 'H:i'
     ]);
echo $julius->generate();

Methods

showNavigation($bool), (*11)

Show or hide the navigation, (*12)

showDayOfWeek($bool), (*13)

Show or hide the day of week for week or day mode., (*14)

setMode($str), (*15)

To set calendar type. $str can be month, week or day., (*16)

setHours($start, $end), (*17)

To set the hour range for day and week mode.
You need to set time format like 00:00, 10:25 for $start and $end.
You can set times over 24:00, (*18)

setClasses($array), (*19)

To set class values like the below., (*20)

setClasses([
    'table' => 'table table-bordered', 
    'header' => 'table-header', 
    'time' => 'time', 
    'prev' => 'btn', 
    'next' => 'btn', 
    'day_label' => 'text-success', // You also can set array like ['0' => 'sunday-class', '6' => 'saturday-class']
    'today' => 'text-danger',
    'year_month' => 'text-center', 
    'day' => 'text-muted', // You also can set array like ['0' => 'sunday-class', '6' => 'saturday-class']
])

setWraps($array), (*21)

To set wrapers., (*22)

setWraps([
    'event' => ['<p>', '</p>'], 
    'day' => ['<div>', '</div>'], 
    'date' => ['<span>', '</span>']
])

setIcons($array), (*23)

To set navigation icons. (You can use HTML tags), (*24)

setIcons([
    'prev' => '<span class="glyphicon glyphicon-arrow-left"></span> Prev', 
    'next' => 'Next <span class="glyphicon glyphicon-arrow-right"></span>'
])

setNavigationJsFunction($js_function_name), (*25)

When using this method, the navigation icon link has onclick event like the below., (*26)

onclick="js_function_name('2015-09')"

setDayLabels($array), (*27)

To set week day names, (*28)

setDayLabels(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])

setMonthLabels($array), (*29)

To set month names., (*30)

setMonthLabels([
    'January', 
    'February', 
    'March', 
    'April', 
    'May', 
    'June', 
    'July', 
    'August', 
    'September', 
    'October', 
    'November', 
    'December'
])

setInterval($str), (*31)

To set time step. $str can be +3 hours, +30 minutes etc..., (*32)

setEvents($events, $closure), (*33)

To set events and its callback(closure), (*34)

setEvents($events, function($event, $start_dt, $end_dt){  

    // Here you can make content for a specific event.
    return $start_dt->day .' - '. $start_dt .' - '. $end_dt;

})

// $start_dt and $end_dt are Carbon object.

setDateFormats($array), (*35)

To set date formats.
See here for other date symbols., (*36)

setDateFormats([
    'year_month' => 'm Y',
    'day' => 'w j',
    'time' => 'H:i'
])

License

This package is licensed under the MIT License., (*37)

Copyright 2015 Sukohi Kuhoh, (*38)

The Versions

21/04 2016

2.0.x-dev

2.0.9999999.9999999-dev

A PHP package mainly developed for Laravel to manage calendar and events.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

21/04 2016

dev-master

9999999-dev

A PHP package mainly developed for Laravel to manage calendar and events.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

21/04 2016

2.0.4

2.0.4.0

A PHP package mainly developed for Laravel to manage calendar and events.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

21/04 2016

2.0.3

2.0.3.0

A PHP package mainly developed for Laravel to manage calendar and events.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

19/08 2015

1.0.x-dev

1.0.9999999.9999999-dev

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

12/08 2015

2.0.1

2.0.1.0

A PHP package mainly developed for Laravel to manage calendar and events.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

12/08 2015

2.0.2

2.0.2.0

A PHP package mainly developed for Laravel to manage calendar and events.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

08/07 2015

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi