Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MaddHatter/LaravelFullcalendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,4 @@ protected function replaceCallbackPlaceholders($json, $placeholders)
return str_replace($search, $replace, $json);
}

}
}
19 changes: 19 additions & 0 deletions src/MaddHatter/LaravelFullcalendar/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,24 @@ public function getStart();
* @return DateTime
*/
public function getEnd();

/**
* Get the id of the event
*
* @return Integer
*/
public function getId();
/**
* Get the color of the event
*
* @return String
*/
public function getColor();
/**
* Get the url of the event
*
* @return String
*/
public function getUrl();

}
11 changes: 7 additions & 4 deletions src/MaddHatter/LaravelFullcalendar/EventCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ public function toArray()
private function convertToArray(Event $event, array $customAttributes = [])
{
return array_merge([
'title' => $event->getTitle(),
'allDay' => $event->isAllDay(),
'start' => $event->getStart()->format('c'),
'end' => $event->getEnd()->format('c'),
'id' => $event->getId(),
'title' => $event->getTitle(),
'allDay' => $event->isAllDay(),
'start' => $event->getStart()->format('c'),
'end' => $event->getEnd()->format('c'),
'color' => $event->getColor(),
'url' => $event->getUrl()
], $customAttributes);
}

Expand Down
53 changes: 52 additions & 1 deletion src/MaddHatter/LaravelFullcalendar/SimpleEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
class SimpleEvent implements Event
{

/**
* @var int
*/
public $id;

/**
* @var
*/
Expand All @@ -33,17 +38,43 @@ class SimpleEvent implements Event
public $end;

/**
* @var string
*/
public $color;

/**
* @var string
*/
public $url;

/**
* @param int $id
* @param string $title
* @param bool $isAllDay
* @param string|DateTime $start If string, must be valid datetime format: http://bit.ly/1z7QWbg
* @param string|DateTime $end If string, must be valid datetime format: http://bit.ly/1z7QWbg
* @param string $color
* @param string $url
*/
public function __construct($title, $isAllDay, $start, $end)
public function __construct($title, $isAllDay, $start, $end, $id = null, $color = '#3a87ad', $url = null)
{
$this->id = $id;
$this->title = $title;
$this->isAllDay = $isAllDay;
$this->start = $start instanceof DateTime ? $start : new DateTime($start);
$this->end = $start instanceof DateTime ? $end : new DateTime($end);
$this->color = $color;
$this->url = $url;
}

/**
* Get the event's id number para hacer la url
*
* @return int
*/
public function getId()
{
return $this->id;
}

/**
Expand Down Expand Up @@ -85,4 +116,24 @@ public function getEnd()
{
return $this->end;
}

/**
* Get the color
*
* @return String
*/
public function getColor()
{
return $this->color;
}

/**
* Get the url
*
* @return String
*/
public function getUrl()
{
return $this->url;
}
}