Parent

Class/Module Index [+]

Quicksearch

Calentry

Schema Information

Table name: calentries

id         :integer          not null, primary key
start      :datetime
ende       :datetime
summary    :string(255)
typ        :integer
created_at :datetime         not null
updated_at :datetime         not null

Public Class Methods

updated_at() click to toggle source
# File app/models/calentry.rb, line 33
 def  self.updated_at
   #Calentry.select("MAX(updated_at) as m_updated_at").first.m_updated_at
   Calentry.all.max_by(&:updated_at).updated_at
end

Public Instance Methods

dauer() click to toggle source
# File app/models/calentry.rb, line 72
  def dauer
if self.ende.nil? && self.start.nil? 
0 
else
self.ende = self.start if self.ende.nil?
    (self.ende-self.start)/3600 
end
  end
dauer=(dauer) click to toggle source
# File app/models/calentry.rb, line 80
def dauer=(dauer)
  self.ende=self.start+dauer.to_i.hours 
end
days_to_today() click to toggle source
# File app/models/calentry.rb, line 46
def days_to_today
  if self.is_ongoing? 
    0
  else
    if self.is_upcomming?
      (self.start.to_date - Date.today).to_i.abs
    elsif self.is_past?
      (self.ende.to_date - Date.today).to_i.abs
    end
  end

end
get_public() click to toggle source
# File app/models/calentry.rb, line 58
def get_public
  self.calendar=self.object.calendar unless object.nil? || object.calendar.nil?
  self.public = (self.try(:object).nil?)? (self.calendar.try(:public?)) : object.try(:public?)
  true
end
icon_text() click to toggle source
# File app/models/calentry.rb, line 90
def icon_text
  ApplicationController.helpers.fa_icon("calendar 2x") + self.text
end
is_ongoing?() click to toggle source
# File app/models/calentry.rb, line 40
def is_ongoing?
  (self.start < Time.now) && (Time.now < self.ende) 
end
is_past?() click to toggle source
# File app/models/calentry.rb, line 43
def is_past?
  (Time.now > self.ende) 
end
is_upcomming?() click to toggle source
# File app/models/calentry.rb, line 37
def is_upcomming?
  self.start > Time.now
end
name() click to toggle source
# File app/models/calentry.rb, line 83
def name
  unless self.object.nil?
    self.object.title
  else
    summary
  end
end
s_time=(s_time) click to toggle source
# File app/models/calentry.rb, line 63
def s_time=(s_time)
  start 
end
start1() click to toggle source
# File app/models/calentry.rb, line 69
def start1
  start.to_date
end
start_time() click to toggle source
# File app/models/calentry.rb, line 66
def start_time
  start
end
text() click to toggle source
# File app/models/calentry.rb, line 93
def text
  if self.start.nil? || self.ende.nil? 
    "error" 
  else
    if  (self.start.to_date - self.ende.to_date) < 1.day
      format=:timeonly
    else
      format =:default
    end
    I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende, :format=>format) 
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.