phpBMS

Show
Ignore:
Timestamp:
04/07/09 11:44:18 (3 years ago)
Author:
nate
Message:
  • Merged Nathan branch back into trunk.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/bms/clients_import.php

    r432 r485  
    1 <?php  
     1<?php 
    22/* 
    33 $Rev: 258 $ | $LastChangedBy: brieb $ 
     
    4343        include("include/imports.php"); 
    4444        include("include/parsecsv.lib.php"); 
    45          
     45 
    4646        //if you need to overide the phpbmsTable class make sure to include the modules file 
    47          
     47 
    4848        include("modules/bms/include/clients.php"); 
    4949        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 
    5353        // basic search results page, you may want to grab and pass the previous URL 
    5454        //with the following code 
    5555 
    5656        //=================================================== 
    57         if(!isset($_GET["backurl"]))  
    58                 $backurl = NULL;  
    59         else{  
     57        if(!isset($_GET["backurl"])) 
     58                $backurl = NULL; 
     59        else{ 
    6060                $backurl = $_GET["backurl"]; 
    6161                if(isset($_GET["refid"])) 
     
    6666        if(isset($_GET["id"])) 
    6767                $tabledefid = ((int)$_GET["id"]); 
    68          
     68 
    6969 
    7070        //Here you invoke the table and import classes.  If you are going to use the standard phpbmsTable class 
    7171        // for updates and the such you would access it like this 
    72          
     72 
    7373                        //$thetable = new phpbmsTable($db,$tabledefid); 
    7474                        //$import = new phpbmsImport($thetable); 
    75          
     75 
    7676        //if you are going to overide the class you would instantiate 
    7777        // like this 
    78                          
     78 
    7979                        $importType = "csv"; 
    8080                        if(isset($_POST["importType"])){ 
    81                                  
     81 
    8282                                switch($_POST["importType"]){ 
    83                                          
     83 
    8484                                        case 0: 
    8585                                                $importType = "csv"; 
    8686                                        break; 
    87                                          
     87 
    8888                                        case 1: 
    8989                                                $importType = "sugarcrm"; 
    9090                                        break; 
    91                                          
     91 
    9292                                }//end switch 
    93                                  
     93 
    9494                        }//end if 
    95          
     95 
    9696                        $thetable = new clients($db,2,$backurl); 
    9797                        $import = new clientsImport($thetable, $importType); 
    98          
     98 
    9999        //and if you are setting the backurl, make sure you pass that as well 
    100100        // like this: 
    101          
     101 
    102102        //              $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 
    106106        // return the current record as an array ($therecord) 
    107107        // or if this is a new record, it returns the defaults 
     
    114114 
    115115        $pageTitle = ($therecord["title"])?$therecord["title"]:"General Table Import"; 
    116          
     116 
    117117        // Next, we set up to include any 
    118118        // additional css or javascript files we will be using 
     
    124124 
    125125        // if you need to define a body onlload function, do so with the phpbms property 
    126          
     126 
    127127        //              $phpbms->onload[] = "initializePage()"; 
    128128 
     
    130130        // Next we need to define any special fields that will be used in the form 
    131131        // A list of field objects (with documentation)is available in the /include/fields.php 
    132         // file.   
    133          
     132        // file. 
     133 
    134134        // We need to define them here in the head 
    135135        // so that any necessay javascript is loaded appropriately. 
    136          
     136 
    137137                //Form Elements 
    138138                //============================================================== 
    139                  
     139 
    140140                // Create the form 
    141141                $theform = new importForm(); 
     
    143143                //if you need to set specific form vaiables (like enctype, or extra onsubmit 
    144144                // 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 
    147147                // the forms list. 
    148                  
     148 
    149149                $list = array("phpBMS csv file" => 0, "Sugar CRM (v5.0)" => 1); 
    150150                $default = 0; 
     
    163163                $theform->jsMerge(); 
    164164                //============================================================== 
    165                 //End Form Elements      
    166  
    167         include("header.php");   
    168          
     165                //End Form Elements 
     166 
     167        include("header.php"); 
     168 
    169169?><div class="bodyline"> 
    170         <!--  
     170        <!-- 
    171171                Next we start the form.  This also prints the H1 with title, and top save,cancel buttons 
    172172                If you need to have other buttons, or need a specific top, you will need to create your form manually. 
    173173        --> 
    174         <?php $theform->startForm($pageTitle, $import->pageType)?> 
     174        <?php $theform->startForm($pageTitle, $import->pageType, count($import->transactionRecords))?> 
    175175 
    176176        <div id="leftSideDiv"> 
     
    180180                <!-- /* This next input also determines whether the file/import fieldset will be displayed or if the preview sections will be displayed*/ --> 
    181181                <input id="pageType" name="pageType" type="hidden" value="<?php echo $import->pageType?>" /> 
    182                  
     182 
    183183                <?php 
    184184                if($import->pageType == "main"){ ?> 
    185185                <fieldset> 
    186186                        <legend>import</legend> 
    187                          
     187 
    188188                        <p><?php $theform->showField("importType"); ?></p> 
    189                          
     189 
    190190                        <div id="uploadlabel"> 
    191191                                <p> 
     
    193193                                        <input id="import" name="import" type="file" size="64"/><br/> 
    194194                                </p> 
    195                                  
     195 
    196196                                <div id="info0" class="info"> 
    197197                                        <p> 
     
    244244                <?php 
    245245                }//end if 
    246                  
     246 
    247247                if($import->error && $import->pageType != "main"){ 
    248248                        ?> 
     
    259259        </div> 
    260260        <div id="createmodifiedby" > 
    261         <?php    
     261        <?php 
    262262                //Last, we show the create/modifiy with the bottom save and cancel buttons 
    263263                // and then close the form. 
    264                 $theform->showButtons(2, $import->pageType); 
     264                $theform->showButtons(2, $import->pageType, count($import->transactionRecords)); 
    265265                ?></div><?php 
    266266                $theform->endForm(); 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.