An error occurred while loading the file. Please try again.
-
xamgore authored21a69d36
Forked from
it-lab / grade
Source project has a limited visibility.
Students.php 1.50 KiB
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Admin_Students extends Controller_UserEnvi {
public function action_index()
{
// VIEW
$twig = Twig::factory('admin/students/index');
$twig->Faculties = Model_Faculties::toArray();
$twig->Grades = Model_Grades::toStructuredArray();
$twig->User = $this->UserInfo;
$this->response->body($twig);
}
public function action_add()
{
$twig = Twig::factory('admin/students/add');
$twig->Faculties = Model_Faculties::toArray();
$twig->Grades = Model_Grades::toStructuredArray();
$twig->User = $this->UserInfo;
$this->response->body($twig);
}
public function action_upload()
{
if(!empty($_FILES['students']) AND $this->request->method() == 'POST')
{
$result = $this->parseFile($_FILES["students"]["tmp_name"]);
}
// VIEW
$twig = Twig::factory('admin/students/upload');
$twig->Faculties = Model_Faculties::toArray();
$twig->UploadingResult = $result;
$twig->User = $this->UserInfo;
$this->response->body($twig);
}
public function action_edit()
{
$twig = Twig::factory('admin/students/edit');
$twig->User = $this->UserInfo;
$this->response->body($twig);
}
protected function parseFile($filename)
{
return FileParser::StudentsList($filename, $_POST['facultyID']);
}
}