Guest User

Untitled

a guest
Jul 22nd, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. ##
  2. <div class="calendar_quote">
  3. <span class="quote_title"><center><h1>Important dates</h1></center></span>
  4. <br /><br />
  5.  
  6. <% if @dates.blank? %>
  7. <p>Coming soon</p>
  8. <% else %>
  9. <ul id="important_dates">
  10. <% @dates.each do |d| %>
  11. <li>
  12. <%= content_tag d.description+': '+d.imp_date,
  13. {:action => 'list_upcoming', :id => d.id} %>
  14. </li>
  15. <% end %>
  16. </ul>
  17. <% end %>
  18.  
  19. <h2>Paper Submission</h2>
  20. <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>
  21.  
  22.  
  23. ##
  24.  
  25. class CalendarController < ApplicationController
  26. def self.list_upcoming
  27. @upcoming=Conference.find_upcoming_conferences_id
  28. @dates=ImportantDate.find_important_dates_by_conf_id(@upcoming)
  29.  
  30. end
  31. end
  32.  
  33. ##
  34.  
  35. class Calendar < ActiveRecord::Base
  36. belongs_to :conference, :foreign_key => "conference_id", :primary_key => "id", :autosave => true
  37. has_many :important_dates, :dependent => :destroy
  38. validates_presence_of :year
  39. validates_length_of :year, :is=> 4
  40. validates_presence_of :conference_id, :message => " must be specified"
  41. validates_associated :conference_id
  42. def self.find_by_conf(*param)
  43. conference = Conference.find_by_year(*param)
  44. calendar = find(:all, :conditions => ["conference_id in (?)", conference])
  45. end
  46. def self.find_id_by_conf(*param)
  47. conference = Conference.find_by_year(*param)
  48. calendar = find(:all, :conditions => ["conference_id in (?)", conference],:select =>"id")
  49. end
  50. def self.find_id_by_conf_id(conf_id)
  51. calendar = find(:all, :conditions => ["conference_id in (?)", conf_id],:select =>"id")
  52. end
  53. def self.find_by_year(year)
  54. conference = Conference.find_by_year(year)
  55. calendar = find(:all, :conditions => ["conference_id in (?)", conference])
  56. end
  57. end
  58.  
  59. ##
  60.  
  61. class Conference < ActiveRecord::Base
  62. has_one :calendar, :primary_key => "id", :dependent => :destroy
  63. has_one :program , :dependent => :destroy
  64. has_many :committees, :dependent => :destroy
  65. has_many :participants, :dependent => :destroy
  66. validates_presence_of :website, :start_date, :end_date
  67. def year
  68. self.start_date.year
  69. end
  70. def self.find_by_year(*param)
  71. case param.length
  72. when 0
  73. conference = find(:all, :conditions => [ "year(start_date) = ? and title = ?", Date.today.year,"Management of Uncertain Data (MUD)"])
  74. when 1
  75. conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], "Management of Uncertain Data (MUD)"])
  76. when 2
  77. conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], param[1]])
  78. else
  79. puts "Check the number of parameters."
  80. end
  81. end
  82. def self.find_id_by_year(*param)
  83. case param.length
  84. when 0
  85. conference = find(:all, :conditions => [ "year(start_date) = ? and title = ?", Date.today.year,"Management of Uncertain Data (MUD)"], :select => "id")
  86. when 1
  87. conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], "Management of Uncertain Data (MUD)"], :select => "id")
  88. when 2
  89. conference = find(:all, :conditions => ["year(start_date) = ? and title = ?", param[0], param[1]], :select => "id")
  90. else
  91. puts "Check the number of parameters."
  92. end
  93. end
  94. def self.find_by_title(conf)
  95. conference = find(:all, :conditions => ["title =?", conf])
  96. end
  97. def self.find_id_by_title(conf)
  98. conference = find(:all, :conditions => ["title =?", conf], :select => "id")
  99. end
  100. def self.find_previous_conferences
  101. conference = find(:all, :conditions => ["end_date <= ?", Date.today])
  102. end
  103. def self.find_upcoming_conferences
  104. conference = find(:all, :conditions => ["start_date >= ?", Date.today])
  105. end
  106. def self.find_previous_conferences_id
  107. conference = find(:all, :conditions => ["end_date <= ?", Date.today],:select=>"id")
  108. end
  109. def self.find_upcoming_conferences_id
  110. conference = find(:all, :conditions => ["start_date >= ?", Date.today],:select=>"id")
  111. end
  112. def self.find_link_previous_conferences
  113. conference = find(:all , :conditions => ["end_date <= ?", Date.today], :select => "website")
  114. end
  115. def self.find_link_upcoming_conferences
  116. conference = find(:all , :conditions => ["start_date >= ?", Date.today], :select => "website")
  117. end
  118. end
  119.  
  120. ##
  121.  
  122. class ImportantDate < ActiveRecord::Base
  123. belongs_to :calendar, :foreign_key => "calendar_id", :primary_key => "id", :autosave => true
  124. validates_presence_of :description, :imp_date, :conditions =>"year(imp_date)= calendar_year"
  125. validates_presence_of :calendar_id, :message => " must be specified"
  126. validates_associated :calendar_id
  127. def self.find_important_dates_by_conf(*param)
  128. cal_id= Calendar.find_id_by_conf(*param)
  129. imp_dates=find(:all, :conditions =>["calendar_id IN (?)",cal_id])
  130. end
  131. def self.find_important_dates_by_conf_id(conf_id)
  132. cal_id= Calendar.find_id_by_conf_id(conf_id)
  133. imp_dates=find(:all, :conditions =>["calendar_id IN (?)",cal_id])
  134. end
  135. end
Add Comment
Please, Sign In to add comment