PhpLabWare version 0.3 
/dd/ -> 0_0027_inc.php

1  <?php
2 
3  // 0_0027_inc.php - Adds 'user-defined' table 'files'
4  // 0_0027_inc.php - author: Nico Stuurman
5 
6    /***************************************************************************
7    * Copyright (c) 2001 by Nico Stuurman *
8    * ------------------------------------------------------------------------ *
9    * This code is part of phplabware (http://phplabware.sf.net) *
10    * *
11    * *
12    * This program is free software; you can redistribute it and/or modify it *
13    * under the terms of the GNU General Public License as published by the *
14    * Free Software Foundation; either version 2 of the License, or (at your *
15    * option) any later version. *
16    \**************************************************************************/
17 
18 
19  // Avoid clashes between user generated and 'system' tables
20  // ids up to 9999 are reserved for system tables
21  $id=$db->GenID("tableoftables_gen_id_seq",10000);
22  $db->Execute("INSERT INTO tableoftables (id,sortkey,tablename,shortname,Display,Permission,Custom) VALUES($id,'0','files','fi','Y','Users','')");
23  $db->Execute("CREATE TABLE files_$id (
24                  id int PRIMARY KEY,
25                  title text,
26                  access varchar(9),
27                  ownerid int,
28                  magic int,
29                  lastmodby int,
30                  lastmoddate int,
31                  date int,
32                  file int,
33                  notes text,
34                  category int)");
35  $desc="files_$id"."_desc";
36  $db->Execute("CREATE TABLE $desc(
37                  id int PRIMARY KEY,
38                  sortkey int,
39                  label text,
40                  display_table char(1),
41                  display_record char(1),
42                  required char(1),
43                  type text,
44                  datatype text,
45                  associated_table text,
46                  associated_sql text)");
47  $fieldstring="id,label,sortkey,display_table,display_record, required, type, datatype, associated_table, associated_sql";
48  $descid=$db->GenId("$desc"."_id");
49  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'id','100','N','N','N','int(11)','text','','')");
50  $descid=$db->GenId("$desc"."_id");
51  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'access','110','N','N','N','varchar(9)','text','','')");
52  $descid=$db->GenId("$desc"."_id");
53  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'ownerid','120','N','N','N','int(11)','text','','')");
54  $descid=$db->GenId("$desc"."_id");
55  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'magic','130','N','N','N','int(11)','text','','')");
56  $descid=$db->GenId("$desc"."_id");
57  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'title','140','Y','Y','Y','text','text','','')");
58  $descid=$db->GenId("$desc"."_id");
59  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'lastmoddate','150','N','N','N','int(11)','text','','')");
60  $descid=$db->GenId("$desc"."_id");
61  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'lastmodby','160','N','N','N','int(11)','text','','')");
62  $descid=$db->GenId("$desc"."_id");
63  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'date','170','N','N','N','int(11)','text','','')");
64  $descid=$db->GenId("$desc"."_id");
65  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'file','180','Y','Y','N','int','file','','')");
66  $descid=$db->GenId("$desc"."_id");
67  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'notes','200','Y','Y','N','text','textlong','','')");
68  $descid=$db->GenId("$desc"."_id");
69  $ass_tablename="files_$id"."ass_1";
70  $db->Execute("INSERT INTO $desc ($fieldstring) Values($descid,'category','190','Y','Y','N','id','pulldown','$ass_tablename','category FROM $ass_tablename WHERE ')");
71  $db->Execute("CREATE TABLE $ass_tablename (
72                  id int PRIMARY KEY,
73                  sortkey int,
74                  type text,
75                  typeshort text)");
76 
77  ?>


Generated: Sun Oct 5 21:17:35 2003 SourceForge Logo Generated by PHPXref 0.2