<?php
class saimod_mojotrollz_server_handling extends \SYSTEM\SAI\SaiModule {    
    public static function sai_mod_saimod_mojotrollz_server_handling(){       
        $vars = array();
        $vars['status_realm'] = self::sai_mod_saimod_mojotrollz_server_handling_action_realmstatus();
        $vars['status_world'] = self::sai_mod_saimod_mojotrollz_server_handling_action_worldstatus();
        return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/main.tpl', $vars);}            
    public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_mojotrollz_server_handling">server handling</a></li><li class="divider"></li>';}
    public static function right_public(){return false;}    
    public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
    public static function sai_mod_saimod_mojotrollz_server_handling_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array(
            \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.js')
    ));}
    public static function sai_mod_saimod_mojotrollz_server_handling_flag_css(){}
    
    public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstart(){
        return shell_exec('/home/mojotrolls/mojo_zero/realm start 2>&1');}
    public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstop(){
        return shell_exec('/home/mojotrolls/mojo_zero/realm stop 2>&1');}
    public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstatus(){
        return shell_exec('/home/mojotrolls/mojo_zero/realm status 2>&1');}
    public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstart(){
        return shell_exec('/home/mojotrolls/mojo_zero/world start 2>&1');}
    public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstop(){
        return shell_exec('/home/mojotrolls/mojo_zero/world stop 2>&1');}
    public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstatus(){
        return shell_exec('/home/mojotrolls/mojo_zero/world status 2>&1');}    
    public static function sai_mod_saimod_mojotrollz_server_handling_action_compile(){
        return shell_exec('/home/mojotrolls/mojo_zero/compile 2>&1');}
}