コード例 #1
0
ファイル: ApptreeAction.class.php プロジェクト: lee99/tpmaker
 public function saveapptree()
 {
     $list = D('apptree');
     $tids = explode(',', $_POST['sortvaue']);
     //数组转换
     $list->delete('type=1 and link ="" and pid=' . $_POST[pid]);
     for ($i = 0; $i < count($tids); $i++) {
         $passshort = id_To_EValue('apptree', 'shortname', 'id', $_POST[pid]);
         $passtitle = id_To_EValue('Sys_tables', 'caption', 'id', $tids[$i]);
         $passtitle = substr($passtitle, strpos($passtitle, ']') + 1);
         $adddate[$i]['pid'] = $_POST[pid];
         $adddate[$i]['tid'] = $tids[$i];
         $adddate[$i]['title'] = $passtitle;
         $adddate[$i]['shortname'] = $passshort . '_' . $i;
         $adddate[$i]['type'] = 1;
         $adddate[$i]['projectid'] = $_SESSION[workingprojectid];
         $adddate[$i]['seqNo'] = $i;
         $list->create($adddate[$i]);
         $list->add();
     }
     //dump($adddate);
     //exit;
     $this->ajaxReturn('', '操作成功!', 1);
 }
コード例 #2
0
ファイル: maker.class.php プロジェクト: lee99/tpmaker
 function makeproviewmodel($id)
 {
     //生成基本VIEWMODEL
     $app_path = $this->getapppath();
     //获取生成程序的根目录
     $tpl_path = $this->gettplpath();
     //获取程序模板的根目录
     $tpl = new tpl($tpl_path . '/Model_tpl/viewmodel.tpl');
     $field = D('Sys_viewfields');
     $tables = $field->where('vid=' . $id, 'distinct `tid`')->findall();
     //查出无序的数据
     foreach ($tables as $tb) {
         $f = $field->findall("vid={$id} and tid={$tb['tid']}");
         $tablename = id_To_EValue('sys_tables', 'title', 'id', $tb[tid]);
         $tablecaption = id_To_EValue('sys_tables', 'caption', 'id', $tb[tid]);
         $tablefield = $this->makeviewfield($f);
         //生成字段
         $val_var_field[$i]['tablename'] = $tablename;
         $val_var_field[$i]['caption'] = $tablecaption;
         $val_var_field[$i]['field'] = $tablefield;
         $i++;
     }
     $condition = D('Sys_viewcondition');
     $condition = $condition->where('vid=' . $id)->findall();
     $viewmodel = D('Sys_viewmodel');
     $viewmodel = $viewmodel->where('id=' . $id)->find();
     $filename = $app_path . '/Lib/Model/' . $viewmodel['title'] . 'ViewModel.class.php';
     $tpl->tplsign("name", $viewmodel['title']);
     //替换
     $tpl->tplblocksign("val_var_field", $val_var_field);
     //替换
     $tpl->tplblocksign("val_var_condition", $condition);
     //替换
     $filecontent = $tpl->tplreturn();
     writefile($filename, $filecontent);
 }
コード例 #3
0
 public function ajaxFields()
 {
     $fields = D('Sys_fields');
     $key = $_REQUEST['id'];
     $pid = id_To_EValue('Sys_tables', 'datemodelid', 'id', $key);
     if ($pid != 0) {
         $sqlwhere = "pid ='{$key}' or pid='{$pid}'";
     } else {
         $sqlwhere = "pid ='{$key}' ";
     }
     $list = $fields->findAll($sqlwhere, '*', 'seqNO asc');
     $this->assign('list', $list);
     $this->display();
 }