mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-07 15:19:31 +00:00
creating the controller/view/api base
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Profil extends Auth_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
|
||||
'getUser' => ['student/anrechnung_beantragen:r','user:r']
|
||||
]);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//echo = getAuthUID();
|
||||
|
||||
$this->load->view('Cis/Profil', ["uid" => getAuthUID()]);
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
$myObj = new stdClass();
|
||||
$myObj->name = "John";
|
||||
$myObj->age = 30;
|
||||
$myObj->city = "New York";
|
||||
echo json_encode($myObj);
|
||||
}
|
||||
|
||||
/*
|
||||
public function _remap($param)
|
||||
{
|
||||
/$uid wird als global variable weiter gegeben
|
||||
/get the data from the database with the uid
|
||||
/give the data to the view
|
||||
/put the queried data in global array and access properties needed in the specific view $profile_information = array()
|
||||
/$this -> load->view('Cis/StudentProfile', ["uid" => $uid])
|
||||
|
||||
|
||||
if ($param === 'some_method')
|
||||
{
|
||||
echo "if";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "else";
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$includesArray = array(
|
||||
'title' => 'Stundenplan',
|
||||
'customJSModules' => ['public/js/apps/Cis/ProfilApp.js'],
|
||||
'customCSSs' => ['public/css/components/calendar.css']
|
||||
);
|
||||
|
||||
$this->load->view('templates/CISHTML-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<div id="content">
|
||||
<h2>Profil</h2>
|
||||
<hr>
|
||||
<p><?php echo $uid; ?></p>
|
||||
<Profil></Profil>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/CISHTML-Footer', $includesArray); ?>
|
||||
@@ -0,0 +1,24 @@
|
||||
import Profil from "../../components/Cis/Profil/Profil.js";
|
||||
|
||||
import fhcapifactory from "../api/fhcapifactory.js";
|
||||
|
||||
Vue.$fhcapi = fhcapifactory;
|
||||
|
||||
const app = Vue.createApp({
|
||||
components: {
|
||||
Profil,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
stunden: [],
|
||||
events: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
testsearch: function() {
|
||||
return Vue.$fhcapi.UserData.getUser();
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
app.mount('#content');
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
function getUser(){
|
||||
echo "test";
|
||||
}
|
||||
|
||||
class Dummy extends Auth_Controller
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +1,7 @@
|
||||
import Search from "./search.js";
|
||||
import UserData from "./userdata.js";
|
||||
|
||||
export default {
|
||||
"Search": Search
|
||||
"Search": Search,
|
||||
"UserData": UserData
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
export default {
|
||||
|
||||
getUser: function() {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ 'Cis/Profil/getUser';
|
||||
return axios.get(url);
|
||||
},
|
||||
getUserDumy: function(){
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ 'public/js/apps/api/dummyapi.php/getUser';
|
||||
return axios.get(url);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
person: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
testsearch: function() {
|
||||
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.$parent.testsearch().then((res) => {
|
||||
this.person = res.data;
|
||||
});
|
||||
},
|
||||
|
||||
template: `
|
||||
<div>
|
||||
<h1>test</h1>
|
||||
<code>{{JSON.stringify(person)}}</code>
|
||||
</div>
|
||||
`,
|
||||
};
|
||||
Reference in New Issue
Block a user