Stud.IP  2.4 Revision 48548
 All Data Structures Namespaces Files Functions Variables Groups Pages
CalendarView Class Reference
Inheritance diagram for CalendarView:
Inheritance graph
Collaboration diagram for CalendarView:
Collaboration graph

Public Member Functions

 __construct ($entries=array())
 setHeight ($height)
 setRange ($start_hour, $end_hour)
 addColumn ($title, $url="", $id=null)
 addEntry ($entry_array)
 groupEntries ($grouped=true)
 setInsertFunction ($js_function_object)
 render ($params=array())
 getEntries ()
 getMatrix ()
 getRange ()
 isGrouped ()
 getHeight ()
 getOverallHeight ()
 getInsertFunction ()
 getColumns ()

Protected Member Functions

 checkEntries ($entries)

Protected Attributes

 $entries = array()
 $entry_columns = array()
 $height = 40
 $grouped = false
 $start_hour = 8
 $end_hour = 21
 $insertFunction = ""
 $templates = array()
 $view_id

Static Protected Attributes

static $number_of_instances = 1

Detailed Description

Kind of bean class for the calendar view.

Example of use:

// create a calendar-view and add a column $plan = new CalendarView(); $plan->addColumn(_('Spalte 1')) ->addEntry(array( 'id' => 1, 'color' => '#5C2D64', 'start' => '0930', 'end' => '1100', 'title' => 'Mathe 2', 'content' => 'Die Mathematiker kreiden sich mal wieder was an.' ) );

// display the calendar (containing one column) print $plan->render();

Since
2.0

Constructor & Destructor Documentation

__construct (   $entries = array())

You need to pass an instance of this class to the template. The constructor expects an array of entries of the following type: array( $day_number => array(array ( 'color' => the color in hex (css-like, without the #) 'start' => the (start hour * 100) + (start minute) 'end' => the (end hour * 100) + (end minute) //'day' => day of week (0 = Sunday, ... , 6 = Saturday) 'title' => the entry`s title 'content' => whatever shall be the content of the entry as a string ) ...) ... )

Parameters
mixed$entriesan array of entries (see above)
string$controllerthe name of the controller. Used to create links.

Here is the call graph for this function:

Member Function Documentation

addColumn (   $title,
  $url = "",
  $id = null 
)

adds a new column to this view. All entries created with addEntry will be added to this column.

Parameters
string$titlelike "monday" to be displayed on top of the column
string$urlto be called when clicked on the title of the column
string$idany kind of id of the column
Returns
CalendarView

Here is the call graph for this function:

addEntry (   $entry_array)

adds a new entry to the last current column. The entry needs to be an associative array with parameters as follows:

Parameters
array$entry_array,:associative array for an entry in the column like array ( 'color' => the color in hex (css-like, without the #) 'start' => the (start hour * 100) + (start minute) 'end' => the (end hour * 100) + (end minute) 'title' => the entry`s title 'content' => whatever shall be the content of the entry as a string )
Returns
CalendarView
checkEntries (   $entries)
protected

does some plausability checks on an array of calendar-entries

Parameters
mixed$entriesan array of calendar-entries
Returns
bool false if check failed, true otherwise

Here is the caller graph for this function:

getColumns ( )

returns all columns of the calendar-view

Returns
array of CalendarColumn

Reimplemented in CalendarWeekView.

Here is the caller graph for this function:

getEntries ( )

Returns an array of calendar-entries, grouped by day and additionally grouped by same start and end if groupEntries(true) has been called.

Returns
mixed the (double-)grouped entries

Here is the call graph for this function:

getHeight ( )

returns the previously set height for one hour

Returns
mixed the height

Here is the caller graph for this function:

getInsertFunction ( )

returns the previously set javasscript insert-function

Returns
string name of js-function or anonymous js-function

Reimplemented in CalendarWeekView.

getMatrix ( )

Returns an array where for each hour the number of concurrent entries is denoted. Used by the calendar to display the entries in parallel.

Returns
mixed concurrent entries at each hour

Here is the call graph for this function:

getOverallHeight ( )

returns the overall height of the calendar

Returns
mixed the overall height

Here is the caller graph for this function:

getRange ( )

returns the previously set start- and end-hour, denoting the range of entries to be displayed in the current calendar-view

Returns
array consisting of the start and end hour
groupEntries (   $grouped = true)

Call this function to enable/disable the grouping of entries with the same start and end.

Parameters
bool$groupoptional, defaults to true

Reimplemented in CalendarWeekView.

Here is the call graph for this function:

isGrouped ( )

the calendar can be used in two modes. Use this function to check, if the grouping-mode is enabled for the current calendar-view

Returns
bool true if grouped, false otherwise
render (   $params = array())

outputs the CalendarView with all (grouped) dates in columns.

Parameters
array$paramsyou can pass some additional variables to the templates
Returns
string

Here is the call graph for this function:

setHeight (   $height)

set the height for one hour. This value is used to calculate the whole height of the schedule.

Parameters
int$entry_heightthe height of one hour in the schedule
setInsertFunction (   $js_function_object)

When a column is clicked at no entry this function is called. First the templates generates a new entry at the clicked time. Then this js-function is called which gets the parameters "function (new_entry_dom_object, column_id, hour) { ... }" with new_entry_dom_object: a real dom-object of the div of the entry column_id: id of the column hour: integer number from 0 to 23 If js_function_object is an empty string, nothing will be done.

Parameters
string$js_function_objectname of js-function or anonymous js-function
Returns
CalendarView
setRange (   $start_hour,
  $end_hour 
)

set the range of hours to be displayed. the start_hour has to be smaller than the end_hour

Parameters
int$start_hourthe hour to start displaying at
int$end_hourthe hour to stop displaying at

Field Documentation

$end_hour = 21
protected
$entries = array()
protected
$entry_columns = array()
protected
$grouped = false
protected
$height = 40
protected
$insertFunction = ""
protected
$number_of_instances = 1
staticprotected
$start_hour = 8
protected
$templates = array()
protected
$view_id
protected

The documentation for this class was generated from the following file: