docs.roxen.comView this page in a printer friendly mode
DocsRoxenWebServer 5.4Web Developer ManualEmit Tags
Copyright © 2018, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com

   

<emit>
<emit atlas>
<emit captcha>
<emit cimg>
<emit dir>
<emit exec>
<emit fonts>
<emit imgs>
<emit js-dynamic-popup>
<emit js-hide-popup>
<emit languages>
<emit ldap>
<emit path>
<emit scopes>
<emit sources>
<emit spellcheck>
<emit sql>
<emit timerange>
<emit values>
<emit ws-dir>
<emit xml-db>

<emit source="timerange"></emit>

Provided by module: Tags: Calendar tools

This tag emits over a timerange between two dates (from i.e. from-date and to-date -attributes). The purpose is also that you might have a Resultset from i.e. a database (but the goal is that it should work with other resultsets why not from an ldap search?) and each row in the database result will also contain corresponding dates. But if there is no result row from the database query that match one day the variables from the Resultset will be empty.

This tag is very useful for application that needs a calendar functionality.

Note!

In Gregorian calendar, first day of the week is Sunday.

Note!

All emit attributes apply.


Attributes

unit="{years, months, weeks, days, hours, minutes, seconds}"

years - loop over years
days - will result in a loop over days
etc.


calendar="{ISO, Gregorian, Julian, Coptic, Islamic, Discordian}" (ISO)

The type of calendar that is recieved from the to-* and from-* attributes and will also reflect the values that you get.

These are not case sensitive values.


from-date="YYYY-MM-DD"

The date that the emit starts at (i.e. '2002-06-21' - which was midsummer eve in Sweden that year)


from-year="YYYY"

Start the emit from this year. Used with all the unit types.


from-time="HH:MM:SS"

Two digits for hours, minutes and seconds - separated by colon. Useful when the value of unit is hours, minutes or seconds. But it might also influence when used with the query attribute.


to-date="YYYY-MM-DD"

The date (i.e. '2002-06-21' - which was midsummer eve in Sweden that year)


to-year="YYYY"

Emit to this year. Used with all the unit types.


to-time="HH:MM:SS"

Two digits for hours, minutes and seconds - separated by colon. Useful when the value of unit is hours, minutes or seconds. But it might also have impact when used with the query attribute.


from-week-day="{monday, tuesday, wednesday, thursday, friday, saturday, sunday}"

Alter the startdate to nearest weekday of the choice which means that if you declare in from-date 2002-07-25 which is a tuesday the startdate will become 2002-07-24 when from-week-day='monday'. So far this is supported by ISO, Gregorian and Julian calendar.


to-week-day="{monday, tuesday, wednesday, thursday, friday, saturday, sunday}"

Alter the to-date to neareast weekday this day or after this day depending on where the weekday is. So far this is supported by ISO, Gregorian and Julian calendar.


inclusive="empty"

Affects the to-* attributes so that the to-date will be included in the result. See examples below.


query

A sql select query. Must be accompanied by a compare-date attribute otherwise it will throw an error. The attribute can for now only compare date in the ISO date format se compare-date for the ISO format.


compare-date="sql-column-name"

A column - or alias name for a column in the sql select query. The value of the column must be of the ISO format corresponding to the unit attribute asked for.

unitformat

years

YYYY

months

YYYY-MM

weeks

has none (for now)

days

YYYY-MM-DD

hours

YYYY-MM-DD HH

minutes

YYYY-MM-DD HH:mm

seconds

YYYY-MM-DD HH:mm:ss

This attribute is mandatory if the query attribute exists. This attribute does nothing if the query attribute doesn't exist.


host="db-host-name"

A databas host name, found under DBs in Administration Interface. Used together with query attribute. See <emit source="sql"> for further information.

The "SQL tags" module must be loaded for this to work, and the "Allowed databases" setting in it is used to restrict database access.


language="langcode"

The language code to use:


<emit source='timerange' unit='hours' from-time='08:00:00' to-time='12:00:00' inclusive='1'> <div>&_.hour;:&_.minute;:&_.second;</div> </emit>
8:0:0
9:0:0
10:0:0
11:0:0
12:0:0
<emit source='timerange' unit='days' from-date='2002-11-23' to-date='2002-12-25' from-week-day='monday' calendar='ISO' to-week-day='sunday' inclusive='1'> <if variable='_.week.day is 7'> <font color='red'> <if sizeof='_.day is 1'>0</if>&_.day; </font> <br /> </if> <else> <if sizeof='_.day is 1'>0</if>&_.day; </else> </emit>
18 19 20 21 22 23 24
25 26 27 28 29 30 01
02 03 04 05 06 07 08
09 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29

