public function view_ajaxGetTpl() { $tid = isset($_GET['tid']) ? trim($_GET['tid']) : 0; if (!(is_numeric($tid) && $tid > 0)) { //tid不合法 $msgdata = array('errCode' => 9001, 'errMsg' => '模板不合法!'); echo json_encode($msgdata); exit; } $tpl_obj = new MessageTemplateModel(); $tpl_info = $tpl_obj->getTplInfoById($tid); if (empty($tid)) { $msgdata = array('errCode' => 9002, 'errMsg' => '模板不存在!'); echo json_encode($msgdata); exit; } else { $msgdata = array('errCode' => 9003, 'errMsg' => '', 'data' => $tpl_info['content']); echo json_encode($msgdata); exit; } }
private function editTemplate($platform) { extract($this->generateInfo($platform)); $tid = isset($_GET['tid']) ? $_GET['tid'] : 0; $actname = '添加'; $tplinfo = array(); if (!empty($tid)) { if (!is_numeric($tid)) { //传入id为非数字 $msgdata = array('data' => array('id不合法!'), 'link' => $gobackurl); goErrMsgPage($msgdata); exit; } $actname = '编辑'; $msgtpl_obj = new MessageTemplateModel(); $tplinfo = $msgtpl_obj->getTplInfoById($tid); if (empty($tplinfo)) { //没找到信息 $msgdata = array('data' => array('指定模板不存在!'), 'link' => $gobackurl); goErrMsgPage($msgdata); exit; } } // print_r($tplinfo);exit; $this->smarty->assign('sec_menue', $sec_menueid); $this->smarty->assign('tid', $tid); $this->smarty->assign('act', $actname); $this->smarty->assign('tplinfo', $tplinfo); $this->smarty->assign('submiturl', $submiturl); $this->smarty->assign('gobackurl', $gobackurl); $this->smarty->assign('toplevel', 2); $this->smarty->assign('toptitle', 'message模板编辑'); $this->smarty->display('msgtpleditform.htm'); }