Class | ScheduleEvent
In: | app/models/schedule_event.rb
Parent: | ActiveRecord::Base

Eventos de las agendas privadas.

### Methods

belongs_to_l_schedule? copy_from organization organization_id private_event private_event= schedule_name to_ics visibility_can_change?

### Included Modules

Tools::Event Tools::Calendar::InstanceMethods

### Attributes

has_journalists | [RW] |
has_photographers | [RW] |
organization_id | [RW] | Atributos y métodos para compatibilidad con el modelo Event

### Public Instance methods

belongs_to_l_schedule?()

Indica si el evento pertenece a la agenda del Lehendakari.

[Source]

         # File app/models/schedule_event.rb, line 156
    156:   def belongs_to_l_schedule?
    157:     self.schedule_id.eql?(Schedule.lehendakari.id)
    158:   end

copy_from(evt)

Copia los datos del evento `evt` a `self`.

[Source]

         # File app/models/schedule_event.rb, line 130
    130:   def copy_from(evt)
    131:     evt_attr = evt.attributes
    132:     evt_attr.delete('id')
    133:     evt_attr.each do |at, value|
    134:       if self.respond_to?("#{at}=")
    135:         self.send("#{at}=", value)
    136:       end
    137:     end
    138:
    139:     if evt.is_a?(Event)
    140:       ['title', 'speaker'].each do |fld|
    141:         self.send("#{fld}=", [evt.send("#{fld}_es"), evt.send("#{fld}_eu"), evt.send("#{fld}_en")].uniq.compact.join(" | "))
    142:       end
    143:
    144:       self.body ||= ''
    145:       # if evt.organization.is_a?(Department)
    146:       #   self.body += "\n\nDepartamento: #{evt.organization.name}"
    147:       # else
    148:       #   self.body += "\n\nOrganismo: #{evt.organization.name} (#{evt.organization.department.name})"
    149:       # end
    150:     end
    151:
    152:     self
    153:   end

organization()

Devuelve la organización que corresponde al evento. Si no existe devuleve un objeto de la clasе `Organization`.

[Source]

        # File app/models/schedule_event.rb, line 58
    58:   def organization
    59:     self.schedule.department || Organization.new(:name => '')
    60:   end

organization_id()

Devuelve el id de la organización que corresponde аl evento о `nil` si la agenda del evento no pertenece a ningún departamento.

[Source]

        # File app/models/schedule_event.rb, line 64
    64:   def organization_id
    65:     self.schedule.department_id.blank? ? nil : self.schedule.department_id
    66:   end

private_event()

Devuelve siempre `true` porque las agendas privadas sólo contienen eventos privados.

[Source]

        # File app/models/schedule_event.rb, line 69
    69:   def private_event
    70:     true
    71:   end

private_event=(val)

Devuelve siempre `true` aunque se intente asignar otro valor a este campo.

[Source]

        # File app/models/schedule_event.rb, line 74
    74:   def private_event=(val)
    75:     true
    76:   end

schedule_name()

Devuelve el nombre de la agenda a la que pertenece el evento.

[Source]

         # File app/models/schedule_event.rb, line 124
    124:   def schedule_name
    125:     self.schedule.name
    126:   end

to_ics(cal) {|[:url] if block.present?| ...}

Devuelve el evento en formato ical.

[Source]

         # File app/models/schedule_event.rb, line 95
     95:   def to_ics(cal, &block)
     96:       if self.deleted?
     97:         cal.add_x_property('METHOD', 'CANCEL')
     98:       else
     99:         cal.add_x_property('METHOD', 'REQUEST')
    100:       end
    101:       cal.event do |event|
    102:         event.uid = "uid_" + self.id.to_s + "schedule_event_irekia_euskadi_net"
    103:         event.sequence = self.staff_alert_version
    104:         event.summary = self.title
    105:         event.description = self.body.strip_html #.gsub(/\n/, '\n')
    106:         event.dtstart =  self.starts_at.getutc.strftime("%Y%m%dT%H%M%SZ")
    107:         event.dtend = self.ends_at.getutc.strftime("%Y%m%dT%H%M%SZ")
    108:         event.location = self.pretty_place
    109:         event.url = yield[:url] if block.present?
    110:         event.created = self.created_at.getutc.strftime("%Y%m%dT%H%M%SZ")
    111:         event.last_modified = self.updated_at.getutc.strftime("%Y%m%dT%H%M%SZ")
    112:         event.dtstamp = Time.now.getutc.strftime("%Y%m%dT%H%M%SZ")
    113:         if self.deleted?
    114:           event.status = "CANCELLED"
    115:         elsif self.confirmed?
    116:           event.status = "TENTATIVE"
    117:         else
    118:           event.status = "CONFIRMED"
    119:         end
    120:       end
    121:   end

visibility_can_change?()

Indica si el evento se puede pasar a otra agenda.

Los eventos de las agendas que no tienen departamento, no pueden cambiar de agenda ni pueden transformarse en eventos compartidos.

[Source]

         # File app/models/schedule_event.rb, line 165
    165:   def visibility_can_change?
    166:     !self.schedule.department.nil?
    167:   end

[Validate]