Changeset 1057 for trunk/include/calendar_weekly.class.php
- Timestamp:
- Feb 24, 2006, 6:58:48 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_weekly.class.php
r1055 r1057 27 27 include_once(PHPWG_ROOT_PATH.'include/calendar_base.class.php'); 28 28 29 define ('CYEAR', 0); 30 define ('CWEEK', 1); 31 define ('CDAY', 2); 32 29 33 /** 30 34 * Weekly calendar style (composed of years/week in years and days in week) … … 37 41 * @return boolean false to indicate that thumbnails where not included here 38 42 */ 39 function generate_category_content($url_base, $view_type , &$requested)43 function generate_category_content($url_base, $view_type) 40 44 { 41 global $lang ;45 global $lang, $conf; 42 46 43 47 $this->url_base = $url_base; … … 45 49 assert($view_type==CAL_VIEW_LIST); 46 50 47 $this->build_nav_bar($view_type, $requested, 0, 'YEAR'); // years 48 if (count($requested)>0) 49 $this->build_nav_bar($view_type, $requested, 1, 'WEEK', '+1' ); // month 50 if (count($requested)>1) 51 $this->build_nav_bar($view_type, $requested, 2, 'DAYOFWEEK', '-1', 51 if ( $conf['calendar_multi_bar'] or count($this->date_components)==0 ) 52 { 53 $this->build_nav_bar(CYEAR, 'YEAR'); // years 54 } 55 if ( count($this->date_components)>=1 and 56 ( $conf['calendar_multi_bar'] or count($this->date_components)==1 ) 57 ) 58 { 59 $this->build_nav_bar(CWEEK, 'WEEK', '+1' ); // month 60 } 61 if ( count($this->date_components)>=2 ) 62 { 63 $this->build_nav_bar(CDAY, 'DAYOFWEEK', '-1', 52 64 $lang['day'] ); // days 65 } 53 66 return false; 54 67 } … … 57 70 /** 58 71 * Returns a sql where subquery for the date field 59 * @param array requested selected levels for this calendar60 * (e.g. 2005,42,1 for 41st week of 2005, Monday)61 72 * @param int max_levels return the where up to this level 62 73 * (e.g. 2=only year and week in year) 63 74 * @return string 64 75 */ 65 function get_date_where($ requested, $max_levels=3)76 function get_date_where($max_levels=3) 66 77 { 67 while (count($requested)>$max_levels) 78 $date_components = $this->date_components; 79 while (count($date_components)>$max_levels) 68 80 { 69 array_pop($ requested);81 array_pop($date_components); 70 82 } 71 83 $res = ''; 72 if (isset($ requested[0]) and $requested[0]!='any')84 if (isset($date_components[CYEAR]) and $date_components[CYEAR]!='any') 73 85 { 74 $y = $ requested[0];86 $y = $date_components[CYEAR]; 75 87 $res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 23:59:59'"; 76 88 } 77 89 78 if (isset($ requested[1]) and $requested[1]!='any')90 if (isset($date_components[CWEEK]) and $date_components[CWEEK]!='any') 79 91 { 80 $res .= ' AND WEEK('.$this->date_field.')+1='.$ requested[1];92 $res .= ' AND WEEK('.$this->date_field.')+1='.$date_components[CWEEK]; 81 93 } 82 if (isset($ requested[2]) and $requested[2]!='any')94 if (isset($date_components[CDAY]) and $date_components[CDAY]!='any') 83 95 { 84 $res .= ' AND DAYOFWEEK('.$this->date_field.')-1='.$requested[2]; 96 $res .= ' AND DAYOFWEEK('.$this->date_field.')-1=' 97 .$date_components[CDAY]; 85 98 } 86 99 if (empty($res)) … … 91 104 } 92 105 106 function get_display_name() 107 { 108 global $conf,$lang; 109 $res = ''; 110 $url = $this->url_base; 111 if ( isset($this->date_components[CYEAR]) ) 112 { 113 $res .= $conf['level_separator']; 114 $url .= $this->date_components[CYEAR].'-'; 115 $res .= 116 '<a href="'.$url.'">' 117 .$this->get_date_component_label($this->date_components[CYEAR]) 118 .'</a>'; 119 } 120 if ( isset($this->date_components[CWEEK]) ) 121 { 122 $res .= $conf['level_separator']; 123 $url .= $this->date_components[CWEEK].'-'; 124 $res .= 125 '<a href="'.$url.'">' 126 .$this->get_date_component_label($this->date_components[CWEEK]) 127 .'</a>'; 128 } 129 if ( isset($this->date_components[CDAY]) ) 130 { 131 $res .= $conf['level_separator']; 132 $url .= $this->date_components[CDAY].'-'; 133 $res .= 134 '<a href="'.$url.'">' 135 .$this->get_date_component_label( 136 $this->date_components[CDAY], 137 $lang['day'] 138 ) 139 .'</a>'; 140 } 141 return $res; 142 } 143 93 144 } 94 145
Note: See TracChangeset
for help on using the changeset viewer.