tiss link

This commit is contained in:
Andreas Stephanides
2015-04-22 18:43:32 +02:00
parent 036f90e6e5
commit 224f2c6f83
2 changed files with 26 additions and 0 deletions

View File

@@ -86,6 +86,29 @@ class Lva < ActiveRecord::Base
url= "https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+semester url= "https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+semester
hash=Hash.from_xml(open(url).read)["tuvienna"] hash=Hash.from_xml(open(url).read)["tuvienna"]
end end
def tisslink
urlp="https://tiss.tuwien.ac.at/course/courseDetails.xhtml?courseNr="+ lvanr.to_s.gsub(".","")+"&"
urlp1 = "https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-"
begin
url= urlp+"semester="+Time.now.year.to_s+"W"
hash=Hash.from_xml(open(urlp1+Time.now.year.to_s+"W").read)["tuvienna"]
rescue OpenURI::HTTPError => e
begin
url= urlp+"semester="+Time.now.year.to_s+"S"
hash=Hash.from_xml(open(urlp1+Time.now.year.to_s+"S").read)["tuvienna"]
rescue OpenURI::HTTPError => e
begin
url= urlp+"semester="+(Time.now.year-1).to_s+"W"
hash=Hash.from_xml(open(urlp1+(Time.now.year-1).to_s+"W").read)["tuvienna"]
rescue OpenURI::HTTPError => e
end
end
end
url
end
def load_tissdata(semester) def load_tissdata(semester)
urlp="https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-" urlp="https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-"
begin begin

View File

@@ -24,6 +24,9 @@
<li> <li>
<%= link_to ffi1_icon("live2")+"ET-Forum", @lva.forumlink, class: :linkbox, itemprop: "discussionUrl" unless @lva.forumlink.nil? or @lva.forumlink.empty?%> <%= link_to ffi1_icon("live2")+"ET-Forum", @lva.forumlink, class: :linkbox, itemprop: "discussionUrl" unless @lva.forumlink.nil? or @lva.forumlink.empty?%>
</li> </li>
<li>
<%= link_to "TISS", @lva.tisslink, class: :linkbox %>
</li>
</ul> </ul>
<div itemprop="articleBody"> <div itemprop="articleBody">
<h2><%= I18n.t('lva.pruefungsinfo')%></h2> <h2><%= I18n.t('lva.pruefungsinfo')%></h2>