45 lines
746 B
PHP
45 lines
746 B
PHP
|
<?php
|
||
|
/**
|
||
|
* Created by PhpStorm.
|
||
|
* User: lucas
|
||
|
* Date: 15/03/18
|
||
|
* Time: 11:47
|
||
|
*/
|
||
|
|
||
|
namespace api\module;
|
||
|
|
||
|
|
||
|
use database\core\Repo;
|
||
|
use database\repo\professor;
|
||
|
|
||
|
class departementController
|
||
|
{
|
||
|
|
||
|
public function put($args){
|
||
|
|
||
|
$department = 0;
|
||
|
|
||
|
extract($args);
|
||
|
|
||
|
/** @var professor $prof_repo */
|
||
|
$prof_repo = Repo::getRepo('professor');
|
||
|
|
||
|
$deps = $prof_repo->getLinkedDepartment($_SESSION['CAS']['login']);
|
||
|
|
||
|
if(is_array($deps)){
|
||
|
foreach ($deps as $dep){
|
||
|
if($dep["idDep"] == $department){
|
||
|
$_SESSION["AvailableDepartment"] = $deps;
|
||
|
$_SESSION['CurrentDatabase'] = $dep["dbName"];
|
||
|
$_SESSION['CurrentDepartementId'] = $dep["idDep"];
|
||
|
|
||
|
return ["success" => true];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return ["success" => false];
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|