<?php if (! defined('NV_MAINFILE')) { die('Stop!!!'); } if (! nv_function_exists('nv_block_hotro')) { function nv_block_hotro_config($module, $data_block, $lang_block){ global $lang_global, $selectthemes; // Find language file if (file_exists(NV_ROOTDIR . '/themes/' . $selectthemes . '/language/' . NV_LANG_INTERFACE . '.php')) { include NV_ROOTDIR . '/themes/' . $selectthemes . '/language/' . NV_LANG_INTERFACE . '.php'; } $html = '<tr>'; $html .= '<td><p style="text-align:center">' . $lang_global['hotro_number'] . '</p></td>'; $html .= '<td><input type="text" class="form-control w100" name="config_hotro_number" value="' . $data_block['hotro_number'] . '"></td>'; $html .= '</tr>'; $dem = $data_block['hotro_number']; for ( $i = 1; $i <=$dem; ++$i) { $html .= '<tr>'; $html .='<td >'.$lang_global['hotro_name'].' '.$i.'</td>'; $html .='<td><input type="text" class="form-control w300" name="config_hotro_name'.$i.'" value=" '.$data_block['hotro_name'.$i].'"></td>'; $html.='</tr>'; $html .='<tr><td>'.$lang_global['hotro_bophan'].' </td>'; $html .='<td><select name="hotro_bophan'.$i.'" class="form-control w300"> <option value="0" selected="selected">Bán Hàng</option> <option value="1" >Tư Vấn</option> <option value="2" >Chăm Sóc</option> </select></td>'; $html.='</tr>'; $html .='<tr ><td>'.$lang_global['hotro_phone'].' </td>'; $html .='<td><input type="text" class="form-control w300" name="config_hotro_phone'.$i.'" value="'.$data_block['hotro_phone'.$i].'"></td>'; $html.='</tr>'; $html .='<tr ><td>'.$lang_global['hotro_skype'].' </td>'; $html .='<td><input type="text" class="form-control w300" name="config_hotro_skype'.$i.'" value="'.$data_block['hotro_skype'.$i].'"></td>'; $html.='</tr>'; $html .='<tr ><td >'.$lang_global['hotro_email'].' </td>'; $html .='<td><input type="text" class="form-control w300" name="config_hotro_email'.$i.'" value="'.$data_block['hotro_email'.$i].'"></td>'; $html.='</tr>'; } return $html; } /*$lang_global['hotro_name'] = 'tên'; $lang_global['hotro_phone'] = 'điện thoại'; $lang_global['hotro_skype'] = 'skype'; $lang_global['hotro_email'] = 'email';*/ function nv_block_hotro_submit(){ global $nv_Request; $return = array(); $return['error'] = array(); $return['config']= array(); $return['config']['hotro_number'] = $nv_Request->get_int('config_hotro_number', 'post'); $dem1 = $nv_Request->get_int('config_hotro_number', 'post'); for($i=1;$i<=$dem1;++$i){ $return['config']['nhanvien'.$i]= array(); $return['config']['nhanvien'.$i]['hotro_name'] = $nv_Request->get_title('config_hotro_name'.$i, 'post'); $return['config']['nhanvien'.$i]['hotro_bophan'] = $nv_Request->get_int('config_hotro_bophan'.$i, 'post',0); $return['config']['nhanvien'.$i]['hotro_phone'] = $nv_Request->get_title('config_hotro_phone'.$i, 'post',''); $return['config']['nhanvien'.$i]['hotro_email'] = $nv_Request->get_title('config_hotro_email'.$i, 'post',''); $return['config']['nhanvien'.$i]['hotro_skype'] = $nv_Request->get_title('config_hotro_skype'.$i, 'post',''); } return $return; } //var_dump($block_config);die(); function nv_block_hotro($block_config){ global $global_config,$lang_global; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.block_hotro.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.block_hotro.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('global.block_hotro.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $dem=$block_config['hotro_number']; for ($i=1;$i<=$dem;$i++) { $xtpl->assign('DATA',$block_config['nhanvien'.$i]); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } } //var_dump($global_config);die(); if (defined('NV_SYSTEM')) { $content = nv_block_hotro($block_config); }