lecturer load lva load first steps

This commit is contained in:
Andreas Stephanides
2014-03-16 11:19:10 +01:00
parent bc455fcf06
commit 4ac7b41a7f
6 changed files with 36 additions and 9 deletions

View File

@@ -36,6 +36,17 @@ class LvasController < ApplicationController
end
def compare_tiss
end
def load_tiss
end
# POST /lvas
# POST /lvas.json
def create

View File

@@ -8,6 +8,7 @@ class ModulsController < ApplicationController
if !params[:studium_id].nil?
@studium=Studium.find_by_id(params[:studium_id])
end
@toolbar_elements = [{:hicon=>'icon-plus-sign', :text=>I18n.t("modul.add"), :path=>new_modul_path}]
@topbar_elements =[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}]
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}

View File

@@ -16,4 +16,16 @@ class Lecturer < ActiveRecord::Base
has_and_belongs_to_many :lvas
mount_uploader :picture, PictureUploader
resourcify
def load_tissdata
url= "https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/"+self.oid.to_s+".xml"
hash=Hash.from_xml(open(url).read)["tuvienna"]
self.name=hash["person"]["firstname"]+" "+hash["person"]["lastname"]
if hash["person"]["employee"]["employment"].is_a? Array
self.email= hash["person"]["employee"]["employment"].first["emails"]["email"].first
else
self.email= hash["person"]["employee"]["employment"]["emails"]["email"].first
end
self.link= "https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/"+self.oid.to_s
end
end

View File

@@ -1,6 +1,6 @@
<div class="media">
<a class="pull-left" href="#">
<img class="media-object img" src="<%= lec_lva.picture.thumb.url %>"/>
<img class="media-object img" src="<%= lec_lva.picture.thumb.url unless lec_lva.picture.nil? %>"/>
</a>
<div class="media-body">
<h4><%= link_to lec_lva.name, lec_lva %></h4>

View File

@@ -1,5 +1,8 @@
<p id="notice"><%= notice %></p>
<%= render partial: "lec_lva", object: @lecturer %>
<p>
<b>Name:</b>
<%= @lecturer.name %>