Changeset 485 for trunk/phpbms/modules/sample/sampletable_addedit.php
- Timestamp:
- 04/07/09 11:44:18 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/sample/sampletable_addedit.php
r384 r485 1 <?php 1 <?php 2 2 /* 3 3 $Rev: 258 $ | $LastChangedBy: brieb $ … … 41 41 include("include/tables.php"); 42 42 include("include/fields.php"); 43 43 44 44 //if you need to ovveride the phpbmsTable class make sure to include the modules file 45 45 include("modules/[modulename]/include/[tablename].php"); 46 46 47 47 48 //If the addedit page will be accessd directly from a page other than the 48 //If the addedit page will be accessd directly from a page other than the 49 49 // basic search results page, you may want to grab and pass the previous URL 50 50 //with the following code 51 51 52 52 //=================================================== 53 if(!isset($_GET["backurl"])) 54 $backurl = NULL; 55 else{ 53 if(!isset($_GET["backurl"])) 54 $backurl = NULL; 55 else{ 56 56 $backurl = $_GET["backurl"]; 57 57 if(isset($_GET["refid"])) … … 63 63 //Here you invoke the table class. If you are going to use the standard phpbmsTable class 64 64 // for updates and the such you would access it like this 65 65 66 66 // $thetable = new phpbmsTable($db,[table definition id]); 67 68 // if you are going to overide the class you would instantiate69 // like this70 71 // $thetable = new [tablename]($db,[table definition id] ,$backurl);72 67 68 // if you are going to overide the class you would instantiate 69 // your overriden class like this 70 71 // $thetable = new [tablename]($db,[table definition id]); 72 73 73 //and if you are setting the backurl, make sure you pass that as well 74 74 // like this: 75 75 // $thetable = new [tablename]($db,[table definition id],$backurl); 76 77 78 // Next we process the form (if submitted) and76 77 78 // Next we process the form (if submitted) and 79 79 // return the current record as an array ($therecord) 80 80 // or if this is a new record, it returns the defaults … … 87 87 88 88 $pageTitle = "[tablename]"; 89 89 90 90 // Next, we set up to include any 91 91 // additional css or javascript files we will be using … … 93 93 // as they are automatically icluded when you define the special fields you 94 94 // will be using below. 95 $phpbms->cssIncludes[] = "pages/[ tablename].css";95 $phpbms->cssIncludes[] = "pages/[modulename]/[tablename].css"; 96 96 $phpbms->jsIncludes[] = "modules/[modulename]/javascript/[tablename].js"; 97 97 98 // DEPRECIATED: 98 99 // if you need to define a body onlload function, do so with the phpbms property 99 100 $phpbms->onload[] = "initializePage()"; … … 102 103 // Next we need to define any special fields that will be used in the form 103 104 // A list of field objects (with documentation)is available in the /include/fields.php 104 // file. 105 105 // file. 106 106 107 // We need to define them here in the head 107 108 // so that any necessay javascript is loaded appropriately. 108 109 109 110 //Form Elements 110 111 //============================================================== 111 112 112 113 // Create the form 113 114 $theform = new phpbmsForm(); 114 115 //if you need to set specific form vaiables (like enctype, or extra onsubmit 115 116 // you can set those form properties here. 116 117 // for each field we will use, create the field object and add it to 117 118 // for each field we will use, create the field object and add it to 118 119 // the forms list. 119 120 $theinput = new inputDatePicker("orderdate", $therecord["orderdate"], "order date"); 120 121 $theform->addField($theinput); 121 122 122 123 $theinput = new inputCheckBox("weborder",$therecord["weborder"],NULL, false, false); 123 124 $theform->addField($theinput); … … 136 137 $theform->jsMerge(); 137 138 //============================================================== 138 //End Form Elements 139 //End Form Elements 139 140 140 include("header.php"); 141 141 include("header.php"); 142 142 143 ?><div class="bodyline"> 143 <!-- 144 <!-- 144 145 Next we start the form. This also prints the H1 with title, and top save,cancel buttons 145 146 If you need to have other buttons, or need a specific top, you will need to create your form manually. … … 151 152 <p> 152 153 <label for="id">id</label><br /> 153 <input name="id" id="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="readonly" class="uneditable" /> 154 <input name="id" id="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="readonly" class="uneditable" /> 154 155 </p> 155 <p><?php $theform->showField("inactive");?></p> 156 <p><?php $theform->showField("inactive");?></p> 156 157 </fieldset> 157 158 … … 166 167 </fieldset> 167 168 </div> 168 <?php 169 <?php 169 170 //Last, we show the create/modifiy with the bottom save and cancel buttons 170 171 // and then close the form.