Changeset 485 for trunk/phpbms/modules/bms/clients_import.php
- Timestamp:
- 04/07/09 11:44:18 (3 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/modules/bms/clients_import.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/bms/clients_import.php
r432 r485 1 <?php 1 <?php 2 2 /* 3 3 $Rev: 258 $ | $LastChangedBy: brieb $ … … 43 43 include("include/imports.php"); 44 44 include("include/parsecsv.lib.php"); 45 45 46 46 //if you need to overide the phpbmsTable class make sure to include the modules file 47 47 48 48 include("modules/bms/include/clients.php"); 49 49 include("modules/bms/include/addresses.php"); 50 include("modules/bms/include/addresstorecord.php"); 51 52 //If the addedit page will be accessd directly from a page other than the 50 include("modules/bms/include/addresstorecord.php"); 51 52 //If the addedit page will be accessd directly from a page other than the 53 53 // basic search results page, you may want to grab and pass the previous URL 54 54 //with the following code 55 55 56 56 //=================================================== 57 if(!isset($_GET["backurl"])) 58 $backurl = NULL; 59 else{ 57 if(!isset($_GET["backurl"])) 58 $backurl = NULL; 59 else{ 60 60 $backurl = $_GET["backurl"]; 61 61 if(isset($_GET["refid"])) … … 66 66 if(isset($_GET["id"])) 67 67 $tabledefid = ((int)$_GET["id"]); 68 68 69 69 70 70 //Here you invoke the table and import classes. If you are going to use the standard phpbmsTable class 71 71 // for updates and the such you would access it like this 72 72 73 73 //$thetable = new phpbmsTable($db,$tabledefid); 74 74 //$import = new phpbmsImport($thetable); 75 75 76 76 //if you are going to overide the class you would instantiate 77 77 // like this 78 78 79 79 $importType = "csv"; 80 80 if(isset($_POST["importType"])){ 81 81 82 82 switch($_POST["importType"]){ 83 83 84 84 case 0: 85 85 $importType = "csv"; 86 86 break; 87 87 88 88 case 1: 89 89 $importType = "sugarcrm"; 90 90 break; 91 91 92 92 }//end switch 93 93 94 94 }//end if 95 95 96 96 $thetable = new clients($db,2,$backurl); 97 97 $import = new clientsImport($thetable, $importType); 98 98 99 99 //and if you are setting the backurl, make sure you pass that as well 100 100 // like this: 101 101 102 102 // $thetable = new [tablename]($db,[table definition id],$backurl); 103 104 105 //Next we process the form (if submitted) and 103 104 105 //Next we process the form (if submitted) and 106 106 // return the current record as an array ($therecord) 107 107 // or if this is a new record, it returns the defaults … … 114 114 115 115 $pageTitle = ($therecord["title"])?$therecord["title"]:"General Table Import"; 116 116 117 117 // Next, we set up to include any 118 118 // additional css or javascript files we will be using … … 124 124 125 125 // if you need to define a body onlload function, do so with the phpbms property 126 126 127 127 // $phpbms->onload[] = "initializePage()"; 128 128 … … 130 130 // Next we need to define any special fields that will be used in the form 131 131 // A list of field objects (with documentation)is available in the /include/fields.php 132 // file. 133 132 // file. 133 134 134 // We need to define them here in the head 135 135 // so that any necessay javascript is loaded appropriately. 136 136 137 137 //Form Elements 138 138 //============================================================== 139 139 140 140 // Create the form 141 141 $theform = new importForm(); … … 143 143 //if you need to set specific form vaiables (like enctype, or extra onsubmit 144 144 // you can set those form properties here. 145 146 // for each field we will use, create the field object and add it to 145 146 // for each field we will use, create the field object and add it to 147 147 // the forms list. 148 148 149 149 $list = array("phpBMS csv file" => 0, "Sugar CRM (v5.0)" => 1); 150 150 $default = 0; … … 163 163 $theform->jsMerge(); 164 164 //============================================================== 165 //End Form Elements 166 167 include("header.php"); 168 165 //End Form Elements 166 167 include("header.php"); 168 169 169 ?><div class="bodyline"> 170 <!-- 170 <!-- 171 171 Next we start the form. This also prints the H1 with title, and top save,cancel buttons 172 172 If you need to have other buttons, or need a specific top, you will need to create your form manually. 173 173 --> 174 <?php $theform->startForm($pageTitle, $import->pageType )?>174 <?php $theform->startForm($pageTitle, $import->pageType, count($import->transactionRecords))?> 175 175 176 176 <div id="leftSideDiv"> … … 180 180 <!-- /* This next input also determines whether the file/import fieldset will be displayed or if the preview sections will be displayed*/ --> 181 181 <input id="pageType" name="pageType" type="hidden" value="<?php echo $import->pageType?>" /> 182 182 183 183 <?php 184 184 if($import->pageType == "main"){ ?> 185 185 <fieldset> 186 186 <legend>import</legend> 187 187 188 188 <p><?php $theform->showField("importType"); ?></p> 189 189 190 190 <div id="uploadlabel"> 191 191 <p> … … 193 193 <input id="import" name="import" type="file" size="64"/><br/> 194 194 </p> 195 195 196 196 <div id="info0" class="info"> 197 197 <p> … … 244 244 <?php 245 245 }//end if 246 246 247 247 if($import->error && $import->pageType != "main"){ 248 248 ?> … … 259 259 </div> 260 260 <div id="createmodifiedby" > 261 <?php 261 <?php 262 262 //Last, we show the create/modifiy with the bottom save and cancel buttons 263 263 // and then close the form. 264 $theform->showButtons(2, $import->pageType );264 $theform->showButtons(2, $import->pageType, count($import->transactionRecords)); 265 265 ?></div><?php 266 266 $theform->endForm();