Skip to content
Snippets Groups Projects
Commit 6ad029b5 authored by xamgore's avatar xamgore
Browse files

Code formatting

parent 8222d61a
Branches
Tags
No related merge requests found
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_UserEnvi extends Controller {
class Controller_UserEnvi extends Controller
{
protected $UserInfo;
protected $SemesterInfo;
public function before()
{
public function before() {
$user = User::instance();
if(!$user->isSignedIn()) {
if (!$user->isSignedIn()) {
$this->redirect('sign', 302);
return;
}
}
$this->UserInfo = $user->getInfoAsArray();
$semester = Model_Semesters::getInfo($this->UserInfo['SemesterID']);
// $semester['Num'] = $semester['Num'] == 1 ? 'Осень' : 'Весна';
if($semester['Num'] == 1)
{
if ($semester['Num'] == 1) {
$semester['Num'] = 'Осень';
}
else
{
} else {
$semester['Num'] = 'Весна';
$semester['Year']++;
}
$this->SemesterInfo = $semester;
if($this->UserInfo['Type'] == 'student') {
if ($this->UserInfo['Type'] == 'student') {
//unified degree from db
$uniDegree = $this->UserInfo['Degree'];
$this->UserInfo['Degree'] = Model_Grades::getDegreeTitle($uniDegree);
......@@ -42,22 +39,19 @@ class Controller_UserEnvi extends Controller {
if ($userMark === 0) {
$userMark = (int)1;
}
if(!($bitmask & $userMark)) {
throw HTTP_Exception::factory(403,
'Не пытайтесь попасть туда, куда попадать не следует.');
if (!($bitmask & $userMark)) {
throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует.');
}
}
public function action_index()
{
public function action_index() {
$type = $this->UserInfo['Type'];
$page = Request::factory($type.'/index')->execute();
$page = Request::factory($type . '/index')->execute();
$this->response->body($page);
}
public function action_profile()
{
if($this->UserInfo['Type'] != 'teacher') {
public function action_profile() {
if ($this->UserInfo['Type'] != 'teacher') {
$this->redirect('/', 302);
} else {
$url = "teacher/profile";
......@@ -65,10 +59,9 @@ class Controller_UserEnvi extends Controller {
$this->response->body($page);
}
}
public function action_settings()
{
$page = Request::factory($this->UserInfo['Type'].'/settings')->execute();
public function action_settings() {
$page = Request::factory($this->UserInfo['Type'] . '/settings')->execute();
$this->response->body($page);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment