Module: ConferenceManager::Models::ConferenceManagerSession::InstanceMethods

Defined in:
lib/conference_manager/models/conference_manager_session.rb

Instance Method Summary collapse

Instance Method Details

#can_edit_hours?Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/conference_manager/models/conference_manager_session.rb', line 139

def can_edit_hours?
  !(event.uses_conference_manager? && past?)
end

#change_status(new_status) ⇒ Object

method that changes the recording status of this session remember that the rest of the sessions of this event will stop the recording if you init one



181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/conference_manager/models/conference_manager_session.rb', line 181

def change_status(new_status)
  cm_status = status
  new_params = {:event_id => event.cm_event_id,
    :session_id => cm_session_id,
    :status => new_status}
  cm_status.load(new_params)
  begin
    cm_status.save
  rescue => e
    if cm_status.present?
      errors.add_to_base(e.to_s)
    end
  end
end

#check_published_recordingObject

method to check if the video has been published either by the user or because the event has finished



198
199
200
201
202
# File 'lib/conference_manager/models/conference_manager_session.rb', line 198

def check_published_recording
  cm_status = status
  debugger
  puts "hola"
end

#cm_sessionObject



109
110
111
112
113
114
115
116
117
# File 'lib/conference_manager/models/conference_manager_session.rb', line 109

def cm_session
  begin
    @cm_session ||=
    ConferenceManager::Session.find(cm_session_id,
    :params => { :event_id => event.cm_event_id })
  rescue
    nil
  end
end

#cm_session=(cms_s) ⇒ Object



119
120
121
122
# File 'lib/conference_manager/models/conference_manager_session.rb', line 119

def cm_session=(cms_s)
  self.cm_session_id = cms_s.id
  @cm_session = cms_s
end

#cm_session?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/conference_manager/models/conference_manager_session.rb', line 124

def cm_session?
  cm_session.present?
end

#editor(width, height) ⇒ Object

Return a String that contains a html with the video editor for this session



165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/conference_manager/models/conference_manager_session.rb', line 165

def editor(width, height)
  begin
    @cm_player_session ||=
    ConferenceManager::EditorSession.find(:player,
    :params => { :event_id => event.cm_event_id,
      :session_id => cm_session.id,
      :width => width,
      :height => height})
    @cm_player_session.html
  rescue
    nil
  end
end

#player(width, height) ⇒ Object

Return a String that contains a html with the video player for this session



145
146
147
# File 'lib/conference_manager/models/conference_manager_session.rb', line 145

def player
  player("640","480")
end

#session_statusObject

method to get the session status it can be any in SESSION_STATUS



206
207
208
209
210
211
# File 'lib/conference_manager/models/conference_manager_session.rb', line 206

def session_status
  cm_status = status
  if cm_status
    cm_status.attributes["status"]
  end
end

#start_recordingObject

method to start the recording remember that the rest of the sessions of this event will stop the recording



215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/conference_manager/models/conference_manager_session.rb', line 215

def start_recording
  cm_status = status
  new_params = {:event_id => event.cm_event_id,
    :session_id => cm_session_id,
    :status => SESSION_STATUS[:recording]}
  cm_status.load(new_params)
  begin
    cm_status.save
  rescue => e
    if cm_status.present?
      errors.add_to_base(e.to_s)
    end
  end
end

#statusObject



128
129
130
131
132
133
134
135
136
137
# File 'lib/conference_manager/models/conference_manager_session.rb', line 128

def status
  begin
    @session_status ||=
    ConferenceManager::SessionStatus.find(:status,
    :params => { :event_id => event.cm_event_id,
      :session_id => cm_session_id})
  rescue
    nil
  end
end

#stop_recordingObject

method to stop the recording



231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/conference_manager/models/conference_manager_session.rb', line 231

def stop_recording
  cm_status = status
  new_params = {:event_id => event.cm_event_id,
    :session_id => cm_session_id,
    :status => SESSION_STATUS[:recorded]}
  cm_status.load(new_params)
  begin
    cm_status.save
  rescue => e
    if cm_status.present?
      errors.add_to_base(e.to_s)
    end
  end
end