mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
PHPCI
This commit is contained in:
@@ -1,45 +1,54 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Main extends CI_Controller {
|
||||
|
||||
function __construct()
|
||||
class Main extends CI_Controller
|
||||
{
|
||||
/**
|
||||
* Load Database und the url-helper
|
||||
**/
|
||||
private function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/* Standard Libraries of codeigniter are required */
|
||||
// Standard Libraries of codeigniter are required
|
||||
$this->load->database();
|
||||
$this->load->helper('url');
|
||||
/* ------------------ */
|
||||
|
||||
// Test the grocery CRUD
|
||||
$this->load->library('grocery_CRUD');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Welcome Page by default
|
||||
* @return void
|
||||
**/
|
||||
public function index()
|
||||
{
|
||||
echo "<h1>Welcome to the world of Codeigniter</h1>";
|
||||
//Just an example to ensure that we get into the function die();
|
||||
}
|
||||
|
||||
public function index()
|
||||
/**
|
||||
* Test grocery CRUD for tbl_person
|
||||
* @return void
|
||||
**/
|
||||
public function person()
|
||||
{
|
||||
echo "<h1>Welcome to the world of Codeigniter</h1>";//Just an example to ensure that we get into the function
|
||||
die();
|
||||
}
|
||||
|
||||
public function prestudent()
|
||||
{
|
||||
$this->grocery_crud->set_table('tbl_prestudent');
|
||||
$this->grocery_crud->set_table('tbl_pperson');
|
||||
$output = $this->grocery_crud->render();
|
||||
|
||||
echo "<pre>";
|
||||
print_r($output);
|
||||
echo "</pre>";
|
||||
die();
|
||||
//die();
|
||||
|
||||
$this->_example_output($output);
|
||||
$this->__exampleOutput($output);
|
||||
}
|
||||
|
||||
function _example_output($output = null)
|
||||
|
||||
|
||||
/**
|
||||
* example Output
|
||||
* @param string $output The HTML-Output from grocery.
|
||||
* @return void
|
||||
**/
|
||||
private function __exampleOutput($output = null)
|
||||
{
|
||||
$this->load->view('our_template.php',$output);
|
||||
$this->load->view('our_template.php', $output);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file main.php */
|
||||
/* Location: ./application/controllers/main.php */
|
||||
|
||||
@@ -2,15 +2,138 @@
|
||||
|
||||
class Migrate extends CI_Controller
|
||||
{
|
||||
private $class_version = '1.0';
|
||||
private $cli = false;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('migration');
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ($this->migration->current() === FALSE)
|
||||
{
|
||||
show_error($this->migration->error_string());
|
||||
}
|
||||
if ($this->input->is_cli_request())
|
||||
{
|
||||
$cli=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//$this->output->set_status_header(403, 'Migrations must be run from the CLI');
|
||||
//exit;
|
||||
}
|
||||
$this->load->database('system'); //Use the system-Connection for DB-Manipulation
|
||||
$this->load->library('migration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate to latest or current version
|
||||
*
|
||||
* @param string $version One of either "latest" or "current"
|
||||
*/
|
||||
public function index($version = 'latest')
|
||||
{
|
||||
|
||||
if ($this->cli && $this->migration->current() === FALSE)
|
||||
{
|
||||
show_error($this->migration->error_string());
|
||||
}
|
||||
elseif ($version != 'latest' && $version != 'current')
|
||||
{
|
||||
$this->_failed('Migration version must be either latest or current');
|
||||
}
|
||||
|
||||
if (!$this->migration->$version())
|
||||
{
|
||||
$this->_failed();
|
||||
}
|
||||
|
||||
$this->_succeeded();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Migrate to a specific version
|
||||
*/
|
||||
public function version()
|
||||
{
|
||||
if ($version == 'latest' || $version == 'current')
|
||||
{
|
||||
$this->index($version);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$this->migrate->version($version))
|
||||
{
|
||||
$this->_failed();
|
||||
}
|
||||
|
||||
$this->_succeeded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll-back to the last version before current
|
||||
*
|
||||
* @param int $version The migration to rollback to, defaults to previous
|
||||
*/
|
||||
public function rollback($version = null)
|
||||
{
|
||||
if (is_null($version))
|
||||
{
|
||||
$version = $this->_get_version() ?: 1;
|
||||
$version--;
|
||||
}
|
||||
|
||||
// Check it's definitely false, we could be rolling back to v0
|
||||
if (false === $this->migration->version($version))
|
||||
{
|
||||
$this->_failed();
|
||||
}
|
||||
|
||||
$this->_succeeded('rolled back');
|
||||
}
|
||||
|
||||
/**
|
||||
* ROLLBACK ALL THE THINGS!
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
$this->rollback(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Yay, it worked! Tell the user.
|
||||
*
|
||||
* @param string $task What did we just do? We...
|
||||
*/
|
||||
private function _succeeded($task = 'migrated')
|
||||
{
|
||||
$version = $this->_get_version();
|
||||
exit('Successfully '.$task.' to version '.$version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an error message when it all goes tits up
|
||||
*
|
||||
* @param string $message Error to output (default to CI's migration error)
|
||||
*/
|
||||
private function _failed($message = null)
|
||||
{
|
||||
$message = $message ?: $this->migration->error_string();
|
||||
show_error($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Carbon copy of parent::_get_version, but that's protected.
|
||||
*
|
||||
* @return int Currently installed migration number
|
||||
*/
|
||||
private function _get_version()
|
||||
{
|
||||
$row = $this->db->get('ci_migrations')->row();
|
||||
return $row ? $row->version : 0;
|
||||
}
|
||||
|
||||
public function about()
|
||||
{
|
||||
echo "CI-Migrate_CLI v".$this->class_version;
|
||||
echo "\nCheck http://github.com/dshoreman/ci-migrate_cli/ for updates";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
class Person extends API_Controller
|
||||
class Person extends REST_Controller
|
||||
{
|
||||
//public $session;
|
||||
/**
|
||||
* Person API constructor.
|
||||
*/
|
||||
function __construct()
|
||||
private function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -64,5 +64,4 @@ class Person extends API_Controller
|
||||
// Set the response and exit
|
||||
$this->response($payload, $httpstatus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
<?php
|
||||
class Person extends FHC_Controller {
|
||||
class Person extends FHC_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('person/person_model');
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('person/person_model');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['person'] = $this->person_model->getPersonen();
|
||||
$data['title'] = 'Personen Archiv';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['person'] = $this->person_model->getPersonen();
|
||||
$data['title'] = 'Personen Archiv';
|
||||
$this->load->view('templates/header', $data);
|
||||
$this->load->view('person/index', $data);
|
||||
$this->load->view('templates/footer');
|
||||
}
|
||||
|
||||
$this->load->view('templates/header', $data);
|
||||
$this->load->view('person/index', $data);
|
||||
$this->load->view('templates/footer');
|
||||
}
|
||||
public function view($slug = null)
|
||||
{
|
||||
$data['person_item'] = $this->person_model->getPersonen($slug);
|
||||
if (empty($data['person_item']))
|
||||
show_404();
|
||||
|
||||
public function view($slug = NULL)
|
||||
{
|
||||
$data['person_item'] = $this->person_model->getPersonen($slug);
|
||||
if (empty($data['person_item']))
|
||||
{
|
||||
show_404();
|
||||
}
|
||||
$data['title'] = $data['person_item']->titelpre;
|
||||
|
||||
$data['title'] = $data['person_item']->titelpre;
|
||||
|
||||
$this->load->view('templates/header', $data);
|
||||
$this->load->view('person/view', $data);
|
||||
$this->load->view('templates/footer');
|
||||
}
|
||||
$this->load->view('templates/header', $data);
|
||||
$this->load->view('person/view', $data);
|
||||
$this->load->view('templates/footer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +1,74 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Basic extends CI_Controller {
|
||||
class Basic extends CI_Controller
|
||||
{
|
||||
/**
|
||||
* Loading the rdf-Library and Form- and Url-Helper
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library(array('rdf'));
|
||||
$this->load->helper(array('form', 'url'));
|
||||
}
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library(array('rdf'));
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
}
|
||||
/**
|
||||
* Load Basic View
|
||||
* @return void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->load->library('Rdf');
|
||||
|
||||
$d['title'] = '';
|
||||
|
||||
|
||||
$d['content']= $this->load->view('rdf/basic',$d,true);
|
||||
$this->load->view('home',$d);
|
||||
$d['content'] = $this->load->view('rdf/basic', $d, true);
|
||||
$this->load->view('home', $d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Sparql-View
|
||||
* @return void
|
||||
*/
|
||||
public function sparql()
|
||||
{
|
||||
|
||||
$this->load->library('Rdf');
|
||||
|
||||
$d['title'] = '';
|
||||
|
||||
|
||||
$d['content']= $this->load->view('rdf/basic_sparql',$d,true);
|
||||
$this->load->view('home',$d);
|
||||
$d['content'] = $this->load->view('rdf/basic_sparql', $d, true);
|
||||
$this->load->view('home', $d);
|
||||
}
|
||||
public function foafinfo()
|
||||
|
||||
/**
|
||||
* Load foaf-View
|
||||
* @return void
|
||||
*/
|
||||
public function foafinfo()
|
||||
{
|
||||
|
||||
$this->load->library('Rdf');
|
||||
|
||||
|
||||
|
||||
$d['title'] = '';
|
||||
|
||||
|
||||
$d['content']= $this->load->view('rdf/foafinfo',$d,true);
|
||||
$this->load->view('home',$d);
|
||||
$d['content'] = $this->load->view('rdf/foafinfo', $d, true);
|
||||
$this->load->view('home', $d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load foafmaker View
|
||||
* @return void
|
||||
*/
|
||||
public function foafmaker()
|
||||
{
|
||||
|
||||
$d['title'] = '';
|
||||
|
||||
|
||||
$d['content']= $this->load->view('rdf/foafmaker',$d,true);
|
||||
$this->load->view('home',$d);
|
||||
$d['content'] = $this->load->view('rdf/foafmaker', $d, true);
|
||||
$this->load->view('home', $d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load converter View
|
||||
* @return void
|
||||
*/
|
||||
public function converter()
|
||||
{
|
||||
|
||||
$d['title'] = '';
|
||||
|
||||
$d['content']= $this->load->view('rdf/converter',$d,true);
|
||||
$this->load->view('home',$d);
|
||||
$d['content'] = $this->load->view('rdf/converter', $d, true);
|
||||
$this->load->view('home', $d);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user