public function listmodel() { $display_printlist = array(); $template_data = array(); $json_data = array(); $nb_extruder = $this->config->item('nb_extruder'); $this->load->helper('printlist'); $this->load->library('parser'); $this->lang->load('printlist', $this->config->item('language')); $json_data = ModelList__listAsArray(TRUE); // prepare display data foreach ($json_data[PRINTLIST_TITLE_MODELS] as $model_data) { $nb_image = count($model_data[PRINTLIST_TITLE_PIC]); // ignore bi-color model in mono-extruder mode if ($nb_extruder < 2 && $model_data[PRINTLIST_TITLE_LENG_F2] > 0) { continue; } $display_printlist[] = array('name' => $model_data[PRINTLIST_TITLE_NAME], 'id' => $model_data[PRINTLIST_TITLE_ID], 'image' => $model_data[PRINTLIST_TITLE_PIC][0]); } // sort list by name of translation, by name of folder if not do so usort($display_printlist, 'Printmodel::_model_usortCompare'); // parse the main body $template_data = array('search_hint' => t('Select a model'), 'baseurl_detail' => '/printmodel/detail', 'model_lists' => $display_printlist, 'back' => t('back')); // parse all page $this->_parseBaseTemplate(t('ZeePro Personal Printer 21 - Quick printing list'), $this->parser->parse('printlist/listmodel', $template_data, TRUE)); return; }
function ModelList_list() { $array_data = ModelList__listAsArray(); return json_encode_unicode($array_data); }