REST Service for POPCORN - ILIAS
alex
2025-06-03 39c750d6c090be68003c4631f427ed13d8e282da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<script setup>
 
import {useRoute} from 'vue-router'
import {onMounted, reactive, ref} from "vue"
import {getKurs, getKursItems, getKursTn, iliasBase} from "../lib/api.js"
import LinkExtern from "../components/LinkExtern.vue"
 
const route = useRoute()
const kursId = route.params.kursId
const kurs = ref(null)
const kursItems = ref(null)
const kursTn = ref(null)
const error = ref(null)
 
onMounted(init)
 
/////////////////////////////////////////////////////////////////////////
 
async function init () {
   const dataKurs = await getKurs(kursId)
   console.log(dataKurs)
   kurs.value = dataKurs
 
   const dataKursItems = await getKursItems(kursId)
   console.log(dataKursItems)
   kursItems.value = dataKursItems
 
   const dataKursTn = await getKursTn(kursId)
   console.log(dataKursTn)
   kursTn.value = dataKursTn
}
 
</script>
 
<template>
 
   <div>
      <h1>
         Kurs
         <small>{{ kurs?.title }}</small>
         <!--         <small>{{ user?.firstname }} {{ user?.lastname }}</small>-->
      </h1>
      <p v-if="error">{{ error }}</p>
 
 
      <div class="user" v-if="kurs">
 
         <span>ref_id</span>
         <div>
            <a :href="`${iliasBase}/goto.php?target=${kurs.type}_${kurs.ref_id}`" target="_blank">
               {{ kurs.ref_id }} <LinkExtern />
            </a>
         </div>
 
         <span>obj_id</span>
         <div>{{ kurs.obj_id }}</div>
 
         <span style="margin-top: 1em;">title</span>
         <div style="grid-column: span 3; margin-top: 1em">{{ kurs.title }}</div>
 
         <span>description</span>
         <div style="grid-column: span 3">{{ kurs.description }}</div>
 
      </div>
 
      <h2>
         KursItems
         <small>({{ kursItems?.length }})</small>
      </h2>
      <table>
         <thead>
            <th>parent_id</th>
            <th>ref_id</th>
            <th>obj_id</th>
            <th>title</th>
            <th>type</th>
         </thead>
         <tbody>
            <!-- TODO verlinken auf Ziel in ILAS | goto.php?target=crs_ID -->
            <tr v-for="item in kursItems">
               <td>{{ item.parent_id }}</td>
               <td>
                  <a :href="`${iliasBase}/goto.php?target=${item.type}_${item.ref_id}`" target="_blank">
                     {{ item.ref_id }} <LinkExtern />
                  </a>
               </td>
               <td>{{ item.obj_id }}</td>
               <td>{{ item.title }}</td>
               <td>{{ item.type }}</td>
            </tr>
         </tbody>
      </table>
 
      <h2>
         KursTn
         <small>({{ kursTn?.length }})</small>
      </h2>
      <div :style="{columns: kursTn?.length > 16 ? 3 : 1}">
         <table>
            <thead>
               <th>usr_id</th>
               <th>login</th>
               <th>firstname</th>
               <th>lastname</th>
            </thead>
            <tbody>
               <tr v-for="tn in kursTn">
                  <td>
                     <RouterLink :to="`/ui/user/${tn.usr_id}`">{{ tn.usr_id }}</RouterLink>
                  </td>
                  <td>{{ tn.login }}</td>
                  <td>{{ tn.firstname }}</td>
                  <td>{{ tn.lastname }}</td>
               </tr>
            </tbody>
         </table>
      </div>
 
   </div>
 
</template>
 
<style scoped>
 
</style>