url_base = $url_base;
assert($view_type==CAL_VIEW_LIST);
if ( $conf['calendar_multi_bar'] or count($this->date_components)==0 )
{
$this->build_nav_bar(CYEAR, 'YEAR'); // years
}
if ( count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 )
)
{
$this->build_nav_bar(CWEEK, 'WEEK', '+1' ); // month
}
if ( count($this->date_components)>=2 )
{
$this->build_nav_bar(CDAY, 'DAYOFWEEK', '-1',
$lang['day'] ); // days
}
return false;
}
/**
* Returns a sql where subquery for the date field
* @param int max_levels return the where up to this level
* (e.g. 2=only year and week in year)
* @return string
*/
function get_date_where($max_levels=3)
{
$date_components = $this->date_components;
while (count($date_components)>$max_levels)
{
array_pop($date_components);
}
$res = '';
if (isset($date_components[CYEAR]) and $date_components[CYEAR]!='any')
{
$y = $date_components[CYEAR];
$res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 23:59:59'";
}
if (isset($date_components[CWEEK]) and $date_components[CWEEK]!='any')
{
$res .= ' AND WEEK('.$this->date_field.')+1='.$date_components[CWEEK];
}
if (isset($date_components[CDAY]) and $date_components[CDAY]!='any')
{
$res .= ' AND DAYOFWEEK('.$this->date_field.')-1='
.$date_components[CDAY];
}
if (empty($res))
{
$res = ' AND '.$this->date_field.' IS NOT NULL';
}
return $res;
}
function get_display_name()
{
global $conf,$lang;
$res = '';
$url = $this->url_base;
if ( isset($this->date_components[CYEAR]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CYEAR].'-';
$res .=
''
.$this->get_date_component_label($this->date_components[CYEAR])
.'';
}
if ( isset($this->date_components[CWEEK]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CWEEK].'-';
$res .=
''
.$this->get_date_component_label($this->date_components[CWEEK])
.'';
}
if ( isset($this->date_components[CDAY]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CDAY].'-';
$res .=
''
.$this->get_date_component_label(
$this->date_components[CDAY],
$lang['day']
)
.'';
}
return $res;
}
}
?>