module EventsHelper #DAYNAMES = [:mon, :tue, :wed, :thu, :fri, :sat, :sun] def calendar(yeard,monthd,addMonths) now = DateTime.now first = Date.new(now.year,now.month,1) last = Date.new(now.year,now.month,-1) curr_week = first.cweek html = "

" html << t(:month_names,:scope=>:date)[now.month] html << "

" html << "" html << "" 1.upto(6) do |i| html << "" end html << "" html << "" html << "" html << "" (first.wday-1).downto(1) do |i| prev = first - i html << "" end (first.day).upto(last.day) do |i| curr = Date.new(now.year,now.month,i) if curr.wday == 1 html << "" html << "" curr_week += 1 html << "" end if now.day == i html << "" else if curr.wday == 0 || curr.wday == 6 html << "" else html << "" end end end 1.upto(7-last.wday) do |i| post = last + i html << "" end html << "" html << "
#{t(:abbr_day_names,:scope=>:date)[i]}#{t(:abbr_day_names,:scope=>:date)[0]}
#{first.cweek}#{prev.day}
#{curr_week}#{i}#{i}#{i}#{post.day}
" html end end