Guest User

Untitled

a guest
May 27th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.88 KB | None | 0 0
  1. ##main\index.html.erb - line3
  2.  
  3. <h1 style="letter-spacing: 5px; color: #dadada;">News Bulletin SY <%=h @this_school.sy_from %>-<%=h @this_school.sy_to %><%unless gs? || hs?%>, <%=h @this_school.semester %><b><%= @this_school.semester == 'Summer' ? '' : ' Semester'%></b><% end %></h1>
  4.  
  5.  
  6. ##students/show_record.html.erb
  7.  
  8. <p style="text-align: center;"><i>GRADE</i></p>
  9. <%if @class_record_grade_h[index] != nil%>
  10. <table width=100% border=1>
  11. <tr bgcolor="black">
  12. <% @class_record_grade_h[index].each_with_index do |heading, hindex| %>
  13. <% unless hindex == 0 %><th><font color=white><%=h heading%></font></th><% end %>
  14. <%end%></tr>
  15.  
  16. <tr>
  17. <%@class_record_grade[index].each_with_index do |body, bindex|%>
  18. <% unless bindex == 0 %><th><%=h body%></th><% end %>
  19. <%end%>
  20. </tr>
  21. </table>
  22. <%else%>
  23. <p style="text-align: center;">
  24. <%= render :partial => '/main/notavailable' %>
  25. </p>
  26. <%end%>
  27.  
  28. ##school_infos_controller.rb
  29.  
  30. def update
  31.  
  32. if !params[:edit_button]
  33. pic_save
  34. else
  35. @school_info = SchoolInfo.find(1)
  36. @tempVar = @school_info.school_type
  37.  
  38. @sy_to = params[:school_info][:sy_to]
  39. @sy_from = params[:school_info][:sy_from]
  40.  
  41. diff = @sy_to - @sy_from
  42. if diff == 1
  43.  
  44. respond_to do |format|
  45. if @school_info.update_attributes(params[:school_info])
  46. if (@school_info.school_type != @tempVar)
  47. Course.destroy_all
  48. Student.destroy_all
  49. Account.destroy_all "accounttype = 'Student' or accounttype = 'Parent'"
  50. SchoolClass.destroy_all
  51. ClassRecord.destroy_all
  52. if @school_info.school_type != "College"
  53. Account.destroy_all "accounttype = 'Adviser' or accounttype = 'College-Admin' or accounttype = 'Dept-Admin' or accounttype = 'GS-Admin' or accounttype = 'HS-Admin'"
  54. if @school_info.school_type == "High school" # high school
  55. Account.create(:username => "hadmin", :password => "hadmin", :accounttype => "HS-Admin")
  56. @school_info.semester = "First"
  57. @school_info.save
  58. else # grade school
  59. Account.create(:username => "gadmin", :password => "gadmin", :accounttype => "GS-Admin")
  60. @school_info.semester = "First"
  61. @school_info.save
  62. end
  63. @courses = Course.find(:all)
  64. Course.create(:courseid => "this", :title => "this")
  65. Student.create(:student_no => "111111", :name => "Mike", :last_name => "Bibby", :year_level => "1", :course => "this")
  66. Account.create(:username => "111111", :password => "Bibby", :accounttype => "Student")
  67. Account.create(:username => "111111p", :password => "mrmrsBibby", :accounttype => "Parent")
  68. SchoolClass.create(:cat_no => "SIBIKA", :sec_no => "A", :teacher => "Batibot")
  69. SchoolClass.create(:cat_no => "SIBIKA2", :sec_no => "A1", :teacher => "Batibot Sr.")
  70. SchoolClass.create(:cat_no => "MATH", :sec_no => "1", :teacher => "Sesame")
  71. SchoolClass.create(:cat_no => "MATH2", :sec_no => "1A", :teacher => "Sesame Jr.")
  72. @course = Course.find(:first, :conditions => [ "courseid = 'this'"])
  73. CourseCurriculum.create(:subject => "SIBIKA", :year => "1", :semester => "First", :course_id => @course.id)
  74. CourseCurriculum.create(:subject => "MATH", :year => "1", :semester => "First", :course_id => @course.id)
  75. CourseCurriculum.create(:subject => "SIBIKA2", :year => "2", :semester => "First", :course_id => @course.id)
  76. CourseCurriculum.create(:subject => "MATH2", :year => "2", :semester => "First", :course_id => @course.id)
  77. end
  78. end
  79. flash[:notice] = 'Update successful.'
  80. flash[:error] = nil
  81. format.html { redirect_to(edit_school_info_path(@school_info)) }
  82. format.xml { head :ok }
  83. else
  84. format.html { render :action => "edit" }
  85. format.xml { render :xml => @school_info.errors, :status => :unprocessable_entity }
  86. end
  87. end
  88.  
  89. else
  90. flash[:error] = 'Invalid school year.'
  91. respond_to do |format|
  92. format.html { redirect_to(:controller=>'school_infos', :action=>'edit', :id=>1) }
  93. format.xml { head :ok }
  94. end
  95. end
  96. end
  97. end
  98.  
  99. end
  100.  
  101.  
  102. ##payments_info.rb
  103.  
  104. validates_numericality_of :prate, :irate, :iprate,
  105. :greater_than_or_equal_to => 0
  106.  
  107. ##courses\show.html.erb -->> aesthetic lang..lolz
  108.  
  109. <% if @students.empty? %>
  110.  
  111. <i>No students under this course.</i>
  112.  
  113. <% else %>
  114.  
  115. <% @school = SchoolInfo.find(1) %>
  116. <% for a in (1..@school.levels.to_i) %>
  117.  
  118. <center><div style="background-color: #FFEFAA;"><b><%= no_to_s(a) + ' Year' %></b></div></center>
  119. <ul>
  120. <% for student in @students %>
  121. <% if student.year_level.to_s == a.to_s%>
  122. <% if admin? %>
  123. <li> <%= link_to student.last_name + ", " + student.name, student %>
  124. <% else %>
  125. <li> <%= student.last_name + ", " + student.name %>
  126. <% end %>
  127. <% end %>
  128. <% end %>
  129. </ul>
  130. <% end %>
  131.  
  132. <% end %>
  133.  
  134. ##application_helper.rb -->> aesthetic lang..lolz
  135.  
  136. def no_to_s(number) # ordinal number to word -- good for 1- 10 only
  137. unit = ['Zeroth', 'First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eigth', 'Ninth', 'Tenth', '']
  138. return unit[number]
  139. end
  140.  
  141.  
  142. ##student_payments_controller.rb
  143.  
  144. def create
  145. @student_payment = StudentPayment.new(params[:student_payment])
  146. @id = params[:student_payment][:student_id]
  147. @amount = params[:student_payment][:amount]
  148. @payment_no = params[:student_payment][:payment_no]
  149.  
  150. @payment_no == '0' ? str='Initial' : str=@payment_no.to_i.ordinalize
  151.  
  152. respond_to do |format|
  153. if @student_payment.save
  154.  
  155. logthestuff(" #" + @student_payment.id.to_s + " Student: " + @id + " Amount: " + @amount + " CREATE")
  156.  
  157. flash[:notice] = 'Payment was successfully done.'
  158. format.html { redirect_to(:controller=> 'students', :action=> 'payment_tracking', :id=>@id) }
  159. format.xml { render :xml => @student_payment, :status => :created, :location => @student_payment }
  160.  
  161. else
  162. flash[:error] = str + ' payment was already checked before.'
  163. format.html { redirect_to(:controller=> 'students', :action=> 'payment_tracking', :id=>@id) }
  164. format.xml { render :xml => @student_payment.errors, :status => :unprocessable_entity }
  165. end
  166. end
  167. end
  168.  
  169. def create_in
  170. @student_payment = StudentPayment.new(params[:student_payment])
  171. @id = params[:student_payment][:student_id]
  172. @amount = params[:student_payment][:amount]
  173. @payment_no = params[:student_payment][:payment_no]
  174. @payment_no == '0' ? str='Initial' : str=@payment_no.to_i.ordinalize
  175.  
  176. respond_to do |format|
  177. if @student_payment.save
  178.  
  179. logthestuff(" #" + @student_payment.id.to_s + " Student: " + @id + " Amount: " + @amount + " CREATE")
  180.  
  181. flash[:notice] = 'Payment was successfully done.'
  182. format.html { redirect_to(:controller=> 'students', :action=> 'payment_tracking_list') }
  183. format.xml { render :xml => @student_payment, :status => :created, :location => @student_payment }
  184.  
  185. else
  186. flash[:error] = str + ' payment was already checked.'
  187. format.html { redirect_to(:controller=> 'students', :action=> 'payment_tracking_list') }
  188. format.xml { render :xml => @student_payment.errors, :status => :unprocessable_entity }
  189. end
  190. end
  191. end
  192.  
  193. ## student_payment.rb
  194.  
  195. validates_uniqueness_of :student_id, :scope => [:payment_no]
  196.  
  197.  
  198. ##school_classes_controller.rb - line 215, 1138, 1209 && records_controller.rb - line223
  199.  
  200. @teachers = Teacher.find(:all, :conditions => ['last_name LIKE ?', "%#{teacher_last_name}%"])
  201.  
  202. ## para sa date
  203.  
  204. date = Time.parse("January 1, 2008") # date here
  205. @date_str = date.strftime("%B_") + date.day.to_s + date.strftime("_%Y")
  206.  
  207. ##students/paid.html.erb - line 64 & students/unpaid.html.erb - line 78
  208.  
  209. <h4><% unless gs? || hs? %><%= @school.semester %><%= @school.semester == 'Summer' ? ', ' : ' Semester, '%><% end %><%= @skul_yr%></h4>
  210.  
  211. ##main\index.html.erb - line3
  212.  
  213. <h1 style="letter-spacing: 5px; color: #dadada;">News Bulletin SY <%=h @this_school.sy_from %>-<%=h @this_school.sy_to %><%unless gs? || hs?%>, <%=h @this_school.semester %><b><% @this_school.semester == 'Summer' ? '' : ' Semester'%></b><% end %></h1>
  214.  
  215.  
  216.  
  217.  
  218. ##school_classes_controller.rb - line 650
  219. if post == nil
  220. flash[:error] = 'Your file is more than 50kb.'
  221. flash[:notice] = nil
  222. elsif post == 0
  223. flash[:error] = 'There is no file to upload.'
  224. flash[:notice] = nil
  225. elsif post == -1
  226. flash[:error] = 'Unknown file format.'
  227. flash[:notice] = nil
  228. elsif post == -3
  229. flash[:error] = 'Your file is infected.'
  230. flash[:notice] = nil
  231. elsif @fake_file
  232. flash[:error] = 'There is an error on the file you uploaded.'
  233. flash[:notice] = nil
  234. else
  235. flash[:notice] = 'File uploaded.'
  236. flash[:error] = nil
  237. end
Add Comment
Please, Sign In to add comment