Ejemplo n.º 1
0
 public function index()
 {
     require COMMON_PATH . "tpmaker.class.php";
     //引入自定义的类
     //获取表
     $list = D('Sys_tables');
     $tabledata = $list->field('*')->where('ismodel=0 and pid=' . $_REQUEST['id'])->findall();
     $this->assign('tables', $tabledata);
     //dump($data);
     $t = new tpmaker();
     $t->projectid = $_REQUEST['id'];
     foreach ($tabledata as $subtables) {
         $subtable[$subtables['title']] = $t->getfieldsbytbid($subtables['id']);
         for ($i = 0; $i < count($subtable[$subtables['title']]); $i++) {
             //重新加入数组的新元素
             $field = getfielddetail($subtable[$subtables['title']][$i]['fieldtype']);
             //
             $subtable[$subtables['title']][$i]['img'] = $field['img'];
             $subtable[$subtables['title']][$i]['type'] = $field['type'];
             $subtable[$subtables['title']][$i]['leng'] = $field['leng'];
             $subtable[$subtables['title']][$i]['iskey'] = $field['iskey'];
         }
         //dump($subtable[$subtables['title']]);exit;
     }
     $this->assign('subtables', $subtable);
     //查出关联JS
     $Designer = D('Designer');
     $condate = $Designer->where('master_pid=' . $_REQUEST['id'])->findall();
     $ti = 0;
     $script_contr = '<script type="text/javascript">' . "\n" . '// <![CDATA[' . "\n" . 'var contr = new Array();' . "\n";
     //for ($i = 0; $i < count($con); $i++) {
     foreach ($condate as $con) {
         $js_var = ' contr[' . $ti . ']';
         $script_contr .= $js_var . " = new Array();\n";
         // $js_var .= "['" . $con['master_table'].".". $con['master_field'] . "']";
         $js_var .= "['" . "']";
         $script_contr .= $js_var . " = new Array();\n";
         $js_var .= "['" . $con['foreign_pid'] . "." . $con['foreign_table'] . "']";
         $script_contr .= $js_var . " = new Array();\n";
         $m_col = array();
         //}
         $js_var .= "['" . $con['foreign_field'] . "']";
         $script_contr .= $js_var . " = new Array();\n";
         //}
         $script_contr .= $js_var . "[0] = '" . $con['master_pid'] . "." . $con['master_table'] . "';\n";
         //
         $script_contr .= $js_var . "[1] = '" . $con['master_field'] . "';\n";
         //
         $ti++;
     }
     $script_contr .= '// ]]>' . "\n" . '</script>' . "\n";
     $this->assign('script_contr', $script_contr);
     //查出位置
     $d = D('Designer_coords');
     $ds = $d->where("projectid=" . $_REQUEST['id'])->findall();
     foreach ($ds as $date) {
         //$tab_pos[$date['table_name']]=$date['table_name'];
         $tab_pos[$date['table_name']]["X"] = $date['x'];
         $tab_pos[$date['table_name']]["Y"] = $date['y'];
         $tab_pos[$date['table_name']]["H"] = $date['h'];
         $tab_pos[$date['table_name']]["V"] = $date['v'];
     }
     $this->assign('tab_pos', $tab_pos);
     //dump($tab_pos);
     $this->display();
 }
Ejemplo n.º 2
0
 public function zippro()
 {
     //打包项目
     require_once COMMON_PATH . "tp_common.php";
     //引入自定义的类
     require_once COMMON_PATH . "tpmaker.class.php";
     //引入自定义的类
     require_once COMMON_PATH . "zip.class.php";
     //引入自定义的类
     $buideid = $_REQUEST['id'];
     $t = new tpmaker();
     $t->projectid = $buideid;
     $zippath = $t->getapppath();
     $projects = $t->getprojects();
     $filename = './Backup/ZIP/' . $projects['proname'] . ".zip";
     $z = new PHPZip();
     $filesize = @filesize($filename);
     $_SESSION['zipdir'] = '';
     //所有子目录
     $_SESSION['zipfile'] = '';
     //所有子目录
     zipdir($zippath);
     $dirs = $_SESSION['zipdir'];
     //所有子目录
     $files = $_SESSION['zipfile'];
     //所有文件
     if ($dirs) {
         foreach ($dirs as $dir) {
             $z->add_dir($dir);
             //添加指定目录
             msg($dir . "...添加目录成功!<br>");
             //read_dir($dir);
         }
     }
     if ($files) {
         foreach ($files as $file) {
             $fp = @fopen($file, rb);
             $zipfilecontent = array($file, @fread($fp, $filesize));
             @fclose($fp);
             $z->Add($zipfilecontent, 1);
             //可以多次执行 $zip->Add 来添加多个文件
             msg($file . "...添加文件成功!<br>");
         }
     }
     closedir($path);
     if (@fputs(@fopen($filename, "wb"), $z->get_file())) {
         //写入文件
         msg("文件压缩成功!!");
     } else {
         msg("文件压缩失败!!", 0);
     }
     echo "<a href='{$filename}' traget='_blank'>下载本文件:{$filename}</a>";
 }
Ejemplo n.º 3
0
 function buidetable()
 {
     require_once COMMON_PATH . "tp_common.php";
     //引入自定义的类
     require_once COMMON_PATH . "tpmaker.class.php";
     //引入自定义的类
     $buideid = $_SESSION['workingprojectid'];
     $t = new tpmaker();
     $t->projectid = $buideid;
     $t->makeproindexaction();
     //生成项面INDEX的面页和相应的列表数据
     $table = D('Sys_tables');
     $tabledata = $table->where('id=' . $_GET['pid'] . ' and ismodel <>1')->findall();
     foreach ($tabledata as $tb) {
         $t->makepromodel($tb['id']);
         //生成MODEL
         $t->makeproaction($tb['id']);
         //生成ACTION
         $t->makeprotpl($tb['id']);
         //生成模板HTML文件
     }
     $viewmodel = D('Sys_viewmodel');
     $viewmodel = $viewmodel->where('id=' . $_GET['pid'])->findall();
     foreach ($viewmodel as $mod) {
         $t->makeproviewmodel($mod['id']);
         //生成MODEL
     }
     echo "<a  href='/" . $_SESSION['workingproject']['proname'] . "/index.php/" . $tb['title'] . "'>浏览结果</a>";
 }