Created
December 30, 2014 11:35
-
-
Save Tjoosten/c9defb41e34d9770a5af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// controller: | |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
// Call the autoload for GitHub API | |
require_once 'vendor/autoload.php'; | |
class Issues extends CI_Controller { | |
// Constructor code | |
public $GitHub = array(); | |
public $Credentials = array(); | |
public function __construct() { | |
parent::__construct(); | |
$this->GitHub = new \Github\Client(); | |
$this->Credentails = $this->session->userdata('Credentails'); | |
} | |
// END constructor code | |
public function index() { | |
// Variables | |
$Data = array( | |
'Title' => 'Yarv! | Issues', | |
'repositories' => $this->GitHub->api('user')->repositories('tjoosten'), | |
); | |
// Views | |
$this->load->view('components/header', $Data); | |
$this->load->view('components/navbar'); | |
$this->load->view('Issues', $Data); | |
$this->load->view('components/footer'); | |
} | |
} | |
// Views: | |
<li class="list-group-item"> | |
<span class="octicon octicon-person"> </span> | |
<span class="pull-right"> <?php echo $this->Credentials['User']; ?> </span> | |
</li> | |
<li class="list-group-item"> | |
<span class="octicon octicon-repo"> </span> | |
<span class="pull-right"> <?php echo $this->Credentails['Repository']; ?> </span> | |
</li> | |
// Session controller: | |
$Values = array( | |
'User' => $this->input->post('User'), | |
'Repository' => $this->input->post('Repo'), | |
); | |
$this->session->set_userdata('Credentails', $Values); | |
redirect($_SERVER['HTTP_REFERER']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment