$dialogOption11 = new DialogOption(); $dialogOption11->set_text("Kambing"); $dialogOption11->set_nextDialog(8); $dialogOption12 = new DialogOption(); $dialogOption12->set_text("Ayam"); $dialogOption12->set_nextDialog(8); $dialogOption13 = new DialogOption(); $dialogOption13->set_text("Sapi"); $dialogOption13->set_nextDialog(8); $dialogOption14 = new DialogOption(); $dialogOption14->set_text("Ga jadi sate. Ganti menu!"); $dialogOption14->set_nextDialog(4); $dialogOption15 = new DialogOption(); $dialogOption15->set_text("OK"); $dialogOption15->set_nextDialog(0); $dialogOption16 = new DialogOption(); $dialogOption16->set_text("OK"); $dialogOption16->set_nextDialog(0); $dialogData04 = new DialogData(); $dialogData04->set_id(4); $dialogData04->set_tipe(0); $dialogData04->set_text("Selamat Datang di Dialog Tree Test 001. Makanan apa yang Anda pilih?"); $dialogData04->set_opt(0, $dialogOption05); $dialogData04->set_opt(1, $dialogOption06); $dialogData04->set_opt(2, $dialogOption07); $dialogData05 = new DialogData(); $dialogData05->set_id(5); $dialogData05->set_tipe(0); $dialogData05->set_text("Anda memilih Soto. Soto dari daerah mana yang Anda sukai?"); $dialogData05->set_opt(0, $dialogOption08); $dialogData05->set_opt(1, $dialogOption09);
<?php require_once '../message/pb_message.php'; require_once './pb_proto_DialogTree.php'; $dialogOption01 = new DialogOption(); $dialogOption01->set_nextDialog(2); $dialogOption01->set_text('Kambing'); $dialogOption02 = new DialogOption(); $dialogOption02->set_nextDialog(3); $dialogOption02->set_text('Ayam'); $dialogOption03 = new DialogOption(); $dialogOption03->set_nextDialog(0); $dialogOption03->set_text('OK. Guling2 aja semau lo...'); $dialogOption04 = new DialogOption(); $dialogOption04->set_nextDialog(0); $dialogOption04->set_text('OK deh, ayam jg ga apa2...'); $dialogData01 = new DialogData(); $dialogData01->set_id(1); $dialogData01->set_tipe(DIALOG); $dialogData01->set_text("Anda siapa?"); $dialogData01->set_opt(0, $dialogOption01); $dialogData01->set_opt(1, $dialogOption02); $dialogData02 = new DialogData(); $dialogData02->set_id(2); $dialogData02->set_tipe(DIALOG); $dialogData02->set_text("Kambing Guling!!!"); $dialogData02->set_opt(0, $dialogOption03); $dialogData03 = new DialogData(); $dialogData03->set_id(3); $dialogData03->set_tipe(DIALOG); $dialogData03->set_text("Ayam kampu** ?");
function asset_admin_test_proto() { define("DIALOG", 1); require_once 'libraries/protocolbuf/message/pb_message.php'; require_once 'modules/002_asset_management/protocol_buffer/pb_proto_DialogTree.php'; $dialogOption01 = new DialogOption(); $dialogOption01->set_nextDialog(2); $dialogOption01->set_text('Kambing'); $dialogOption02 = new DialogOption(); $dialogOption02->set_nextDialog(3); $dialogOption02->set_text('Ayam'); $dialogOption03 = new DialogOption(); $dialogOption03->set_nextDialog(0); $dialogOption03->set_text('OK. Guling2 aja semau lo...'); $dialogOption04 = new DialogOption(); $dialogOption04->set_nextDialog(0); $dialogOption04->set_text('OK deh, ayam jg ga apa2...'); $dialogData01 = new DialogData(); $dialogData01->set_id(1); $dialogData01->set_DialogType(DIALOG); $dialogData01->set_text("Anda siapa?"); $dialogData01->set_OptionList(0, $dialogOption01); $dialogData01->set_OptionList(1, $dialogOption02); // $dialogData01->values["4"] = array($dialogOption01, $dialogOption02); $dialogData02 = new DialogData(); $dialogData02->set_id(2); $dialogData02->set_DialogType(DIALOG); $dialogData02->set_text("Kambing Guling!!!"); $dialogData02->set_OptionList(0, $dialogOption03); $dialogData03 = new DialogData(); $dialogData03->set_id(3); $dialogData03->set_DialogType(DIALOG); $dialogData03->set_text("Ayam kampu** ?"); $dialogData03->set_OptionList(0, $dialogOption04); $dialogTree01 = new DialogTree(); $dialogTree01->set_Dialogs(0, $dialogData01); $dialogTree01->set_Dialogs(1, $dialogData02); $dialogTree01->set_Dialogs(2, $dialogData03); // $dialogTree01->set_currentDialog(1); // return print_r($dialogTree01);exit; // return "<pre>" . print_r($dialogTree01) . "<pre>"; $serialized_string = $dialogTree01->SerializeToString(); $text = print_r($serialized_string, true); return $text; }