Database system this example uses: MySQL

Database name: mydb

Table name: calendar_src:

nametype

id

INT PRIMARY KEY

start_date

DATETIME

end_date

DATETIME

day_event

TEXT

<table border='1'> <tr> <emit source='timerange' unit='days' calendar='ISO' from-date='2003-03-01' to-date='2003-03-31' from-week-day='monday' to-week-day='sunday' inclusive='' query='SELECT day_event, DATE_FORMAT(start_date,"%Y-%m-%d") as comp_date FROM calendar_src WHERE start_date &gt; "2003-03-01 00:00:00" AND start_date < "2003-04-01 00:00:00:" ORDER BY start_date' compare-date='comp_date' host='mydb'> <if variable='_.ymd_short is &var.ymd_short_old;' not=''> <![CDATA[</td>]]> </if> <if variable='_.week.day is 1' match='&_.ymd_short; != &var.ymd_short_old;'> <if variable='_.counter &gt; 1'> <![CDATA[ </tr> <tr>]]> </if> <td width='30' valign='top'> <div>&_.week;</div> </td> <![CDATA[<td width='100' valign='top'>]]> <div align='right'>&_.month.day;</div> <div>&_.day_event;</div> </if> <else> <set variable='var.cal-day-width' value='{$working-day-column-width}'/> <if variable='_.ymd_short is &var.ymd_short_old;' not=''> <![CDATA[<td width='100' valign='top'>]]> <if variable='_.week.day is 7'> <div align='right' style='color: red'> &_.month.day; </div> </if> <else> <div align='right'>&_.month.day;</div> </else> </if> <div>&_.day_event;</div> </else> <set variable='var.ymd_short_old' from='_.ymd_short'/> </emit> </tr> </table>

The code above does not work in a XML- or XSLT-file unless modified to conform to XML. To accomplish that <xsl:text disable-output-escaping='yes'> <![CDATA[<td>]]> </xsl:text> will solve that. Or it could be placed in a RXML-variable: <set variable='var.start_td' value='&lt;td&gt;'/> and used: see documentation: Encoding, under Variables, Scopes & Entities

&_.day; (provided by Tags: Calendar tools)

Same as &_.month.day;


&_.days; (provided by Tags: Calendar tools)

Same as &_.month.days;


&_.default.calendar; (provided by Tags: Calendar tools)

Returns the this modules default calendar. I.e. "ISO", "Gregorian" etc.


&_.default.language; (provided by Tags: Calendar tools)

Returns the this modules default language.


&_.default.something; (provided by Tags: Calendar tools)

Returns the this modules settings.


&_.default.timezone; (provided by Tags: Calendar tools)

Returns the this modules default timezone.


&_.default.timezone.detail; (provided by Tags: Calendar tools)

Returns the this modules default timezone specific part. I.e. Stockholm if the timezone is Europe/Stockholm


&_.default.timezone.region; (provided by Tags: Calendar tools)

Returns the this modules default timezone region. I.e. Europe if the timezone is Europe/Stockholm


&_.hour; (provided by Tags: Calendar tools)

Returns the hour. (Time zone dependent data)


&_.hours; (provided by Tags: Calendar tools)

Returns the hour zero padded. (Time zone dependent data)


&_.julian-day; (provided by Tags: Calendar tools)

Returns the Julian day number since the Julian calendar started.


&_.minute; (provided by Tags: Calendar tools)

Returns minutes, integer value, i.e. 5 (Time zone dependent data)


&_.minutes; (provided by Tags: Calendar tools)

Returns minutes, zero padded, i.e. 05 (Time zone dependent data)


&_.month; (provided by Tags: Calendar tools)

Returns the month number i.e. 3 for march


&_.month.day; (provided by Tags: Calendar tools)

Returns the day number in the month


&_.month.name; (provided by Tags: Calendar tools)

Month name. Language dependent.


&_.month.number-of-days; (provided by Tags: Calendar tools)

Integervalue of how many days the month contains. &_.month.number_of_days; will also work due to backward compatibility.


&_.month.number_of_days; (provided by Tags: Calendar tools)

Returns the number of days there is in a month.


&_.month.short-name; (provided by Tags: Calendar tools)

Month short name. Language dependent.


&_.next.day; (provided by Tags: Calendar tools)

Returns the next date the next day.


&_.next.hour; (provided by Tags: Calendar tools)

