public function listgcode() { $template_data = array(); $this->load->library('parser'); $this->lang->load('printerstoring/listgcode', $this->config->item('language')); $this->load->helper('printerstoring'); $json_data = json_decode(PrinterStoring_listGcode(), true); // prepare display data foreach ($json_data as $model_data) { $preset_name = t('preset_not_found'); $preset_array = array(); $this->load->helper('zimapi'); if (ERROR_OK == ZimAPI_getPresetInfoAsArray($model_data[PRINTERSTORING_TITLE_PRESET_ID], $preset_array)) { $preset_name = $preset_array[ZIMAPI_TITLE_PRESET_NAME]; } $display_printlist[] = array('modelname' => $model_data['name'], 'mid' => $model_data['id'], 'presetname' => $preset_name, 'creation_date' => $model_data[PRINTERSTORING_TITLE_CREATE_TIME], 'creation_datestr' => date('Y-m-d H:i:s', $model_data[PRINTERSTORING_TITLE_CREATE_TIME])); } // if (isset($display_printlist)) { // $display_printlist = $this->array_sort($display_printlist, 'modelname'); // } $template_data = array('back' => t('back'), 'home' => t('home'), 'list_info' => t('list_info'), 'print-model' => t('print-model'), 'delete-model' => t('delete-model'), 'encoded_list' => json_encode(isset($display_printlist) ? $display_printlist : array()), 'select_alphabetical' => t('select_alphabetical'), 'select_mostrecent' => t('select_mostrecent'), 'print_error' => t('print_error'), 'delete_error' => t('delete_error'), 'delete_popup_text' => t('delete_popup_text'), 'delete_yes' => t('delete_yes'), 'delete_no' => t('delete_no'), 'preset_name_title' => t('preset_name_title')); // parse all page $this->_parseBaseTemplate(t('printerstoring_listgcode_pagetitle'), $this->parser->parse('printerstoring/listgcode', $template_data, TRUE)); return; }
public function liblistgcode() { $display = ''; $this->load->helper('printerstoring'); $display = PrinterStoring_listGcode(); $this->output->set_content_type(RETURN_CONTENT_TYPE_JSON); $this->load->library('parser'); $this->parser->parse('plaintxt', array('display' => $display)); return; }