Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- <div class="calendar_quote">
- <span class="quote_title"><center><h1>Important dates</h1></center></span>
- <br /><br />
- <% if @dates.blank? %>
- <p>Coming soon</p>
- <% else %>
- <ul id="important_dates">
- <% @dates.each do |d| %>
- <li>
- <%= content_tag d.description+': '+d.imp_date,
- {:action => 'list_upcoming', :id => d.id} %>
- </li>
- <% end %>
- </ul>
- <% end %>
- <h2>Paper Submission</h2>
- <p>Papers should be formatted according to the LNCS format and should not exceed 15 pages (including references and appendices). Papers in PDF or PS format can be sent to mud@cs.utwente.nl </p>
- ##
- class CalendarController < ApplicationController
- def self.list_upcoming
- @upcoming=Conference.find_upcoming_conferences_id
- @dates=ImportantDate.find_important_dates_by_conf_id(@upcoming)
- end
- end
- ##
- class Calendar < ActiveRecord::Base
- belongs_to :conference, :foreign_key => "conference_id", :primary_key => "id", :autosave => true
- has_many :important_dates, :dependent => :destroy
- validates_presence_of :year
- validates_length_of :year, :is=> 4
- validates_presence_of :conference_id, :message => " must be specified"
- validates_associated :conference_id
- def self.find_by_conf(*param)
- conference = Conference.find_by_year(*param)
- calendar = find(:all, :conditions => ["conference_id in (?)", conference])
- end
- def self.find_id_by_conf(*param)
- conference = Conference.find_by_year(*param)
- calendar = find(:all, :conditions => ["conference_id in (?)", conference],:select =>"id")
- end
- def self.find_id_by_conf_id(conf_id)
- calendar = find(:all, :conditions => ["conference_id in (?)", conf_id],:select =>"id")
- end
- def self.find_by_year(year)
- conference = Conference.find_by_year(year)
- calendar = find(:all, :conditions => ["conference_id in (?)", conference])
- end
- end
- ##
- class Conference < ActiveRecord::Base
- has_one :calendar, :primary_key => "id", :dependent => :destroy
- has_one :program , :dependent => :destroy
- has_many :committees, :dependent => :destroy
- has_many :participants, :dependent => :destroy
- validates_presence_of :website, :start_date, :end_date
- def year
- self.start_date.year
- end
- def self.find_by_year(*param)
- case param.length
- when 0
- conference = find(:all, :conditions => [ "year(start_date) = ? and title = ?", Date.today.year,"Management of Uncertain Data (MUD)"])
- when 1
- conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], "Management of Uncertain Data (MUD)"])
- when 2
- conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], param[1]])
- else
- puts "Check the number of parameters."
- end
- end
- def self.find_id_by_year(*param)
- case param.length
- when 0
- conference = find(:all, :conditions => [ "year(start_date) = ? and title = ?", Date.today.year,"Management of Uncertain Data (MUD)"], :select => "id")
- when 1
- conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], "Management of Uncertain Data (MUD)"], :select => "id")
- when 2
- conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], param[1]], :select => "id")
- else
- puts "Check the number of parameters."
- end
- end
- def self.find_by_title(conf)
- conference = find(:all, :conditions => ["title =?", conf])
- end
- def self.find_id_by_title(conf)
- conference = find(:all, :conditions => ["title =?", conf], :select => "id")
- end
- def self.find_previous_conferences
- conference = find(:all, :conditions => ["end_date <= ?", Date.today])
- end
- def self.find_upcoming_conferences
- conference = find(:all, :conditions => ["start_date >= ?", Date.today])
- end
- def self.find_previous_conferences_id
- conference = find(:all, :conditions => ["end_date <= ?", Date.today],:select=>"id")
- end
- def self.find_upcoming_conferences_id
- conference = find(:all, :conditions => ["start_date >= ?", Date.today],:select=>"id")
- end
- def self.find_link_previous_conferences
- conference = find(:all , :conditions => ["end_date <= ?", Date.today], :select => "website")
- end
- def self.find_link_upcoming_conferences
- conference = find(:all , :conditions => ["start_date >= ?", Date.today], :select => "website")
- end
- end
- ##
- class ImportantDate < ActiveRecord::Base
- belongs_to :calendar, :foreign_key => "calendar_id", :primary_key => "id", :autosave => true
- validates_presence_of :description, :imp_date, :conditions =>"year(imp_date)= calendar_year"
- validates_presence_of :calendar_id, :message => " must be specified"
- validates_associated :calendar_id
- def self.find_important_dates_by_conf(*param)
- cal_id= Calendar.find_id_by_conf(*param)
- imp_dates=find(:all, :conditions =>["calendar_id IN (?)",cal_id])
- end
- def self.find_important_dates_by_conf_id(conf_id)
- cal_id= Calendar.find_id_by_conf_id(conf_id)
- imp_dates=find(:all, :conditions =>["calendar_id IN (?)",cal_id])
- end
- end
Add Comment
Please, Sign In to add comment