コード例 #1
0
function PrinterState_getInfoAsArray()
{
    $CI =& get_instance();
    $CI->load->helper('zimapi');
    $version_marlin = NULL;
    $name_sso = NULL;
    $hostname = NULL;
    $network_data = array();
    $platform_size = array();
    $array_return = array();
    $cr = 0;
    $cr = PrinterState_getMarlinVersion($version_marlin);
    if ($cr != ERROR_OK) {
        $version_marlin = 'N/A';
    }
    $cr = ZimAPI_getHostname($hostname);
    if ($cr != ERROR_OK) {
        $hostname = 'N/A';
    }
    PrinterState_getPrintSize($platform_size);
    $cr = ZimAPI_getNetworkInfoAsArray($network_data);
    $array_return = array(PRINTERSTATE_TITLE_VERSION => ZimAPI_getVersion(), PRINTERSTATE_TITLE_VERSION_N => ZimAPI_getVersion(TRUE), PRINTERSTATE_TITLE_TYPE => ZimAPI_getType(), PRINTERSTATE_TITLE_SERIAL => ZimAPI_getSerial(), PRINTERSTATE_TITLE_NB_EXTRUD => $CI->config->item('nb_extruder'), PRINTERSTATE_TITLE_VER_MARLIN => $version_marlin, PRINTERSTATE_TITLE_HOSTNAME => $hostname, ZIMAPI_TITLE_IP => $cr == ERROR_OK && isset($network_data[ZIMAPI_TITLE_IP]) ? $network_data[ZIMAPI_TITLE_IP] : 'N/A', ZIMAPI_TITLE_IPV6 => $cr == ERROR_OK && isset($network_data[ZIMAPI_TITLE_IPV6]) ? $network_data[ZIMAPI_TITLE_IPV6] : 'N/A');
    foreach ($platform_size as $key => $value) {
        $array_return[$key] = $value;
    }
    $cr = ZimAPI_getPrinterSSOName($name_sso);
    if ($cr == ERROR_OK && $name_sso != NULL) {
        $array_return[PRINTERSTATE_TITLE_SSO_NAME] = $name_sso;
    }
    return $array_return;
}
コード例 #2
0
ファイル: test_version.php プロジェクト: Jaesin/zim-web
 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;
 }