game/core1/app/logic/admin.php
2022-06-07 00:30:34 +03:00

66 lines
1.4 KiB
PHP

<?
namespace Logic;
use \Core\View as view;
class Admin {
/*
@ Áàçîâûé ìåòîä íà÷àë ãåíèðàöèè ìîäóëÿ
@ Çäåñü ïðîèñõîäèò îïðåäåëåíèå òèïà äàííûõ, à òàê-æå
@ ïðîâåðêà âîçìîæíîñòè ïðîñìîòðà äàííîãî ìîäóëÿ
@ âñå ïîääêëþ÷àåìûå êëàññû äîëæíû áûòü ÍÅÎÁÕÎÄÈÌÛÌÈ!
*/
public static function defaultAction() {
//Ïîäêëþ÷àåì ïàêåòû
\Core\User::connect();
\Core\User::room();
if (\Core\User::$data == false ) {
//Íåò äîñòóïà, ïåðñîíàæ íå àâòîðèçèðîâàí èëè çàáëîêèðîâàí
echo 'Àâòîðèçèðóéòåñü ÷åðåç <a href="/index.php">ãëàâíóþ ñòðàíèöó</a>.';
}elseif( stristr($_SERVER['HTTP_ACCEPT'],'application/json') == true ) {
echo self::getJSON();
}else{
echo self::getHTML();
}
}
/*
@ Ìåòîä âûâîäÿùèé HTML-êîíòåíò íà ñòîðîíó ïîëüçîâàòåëÿ
@ ×åðåç êîíêðåòíûé øàáëîíèçàòîð
*/
public static function getHTML() {
//PC âåðñèÿ ãëàâíîé ñòðàíèöû
//
return view::generateTpl( 'admin', array(
'title' => COPY . ' :: Ïàíåëü àäìèíà',
//Ïåðåäàåì äàííûå ïàêåòîâ
'user' => \Core\User::$data,
'stats' => \Core\User::$stats,
'room' => \Core\User::$room,
'OK' => OK,
'copy' => COPY,
'rights' => RIGHTS,
'ver' => '0.0.1'
) );
}
/*
@ Ìåòîä âûâîäÿùèé JSON-êîíòåíò íà ñòîðîíó ïîëüçîâàòåëÿ
@ Èíôîðìàöèÿ áåðåòñÿ èç ïåðåìåííîé self::$JSON
*/
public static function getJSON() {
$r = array();
return \Core\Utils::jsonencode( $r );
}
}
?>