function PrinterState_getInfo() { $data_json = PrinterState_getInfoAsArray(); return json_encode($data_json); }
public function printerinfo() { $template_data = array(); $temp_info = array(); $array_info = NULL; //array() // $sso_name = NULL; $ssh_mode = NULL; $ssh_link = NULL; // $ip_addr6 = NULL; $this->load->helper(array('printerstate', 'zimapi')); $this->load->library('parser'); $this->lang->load('printerstate/printerinfo', $this->config->item('language')); $this->lang->load('printerstate/index', $this->config->item('language')); // ZimAPI_getPrinterSSOName($sso_name); $temp_info = PrinterState_getInfoAsArray(); // if (is_array($temp_info[ZIMAPI_TITLE_IPV6])) { // foreach ($temp_info[ZIMAPI_TITLE_IPV6] as $ip_scope => $ip_addr) { // if (!is_null($ip_addr6)) { // $ip_addr6 .= ', '; // } // $ip_addr6 .= $ip_addr . ' (' . t($ip_scope) . ')'; // } // } // else { // $ip_addr6 = $temp_info[ZIMAPI_TITLE_IPV6]; // } if (ZimAPI_getSSH($ssh_mode, $ssh_link) && $ssh_mode == TRUE) { $ssh_mode = t('function_on') . ' (' . $ssh_link . ')'; } else { $ssh_mode = t('function_off'); } // $hostname = "no hostname"; // ZimAPI_getHostname($hostname); $array_info = array(array('title' => t('version_title'), 'value' => $this->parser->parse('printerstate/printerinfo_grid_b', array('id' => 'button_release', 'value' => $temp_info[PRINTERSTATE_TITLE_VERSION], 'link' => '/printerstate/upgradenote', 'button' => '{button_release}'), TRUE)), array('title' => t('next_version_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_VERSION_N]), array('title' => t('type_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_TYPE]), array('title' => t('serial_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_SERIAL]), array('title' => t('extruder_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_NB_EXTRUD]), array('title' => t('marlin_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_VER_MARLIN]), array('title' => t('ip_address'), 'value' => $temp_info[ZIMAPI_TITLE_IP]), array('title' => t('remote_control'), 'value' => $ssh_mode), array('title' => t('sso_name'), 'value' => $this->parser->parse('printerstate/printerinfo_grid_b', array('id' => 'button_sso', 'value' => array_key_exists(PRINTERSTATE_TITLE_SSO_NAME, $temp_info) ? $temp_info[PRINTERSTATE_TITLE_SSO_NAME] : "", 'link' => '/activation/?returnUrl=printerstate/printerinfo', 'button' => '{button_sso}'), TRUE))); // parse the main body $template_data = array('array_info' => $array_info, 'back' => t('back'), 'home' => t('Home'), 'button_sso' => array_key_exists(PRINTERSTATE_TITLE_SSO_NAME, $temp_info) ? t('button_rename_sso') : t('button_active_sso'), 'button_fqdn' => t('button_rename_sso'), 'button_release' => t('button_release')); // parse all page $this->_parseBaseTemplate(t('printerstate_printerinfo_pagetitle'), $this->parser->parse('printerstate/printerinfo', $template_data, TRUE)); return; }
public function index() { $template_data = array(); $temp_info = array(); $array_info = array(); $sso_name = NULL; $upgrade_mode = NULL; $profile_link = NULL; $this->load->helper(array('printerstate', 'zimapi')); $this->load->library('parser'); $this->lang->load('printerstate/printerinfo', $this->config->item('language')); $this->lang->load('test_version', $this->config->item('language')); ZimAPI_getPrinterSSOName($sso_name); ZimAPI_getUpgradeMode($upgrade_mode, $profile_link); $profile_link = $this->_bindUpgradeURL($profile_link); $temp_info = PrinterState_getInfoAsArray(); $array_info = array(array('title' => t('profile_title'), 'value' => $upgrade_mode . ' [ ' . $profile_link . ' ]'), array('title' => t('version_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_VERSION]), array('title' => t('next_version_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_VERSION_N]), array('title' => t('type_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_TYPE]), array('title' => t('serial_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_SERIAL]), array('title' => t('extruder_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_NB_EXTRUD]), array('title' => t('marlin_title'), 'value' => $temp_info[PRINTERSTATE_TITLE_VER_MARLIN]), array('title' => t('ip_address'), 'value' => $temp_info[ZIMAPI_TITLE_IP])); // parse the main body $template_data = array('array_info' => $array_info, 'port_test_title' => t('port_test_title'), 'port_test_ok' => t('port_test_ok'), 'port_test_ko' => t('port_test_ko'), 'port_test_r80' => t('port_test_printer', array(80)), 'port_test_r443' => t('port_test_printer', array(443)), 'port_test_r4443' => t('port_test_printer', array(4443)), 'port_test_l80' => t('port_test_client', array(80)), 'port_test_l443' => t('port_test_client', array(443))); $this->_parseBaseTemplate(t('printerstate_printerinfo_pagetitle'), $this->parser->parse('test_version', $template_data, TRUE)); return; }