Returns the next date the next hour.


&_.next.minute; (provided by Tags: Calendar tools)

Returns the next date the next minute.


&_.next.month; (provided by Tags: Calendar tools)

Returns the next date the next month.


&_.next.second; (provided by Tags: Calendar tools)

Returns the next date the next second.


&_.next.something; (provided by Tags: Calendar tools)

Returns date compared to the current date. This will display a new date that is next to the current date.


&_.next.week; (provided by Tags: Calendar tools)

Returns the next date the next week.


&_.next.year; (provided by Tags: Calendar tools)

Returns the next date the next year.


&_.prev.day; (provided by Tags: Calendar tools)

Returns the previous date the previous day.


&_.prev.hour; (provided by Tags: Calendar tools)

Returns the previous date the previous hour.


&_.prev.minute; (provided by Tags: Calendar tools)

Returns the previous date the previous minute.


&_.prev.month; (provided by Tags: Calendar tools)

Returns the previous date the previous month.


&_.prev.second; (provided by Tags: Calendar tools)

Returns the previous date the previous second.


&_.prev.something; (provided by Tags: Calendar tools)

Returns date compared to the current date. This will display a new date that is previous to the current date.


&_.prev.week; (provided by Tags: Calendar tools)

Returns the previous date the previous week.


&_.prev.year; (provided by Tags: Calendar tools)

Returns the previous date the previous year.


&_.second; (provided by Tags: Calendar tools)

Returns seconds. (Time zone dependent data)


&_.seconds; (provided by Tags: Calendar tools)

Returns seconds, zero padded. (Time zone dependent data)


&_.this.day; (provided by Tags: Calendar tools)

Returns the this date this day.


&_.this.hour; (provided by Tags: Calendar tools)

Returns the this date this hour.


&_.this.minute; (provided by Tags: Calendar tools)

Returns the this date this minute.


&_.this.month; (provided by Tags: Calendar tools)

Returns the this date this month.


&_.this.second; (provided by Tags: Calendar tools)

Returns the this date this second.


&_.this.something; (provided by Tags: Calendar tools)


&_.this.week; (provided by Tags: Calendar tools)

Returns the this date the this week.


&_.this.year; (provided by Tags: Calendar tools)

Returns the this date this year.


&_.time; (provided by Tags: Calendar tools)

Returns time formated hh:mm:ss (ISO)


&_.timestamp; (provided by Tags: Calendar tools)

Returns a date and time timestamp formated YYYY-MM-DD hh:mm:ss


&_.timezone; (provided by Tags: Calendar tools)

Returns the timezone iso name.(Time zone dependent data


&_.timezone.iso-name; (provided by Tags: Calendar tools)

Returns the ISO name of the timezone


&_.timezone.name; (provided by Tags: Calendar tools)

Returns the name of the time zone.


&_.timezone.seconds-to-utc; (provided by Tags: Calendar tools)

The offset to UTC in seconds. (Time zone dependent data)


&_.unix-time; (provided by Tags: Calendar tools)

Returns seconds since 1:st of january 1970 01:00:00

Time zone dependent data


&_.week; (provided by Tags: Calendar tools)

Returns the week number. Language dependent


&_.week.day; (provided by Tags: Calendar tools)

Returns the week day number. 1 for monday if it is ISO 1 for sunday if it is Gregorian. ISO is default if Gregorian is not specified for the calendar. Language dependent


&_.week.day.name; (provided by Tags: Calendar tools)

Returns the name of the day. I.e. monday. Language dependent


&_.week.day.short-name; (provided by Tags: Calendar tools)

Returns the name of the day. I.e. mo for monday. Language dependent


&_.week.name; (provided by Tags: Calendar tools)

the name of the week. I.e. w5 for week number 5 that year.


&_.weeks; (provided by Tags: Calendar tools)

Returns the week number. Zero padded. Language dependent


&_.year; (provided by Tags: Calendar tools)

Returns the year i.e. 2003


&_.year.day; (provided by Tags: Calendar tools)

Returns the day day of the year for date, in the range 1 to 366


&_.year.is-leap-year; (provided by Tags: Calendar tools)

Returns TRUE or FALSE


&_.year.name; (provided by Tags: Calendar tools)

Returns the year number i.e. 2003


&_.ymd; (provided by Tags: Calendar tools)

Returns a date formated like YYYY-MM-DD (ISO date)


&_.ymd_short; (provided by Tags: Calendar tools)

Returns a date formated YYYYMMDD (ISO)