Example #1
0
function smarty_function_i18ndescr($params, &$smarty)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . "/init.php";
    $language = $params['lang'];
    $default = $params['default'];
    $lines = explode("\r\n", $default);
    foreach ($lines as $key => $line) {
        $elements = explode(':', $line);
        foreach ($elements as $elkey => $element) {
            $newels[$elkey] = getelement($element, $language);
        }
        $newlines[$key] = implode(': ', $newels);
    }
    return htmlspecialchars_decode(implode("\r\n", $newlines));
}
Example #2
0
function onoff_setValue($id, $field, $eid)
{
    global $wpdb;
    $element = getelement($eid);
    $Config = $element['Content'];
    $Data[$Config['_ReturnFields'][0]] = $id;
    $Data[$Config['_ReturnFields'][0]] = $id;
    $Values = $wpdb->get_results("SELECT * FROM `" . $Config['_main_table'] . "` WHERE `" . $Config['_ReturnFields'][0] . "` = '" . $id . "' LIMIT 1;", ARRAY_A);
    if (empty($Values[0][$field])) {
        $Values[0][$field] = 1;
    } else {
        $Values[0][$field] = 0;
    }
    $Data[$eid] = $Values[0];
    unset($Data[$eid][$Config['_ReturnFields'][0]]);
    df_processupdate($Data, $eid);
    return;
}
Example #3
0
function linked_autocomplete($eid, $Field, $query)
{
    $Element = getelement($eid);
    $Config = $Element['Content'];
    // David Holloway - do not understand this line $Setup = $Config[$Table];
    // $Setup = $Config[$Table];
    $Table = $Config['_Linkedfields'][$Field]['Table'];
    $ID = $Config['_Linkedfields'][$Field]['ID'];
    $Wheres = '';
    //dump($Config['_Linkedfields']);
    foreach ($Config['_Linkedfields'][$Field]['Value'] as $outValue) {
        $vals[] = $outValue;
        $Wheres .= " `" . $outValue . "` LIKE '%" . $query . "%' OR ";
    }
    $Value = implode(',', $vals);
    //$Value = $Config['_Linkedfields'][$Field]['Value'];
    $Query = "SELECT " . $ID . "," . $Value . " FROM `" . $Table . "` WHERE " . $Wheres . " `" . $ID . "` LIKE '%" . $query . "%' ORDER BY `" . $vals[0] . "` ASC;";
    $Res = mysql_query($Query);
    //echo $Query;
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // always modified
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Pragma: no-cache");
    // HTTP/1.0
    header("Content-Type: application/json");
    //echo '<?xml version="1.0" encoding="utf-8" >';
    //echo '<results>';
    echo "[";
    $index = 0;
    while ($Out = mysql_fetch_assoc($Res)) {
        $OutString = array();
        $valindex = 0;
        foreach ($vals as $visValues) {
            $OutString[] .= $Out[$visValues];
            //	if($valindex == 2){
            //		break;
            //	}
            $valindex++;
        }
        $infostring = '';
        //if(count($vals) > 3){
        //	for($i=3; $i<=count($vals); $i++){
        //		$infostring .= $Out[$vals[$i]].' ';
        //	}
        //}
        //$out['results'][$index]['id'] = $Out[$ID];
        //$out['results'][$index]['value'] = implode(' ', $OutString);
        //$out['results'][$index]['info'] = '';
        $arr[] = "{\"id\": \"" . $Out[$ID] . "\", \"label\": \"" . implode(' ', $OutString) . "\", \"value\": \"" . implode(' ', $OutString) . "\"}";
        //echo '<rs id="'.$Out[$ID].'" info="">'.implode(' ', $OutString).'</rs>';
        //echo $Out[$ID]." (".$Out[$Value].")|".$Out[$ID]."\n";
    }
    echo implode(", ", $arr);
    echo "]";
    //echo '</results>';
    mysql_close();
    die;
}
Example #4
0
function dr_trackActivity($Act, $EID, $ReturnValue, $Level = 0)
{
    //return;
    $Table = '';
    if (!empty($EID)) {
        $Setup = getelement($EID);
        $Table = $Setup['Content']['_main_table'];
    }
    //$ReturnValue = $Config['Content']['_ReturnFields'][0];
    $Activity = df_checkActivity($Act);
    $UserID = 0;
    if (!empty($_SESSION['UserBase']['Member']['EmailAddress'])) {
        $UserID = $_SESSION['UserBase']['Member']['EmailAddress'];
    }
    if (mysql_query("INSERT INTO `_adittrack_entries` (\n\t\t\t\t\t\t`ID` ,\n\t\t\t\t\t\t`User` ,\n\t\t\t\t\t\t`Activity` ,\n\t\t\t\t\t\t`Table` ,\n\t\t\t\t\t\t`Entry` ,\n\t\t\t\t\t\t`Element`,\n\t\t\t\t\t\t`Date`\n\t\t\t\t\t\t)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\tNULL , '" . $UserID . "', '" . $Activity . "', '" . $Table . "', '" . $ReturnValue . "', '" . $EID . "', '" . date('Y-m-d H:i:s') . "'\n\t\t\t\t\t\t);")) {
        return true;
    }
    if ($Level == 0) {
        mysql_query("CREATE TABLE IF NOT EXISTS `_adittrack_entries` (\n\t\t\t\t\t  `ID` int(11) NOT NULL auto_increment,\n\t\t\t\t\t  `User` varchar(255) NOT NULL,\n\t\t\t\t\t  `Activity` int(11) NOT NULL,\n\t\t\t\t\t  `Table` varchar(255) NOT NULL,\n\t\t\t\t\t  `Entry` varchar(255) NOT NULL,\n\t\t\t\t\t  `Element` int(11) NOT NULL,\n\t\t\t\t\t  `Date` datetime NOT NULL,\n\t\t\t\t\t  PRIMARY KEY  (`ID`)\n\t\t\t\t\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8");
        return dr_trackActivity($Act, $EID, $ReturnValue, 1);
    }
    return false;
}
Example #5
0
     $OutString = '';
     foreach ($values as $visValues) {
         $OutString .= $Det[$visValues] . ' ';
         $Defaults['_outvalue'][$Field] = $OutString;
     }
     //ob_start();
     //echo "SELECT ".$IDField.",".$ValueField." FROM `".$Table."` WHERE `".$ValueField."` LIKE '%".$Default."%' OR `".$IDField."` LIKE '%".$Default."%' ORDER BY `".$ValueField."` ASC;";
     //dump($Det);
     //$Return .= ob_get_clean();
     $VisDef = $OutString;
 }
 $Return .= '<input type="text" id="entry_' . $Element['ID'] . '_' . $Field . '_view" class="' . $Req . ' ' . $Config['_FormFieldWidth'][$Field] . '" value="' . $VisDef . '" autocomplete="off" /><input type="hidden" name="dataForm[' . $Element['ID'] . '][' . $Field . ']" id="entry_' . $Element['ID'] . '_' . $Field . '" value="' . $Det[$Config['_Linkedfields'][$Field]['ID']] . '" />';
 $_SESSION['dataform']['OutScripts'] .= "\n\n                        jQuery('#entry_" . $Element['ID'] . "_" . $Field . "_view').autocomplete({\n                                source: function( request, response ) {\n                                    //alert(request.term);\n                                    ajaxCall('linked_autocomplete', '" . $Element['ID'] . "', '" . $Field . "', request.term, function(output){\n                                        response(output);\n                                    });\n                                },\n                                minLength: 2,\n                                select: function( event, ui ) {\n                                        jQuery('#entry_" . $Element['ID'] . "_" . $Field . "').val(ui.item.id);\n                                },\n                                open: function() {\n                                        jQuery( this ).removeClass( \"ui-corner-all\" ).addClass( \"ui-corner-top\" );\n                                },\n                                close: function() {\n                                        jQuery( this ).removeClass( \"ui-corner-top\" ).addClass( \"ui-corner-all\" );\n                                }\n                        });\n\n                        // enable autocomplete\n                        jQuery('#entry_" . $Element['ID'] . "_" . $Field . "_view').each( function(index, element) {\n\t\t\t\t\t\t\t\$(element).attr('autocomplete', 'on');\n                        });\n\n                        ";
 // get the linked interfaces add entry button title
 if (!empty($Config['_Linkedfields'][$Field]['_addInterface'])) {
     $linkInterface = getelement($Config['_Linkedfields'][$Field]['_addInterface']);
     $Return .= ' <button class="btn" onclick="df_buildQuickCaptureForm(\'' . $Config['_Linkedfields'][$Field]['_addInterface'] . '\', true, \'' . $Element['ID'] . '|' . $Field . '\', linked_reloadField);return false;">' . $linkInterface['Content']['_New_Item_Title'] . '</button>';
 }
 $_SESSION['dataform']['OutScripts'] .= "\n                        ";
 /*
                         $_SESSION['dataform']['OutScripts'] .="
 
 var options = {
 	script:'".getdocument($_GET['page'])."?q_eid=".$Element['ID']."&f_i=".urlencode(base64_encode($Field))."&',
 	varname:'input',
 	json: true,
 	timeout: 5000,
 	callback: function (obj) {
 		document.getElementById('entry_".$Element['ID']."_".$Field."').value = obj.id;
 	}
 };
Example #6
0
function text_runCode($Field, $EID, $ID)
{
    $Element = getelement($EID);
    $Config = $Element['Content'];
    //dump($Config);
    $Res = mysql_query("SELECT " . $Field . " FROM " . $Config['_main_table'] . " where `" . $Config['_ReturnFields'][0] . "` = '" . $ID . "' LIMIT 1;");
    $Data = mysql_fetch_assoc($Res);
    ob_start();
    eval($Data[$Field]);
    return ob_get_clean();
}
Example #7
0
function dt_process()
{
    if (!empty($_POST['func']) && !empty($_POST['action'])) {
        if ($_POST['action'] == 'wp_dt_ajaxCall') {
            dt_ajaxCall();
            exit;
        }
    }
    if (!empty($_POST['processKey'])) {
        $_POST = stripslashes_deep($_POST);
        if ($_POST['processKey'] == $_SESSION['processKey']) {
            include_once DB_TOOLKIT . 'daiselements.class.php';
            include_once DB_TOOLKIT . 'data_form/class.php';
            include_once DB_TOOLKIT . 'data_report/class.php';
            unset($_SESSION['processKey']);
            $_SESSION['DF_Post'] = array();
            if (!empty($_POST['dr_update'])) {
                $EID = $_POST['dataForm']['EID'];
                $Setup = getelement($EID);
                unset($_POST['dataForm']['dr_update']);
                unset($_POST['dataForm']['EID']);
                $Return = df_processUpdate($_POST['dataForm'], $EID);
                if (!empty($Return['_fail_'])) {
                    $_SESSION['failedProcess'][$EID]['Data'] = $Data;
                    $_SESSION['failedProcess'][$EID]['Fields'] = $Return['_fail_'];
                    $_SESSION['DF_Notification'] = $Return['_error_'];
                    $_SESSION['DF_NotificationTypes'][] = 'error';
                    header('Location: ' . $_SERVER['HTTP_REFERER']);
                    exit;
                }
                if (!empty($Return['Value'])) {
                    dr_trackActivity('Update', $EID, $Return['Value']);
                    $_SESSION['DF_Post_returnID'] = $Return['Value'];
                    $_SESSION['DF_Post_EID'] = $EID;
                }
                if (empty($Setup['Content']['_NotificationsOff'])) {
                    if (!empty($Setup['Content']['_inlineNotifications'])) {
                        $_SESSION['DF_Notification'][] = $Return['Message'];
                        $_SESSION['DF_NotificationTypes'][] = $Return['noticeType'];
                    } else {
                        $_SESSION['DF_Post'][] = $Return['Message'];
                    }
                }
            } else {
                foreach ($_POST['dataForm'] as $EID => $Data) {
                    $Return = df_processInsert($EID, $Data);
                    if (!empty($Return['_fail_'])) {
                        $_SESSION['failedProcess'][$EID]['Data'] = $Data;
                        $_SESSION['failedProcess'][$EID]['Fields'] = $Return['_fail_'];
                        $_SESSION['DF_NotificationTypes'][] = 'error';
                        header('Location: ' . $_SERVER['HTTP_REFERER']);
                        exit;
                    }
                    // Track Activity
                    if (!empty($Return['Value'])) {
                        dr_trackActivity('Insert', $EID, $Return['Value']);
                    }
                    $Setup = getelement($EID);
                    if (empty($Setup['Content']['_NotificationsOff'])) {
                        if (!empty($Setup['Content']['_inlineNotifications'])) {
                            $_SESSION['DF_Notification'][] = $Return['Message'];
                            $_SESSION['DF_NotificationTypes'][] = $Return['noticeType'];
                        } else {
                            $_SESSION['DF_Post'][] = $Return['Message'];
                        }
                    }
                }
            }
            $Redirect = $_SERVER['HTTP_REFERER'];
            if (!empty($Return['Value'])) {
                $ReturnValue = $Return['Value'];
            }
            if (is_admin()) {
                if (!empty($Setup['Content']['_ItemViewInterface'])) {
                    $Location = 'admin.php';
                } else {
                    $Location = $_SERVER['HTTP_REFERER'];
                }
            } else {
                if (!empty($Setup['Content']['_ItemViewPage'])) {
                    $Location = get_permalink($Setup['Content']['_ItemViewPage']);
                } else {
                    $Location = $_SERVER['HTTP_REFERER'];
                }
            }
            //echo $Location;
            //exit;
            if (!empty($ReturnValue)) {
                $url = parse_url($_SERVER['HTTP_REFERER']);
                $returntoken = '?';
                if (!empty($url['query'])) {
                    if (empty($Setup['Content']['_ItemViewPage'])) {
                        $Location = str_replace('?' . $url['query'], '', $_SERVER['HTTP_REFERER']);
                    }
                    parse_str($url['query'], $gets);
                    parse_str($ReturnValue, $returngets);
                    if (!empty($Setup['Content']['_ItemViewInterface'])) {
                        $RedirInterface = get_option($Setup['Content']['_ItemViewInterface']);
                        if (!empty($RedirInterface['_ItemGroup'])) {
                            $app = get_option('_' . $RedirInterface['_Application'] . '_app');
                            if (!empty($app['docked'])) {
                                $gets['page'] = $Setup['Content']['_ItemViewInterface'];
                            } else {
                                $gets['page'] = 'dbt_builder';
                                $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface'];
                            }
                        } else {
                            $gets['page'] = 'dbt_builder';
                            $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface'];
                        }
                    }
                    $ReturnValue = htmlspecialchars_decode(@http_build_query(array_merge($gets, $returngets)));
                } else {
                    if (!empty($Setup['Content']['_ItemViewInterface'])) {
                        $RedirInterface = get_option($Setup['Content']['_ItemViewInterface']);
                        if (!empty($RedirInterface['_ItemGroup'])) {
                            $app = get_option('_' . $RedirInterface['_Application'] . '_app');
                            if (!empty($app['docked'])) {
                                $gets['page'] = $Setup['Content']['_ItemViewInterface'];
                            } else {
                                $gets['page'] = 'dbt_builder';
                                $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface'];
                            }
                        } else {
                            $gets['page'] = 'dbt_builder';
                            $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface'];
                        }
                        $ReturnValue = htmlspecialchars_decode(@http_build_query($gets, $returngets));
                    }
                }
                $Redirect = $Location . $returntoken . $ReturnValue;
            }
            //echo $Redirect;
            //exit;
            header('Location: ' . $Redirect);
            exit;
        }
    }
    //vardump($_POST);
    if (!empty($_POST['importKey'])) {
        $_POST = stripslashes_deep($_POST);
        if (empty($_FILES['fileImport']['size'])) {
            $_SESSION['dataform']['OutScripts'] .= "\n              df_buildImportForm('" . $_POST['importInterface'] . "');\n            ";
            $Redirect = $_SERVER['HTTP_REFERER'];
            header('Location: ' . $Redirect);
            exit;
        }
        $path = wp_upload_dir();
        // set filename and paths
        $Ext = pathinfo($_FILES['fileImport']['name']);
        $newFileName = $_POST['importInterface'] . '.' . $Ext['extension'];
        $newLoc = $path['path'] . '/' . $newFileName;
        $_SESSION['import_' . $_POST['importInterface']]['import'] = wp_upload_bits($newFileName, null, file_get_contents($_FILES['fileImport']['tmp_name']));
        $_SESSION['dataform']['OutScripts'] .= "\n          df_buildImportManager('" . $_POST['importInterface'] . "');\n        ";
        $Redirect = $_SERVER['HTTP_REFERER'];
        header('Location: ' . $Redirect);
        exit;
    }
    if (!empty($_POST['importPrepairKey'])) {
        $Element = getelement($_POST['importInterface']);
        $_SESSION['import_' . $_POST['importInterface']]['import']['table'] = $Element['Content']['_main_table'];
        $_SESSION['import_' . $_POST['importInterface']]['import']['delimiter'] = $_POST['importDelimeter'];
        if (!empty($_POST['importSkipFirst'])) {
            $_SESSION['import_' . $_POST['importInterface']]['import']['importSkipFirst'] = $_POST['importSkipFirst'];
        }
        $_SESSION['import_' . $_POST['importInterface']]['import']['map'] = $_POST['importMap'];
        $_SESSION['dataform']['OutScripts'] .= "\n            df_processImport('" . $_POST['importInterface'] . "');\n        ";
        $Redirect = $_SERVER['HTTP_REFERER'];
        header('Location: ' . $Redirect);
        exit;
    }
    // API Call
    //vardump($_SERVER);
    $pattern = API_getInterfaceRegex();
    if (!empty($pattern)) {
        if (preg_match('/' . $pattern['regex'] . '/s', $_SERVER['REQUEST_URI'], $matches)) {
            include_once DB_TOOLKIT . 'libs/api_engine.php';
            exit;
        }
    }
    /// EXPORT
    foreach ($_GET as $PDFExport => $Val) {
        if (!is_array($Val)) {
            if (strstr($PDFExport, 'format_')) {
                $export = explode('_dt_', $PDFExport);
                $exportFormat = $Val;
                $Media['ID'] = 'dt_' . $export[1];
                $Element = getElement($Media['ID']);
                $Config = $Element['Content'];
            }
        }
    }
    //error_reporting(E_ALL);
    //ini_set('display_errors','On');
    //esds
    if (!empty($exportFormat)) {
        if ($exportFormat == 'pdf') {
            include_once DB_TOOLKIT . 'daiselements.class.php';
            include_once DB_TOOLKIT . 'data_form/class.php';
            include_once DB_TOOLKIT . 'data_report/class.php';
            include_once DB_TOOLKIT . 'data_itemview/class.php';
            include_once DB_TOOLKIT . 'libs/fpdf.php';
            include_once DB_TOOLKIT . 'libs/pdfexport.php';
            $input_params["return"] = isset($input_params["return"]) ? $input_params["return"] : false;
            if (empty($Config['_orientation'])) {
                $Config['_orientation'] = 'P';
            }
            $report = new PDFReport($Config['_orientation'], $Config['_ReportTitle']);
            //you should use loadlib here
            //dump($_SESSION['reportFilters'][$Media['ID']]);
            if (!empty($Config['_FilterMode'])) {
                $Res = mysql_query("SELECT ID, Content FROM `dais_elements` WHERE `Element` = 'data_report' AND `ParentDocument` = " . $Element['ParentDocument'] . " AND `ID` != '" . $Media['ID'] . "';");
                while ($element = mysql_fetch_assoc($Res)) {
                    //dump($element);
                    $eConfig = unserialize($element['Content']);
                    $preReport['ID'] = $element['ID'];
                    $preReport['Config'] = $eConfig;
                    $reportExports[] = $preReport;
                }
            } else {
                $preReport['ID'] = $Media['ID'];
                $preReport['Config'] = $Config;
                $reportExports[] = $preReport;
            }
            $input_params["return"] = isset($input_params["return"]) ? $input_params["return"] : false;
            foreach ($reportExports as $key => $reportExport) {
                //dump($_SESSION);
                $Continue = true;
                $Media['ID'] = $reportExport['ID'];
                $Config = $reportExport['Config'];
                foreach ($reportExport['Config']['_Field'] as $Key => $Value) {
                    if ($Value == 'viewitem_filter') {
                        if (empty($_SESSION['viewSelector_' . $Media['ID']])) {
                            $Continue = false;
                        }
                    }
                }
                if (!empty($Continue)) {
                    $limit = 'full';
                    if (!empty($_GET['limit'])) {
                        $limit = $_GET['limit'];
                    }
                    $OutData = dr_BuildReportGrid($Media['ID'], false, $_SESSION['report_' . $Media['ID']]['SortField'], $_SESSION['report_' . $Media['ID']]['SortDir'], 'pdf', $limit);
                    //vardump($OutData);
                    $CountStat = array();
                    if (is_array($OutData)) {
                        if ($key > 0) {
                            $report->addPage();
                        }
                        // outdata - Headings
                        $report->cf_report_headersMain($OutData, $Config);
                        if (!empty($OutData['Totals'])) {
                            foreach ($OutData['Totals'] as $Field => $Value) {
                                sort($fieldset);
                                $totalData[$Field] = $Value;
                            }
                            $report->cf_report_datagrid($totalData, 7);
                            unset($OutData['Totals']);
                        }
                    }
                    $report->cf_report_spacer();
                    $Headers = array();
                    if (!empty($OutData[0])) {
                        foreach ($OutData[0] as $Header => $v) {
                            if (strpos($Config['_IndexType'][$Header], 'hide') === false) {
                                if (!empty($Config['_FieldTitle'][$Header])) {
                                    $Headers[] = $Config['_FieldTitle'][$Header];
                                } else {
                                    $Headers[] = $Header;
                                }
                            }
                        }
                        $Total = count($OutData) - 1;
                        $Body = array();
                        $Counter = 1;
                        for ($i = 0; $i <= $Total; $i++) {
                            if (is_array($OutData[$i])) {
                                foreach ($OutData[$i] as $Field => $v) {
                                    if (strpos($Config['_IndexType'][$Field], 'hide') === false) {
                                        $Body[$i][] = str_replace('&nbsp;', '', html_entity_decode($v));
                                    }
                                }
                            }
                        }
                    }
                    $options["width"] = "100%";
                    $report->cf_report_data_col_grid($Headers, $Body, $OutData, $Config);
                    $report->cf_report_spacer();
                    //break;
                }
            }
            $report->cf_report_generate_output();
            mysql_close();
            exit;
        }
        if ($exportFormat == 'csv') {
            $CSVout = fopen('php://output', 'w');
            $prequery = explode('LIMIT', $_SESSION['queries'][$Media['ID']]);
            $sql_query = $prequery[0];
            $filename = uniqid(date('mdHis')) . '.csv';
            $out = '';
            // Gets the data from the database
            $result = mysql_query($sql_query);
            $fields_cnt = mysql_num_fields($result);
            //dump($Config['_Field']);
            //dump($Config);
            //exit;
            $VisibleFields = array();
            $FieldHeaders = array();
            foreach ($Config['_Field'] as $Field => $Value) {
                if ($Config['_IndexType'][$Field] == 'index_show' || $Config['_IndexType'][$Field] == 'noindex_show') {
                    $VisibleFields[] = $Field;
                    $FieldHeaders[] = $Config['_FieldTitle'][$Field];
                }
            }
            ob_start();
            fputcsv($CSVout, $FieldHeaders, ',') . "\r\n";
            $out .= ob_get_clean();
            while ($exportData = mysql_fetch_assoc($result)) {
                // run each field type on the result
                $Row = array();
                foreach ($Config['_Field'] as $Field => $Value) {
                    $FieldType = explode('_', $Value);
                    if (in_array($Field, $VisibleFields)) {
                        if (count($FieldType) == 2) {
                            // include fieldtype
                            if (file_exists(DB_TOOLKIT . '/data_form/fieldtypes/' . $FieldType[0] . '/functions.php')) {
                                include_once DB_TOOLKIT . '/data_form/fieldtypes/' . $FieldType[0] . '/functions.php';
                            }
                            // [type_processValue($Value, $Type, $Field, $Config, $EID, $Data)
                            $Func = $FieldType[0] . '_processvalue';
                            //$FieldValue =
                            $outRow = $exportData[$Field];
                            if (function_exists($Func)) {
                                // echo 'yes there is '.$Func.'<br>';
                                $Row[] = trim(strip_tags(str_replace('<br />', "\r\n", $Func($outRow, $FieldType[1], $Field, $Config, $Media['ID'], $exportData))));
                            } else {
                                $Row[] = $outRow;
                            }
                            //dump($FieldType);
                        } else {
                            $Row[] = $exportData[$Field];
                        }
                    }
                }
                //combine row
                ob_start();
                fputcsv($CSVout, $Row, ',') . "\r\n";
                $out .= ob_get_clean();
            }
            //while($export)
            // Format the data
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            //header("Content-Length: " . strlen($out));
            // Output to browser with appropriate mime type, you choose ;)
            //header("Content-type: text/x-csv");
            //header("Content-type: text/csv");
            header("Content-type: application/csv charset=UTF-8");
            header("Content-Disposition: attachment; filename={$filename}");
            //echo '<pre>';
            echo $out;
            //echo '</pre>';
            fclose($CSVout);
            mysql_close();
            exit;
        }
        if ($exportFormat == 'template') {
            echo dt_renderInterface($Media['ID']);
            exit;
        }
        if ($exportFormat != 'pdf') {
            $Element = getelement($Media['ID']);
            $Config = $Element['Content'];
            if (!empty($Config['_Show_Plugins'])) {
                // to do : configure adding plugins to the tool bar
                if (file_exists(DB_TOOLKIT . 'data_report/plugins/' . $exportFormat . '/functions.php')) {
                    include_once DB_TOOLKIT . 'data_report/plugins/' . $exportFormat . '/functions.php';
                    mysql_close();
                    exit;
                }
            }
        }
    }
}
Example #8
0
    $FieldTitle = df_parseCamelCase($Field);
    if (!empty($Config['_FieldTitle'][$Field])) {
        $FieldTitle = $Config['_FieldTitle'][$Field];
    }
    $Return .= '<div class="filterField ' . $Class . '"><h2>' . $FieldTitle . '</h2>';
    $Return .= '<input type="text" id="filter_' . $Field . '" name="reportFilter[' . $EID . '][' . $Field . ']" value="' . $Default[$Field] . '" ' . $Sel . ' />&nbsp;&nbsp;&nbsp;</div>';
    $autoComplete = '';
    if (!empty($Config['_tagBase'][$Field])) {
        $autoComplete = "autocomplete_url:'?taggingAction=" . $EID . "&field=" . $Field . "',";
    }
    $_SESSION['dataform']['OutScripts'] .= "\r\n            jQuery('#filter_" . $Field . "').tagsInput({\r\n                    height: 'auto',\r\n                    width: 'auto',\r\n                    " . $autoComplete . "\r\n                    'defaultText':'" . $Config['_tagText'][$Field] . "'                    \r\n        });";
    return $Return;
}
/// run taging process auto complete process
if (!empty($_GET['taggingAction']) && !empty($_GET['term'])) {
    global $wpdb;
    $element = getelement($_GET['taggingAction']);
    $Config = $element['Content'];
    $tagset = sanitize_title_with_dashes($Config['_tagBase'][$_GET['field']]);
    $tagTable = $wpdb->prefix . 'dbt_tagbase_' . $tagset;
    $data = $wpdb->get_results("SELECT `id`,`tag` FROM `" . $tagTable . "` WHERE `tag` LIKE '" . mysql_real_escape_string($_GET['term']) . "%' LIMIT 10;", ARRAY_N);
    if (!empty($data)) {
        foreach ($data as $key => $value) {
            $output[$key]['id'] = $value[0];
            $output[$key]['label'] = $value[1];
            $output[$key]['value'] = $value[1];
        }
        echo json_encode($output);
    }
    exit;
}
Example #9
0
function di_showItem($EID, $Item, $Setup = false)
{
    $Element = getelement($EID);
    $Config = $Element['Content'];
    $queryJoin = '';
    $queryWhere = array();
    $queryLimit = '';
    $querySelects = array();
    $WhereTag = '';
    $groupBy = '';
    $orderStr = '';
    $countSelect = '';
    // setup columns
    if (!empty($Config['_FormLayout'])) {
        parse_str($Config['_FormLayout'], $Columns);
        if (empty($Columns['FieldList_left'])) {
            unset($Columns);
            unset($Config['_FormLayout']);
        }
    }
    //setup Field Types
    foreach ($Config['_Field'] as $Field => $Type) {
        // explodes to:
        // [0] = Field plugin dir
        // [1] = Field plugin type
        $Config['_Field'][$Field] = explode('_', $Type);
    }
    // field type filters
    $joinIndex = 'a';
    foreach ($Config['_IndexType'] as $Field => $Type) {
        $querySelects[$Field] = 'prim.`' . $Field . '`';
    }
    if (!empty($Config['_CloneField'])) {
        foreach ($Config['_CloneField'] as $CloneKey => $Clone) {
            //echo 'BEFORE';
            //vardump($querySelects);
            foreach ($querySelects as $selectKey => $selectScan) {
                $queryJoin = str_replace($CloneKey, $Clone['Master'], $queryJoin);
                $WhereTag = str_replace($CloneKey, $Clone['Master'], $WhereTag);
                if (strstr($selectScan, " AS ") === false) {
                    //echo $Clone['Master'].' - concat <br />';
                    if (strstr($selectScan, "_sourceid_") === false) {
                        $querySelects[$selectKey] = str_replace($CloneKey, $Clone['Master'] . '` AS `' . $CloneKey, $selectScan);
                    }
                }
            }
            //echo 'After';
            //vardump($querySelects);
        }
    }
    // Build Query
    foreach ($Config['_Field'] as $Field => $Type) {
        // Run Filters that have been set through each field type
        if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Type[0] . '/queryfilter.php')) {
            include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Type[0] . '/queryfilter.php';
        }
        //apply a generic keyword filter to each field is a key word has been sent
        if (!empty($_SESSION['reportFilters'][$EID]['_keywords'])) {
            if ($WhereTag == '') {
                $WhereTag = " WHERE ";
            }
            $keyField = 'prim.' . $Field;
            if (strpos($querySelects[$Field], ' AS ') !== false) {
                $keyField = strtok($querySelects[$Field], ' AS ');
            }
            $preWhere[] = $keyField . " LIKE '%" . $_SESSION['reportFilters'][$EID]['_keywords'] . "%' ";
            //dump($_SESSION['reportFilters'][$EID]);
        }
        $joinIndex++;
    }
    //post clone fixes
    foreach ($querySelects as $fieldToFix => $select) {
        if (!empty($Config['_CloneField'][$fieldToFix])) {
            $cloneReturns[$fieldToFix] = explode(' AS ', $select);
        }
    }
    if (!empty($cloneReturns)) {
        foreach ($cloneReturns as $cloneKey => $cloneField) {
            $pureName = trim(str_replace('prim.', '', $cloneField[0]), '`');
            if (!empty($cloneReturns[$pureName])) {
                $cloneReturns[$cloneKey][0] = $cloneReturns[$pureName][0];
                $querySelects[$cloneKey] = implode(' AS ', $cloneReturns[$cloneKey]);
            }
        }
    }
    // create Query Selects and Where clause string
    $querySelect = implode(',', $querySelects);
    if (!empty($Setup)) {
        $queryWhere = 'prim.' . $Setup['_filterField'] . ' = \'' . $Item . '\'';
    } else {
        $queryWhere = 'prim.' . $Config['_ReturnFields'][0] . ' = \'' . $Item . '\'';
    }
    if (!empty($queryWhere)) {
        $WhereTag = " WHERE ";
    } else {
        $WhereTag = "";
    }
    if (is_array($groupBy)) {
        $groupBy = 'GROUP BY (' . implode(',', $groupBy) . ')';
        $countLimit = '';
        $entryCount = true;
        //add totals selects to count
        if (is_array($countSelect)) {
            $countSelect = ',' . implode(',', $countSelect);
        }
    }
    $Query = "SELECT " . $querySelect . " FROM `" . $Config['_main_table'] . "` AS prim \n " . $queryJoin . " \n " . $WhereTag . " \n " . $queryWhere . "\n " . $groupBy . " \n " . $orderStr . " \n LIMIT 1;";
    // Wrap fields with ``
    //foreach($querySelects as $Field=>$FieldValue){
    //   $Query = str_replace($Field, '`'.$Field.'`', $Query);
    //}
    // Query Results
    //$Res = mysql_query($Query);
    //echo $Query.'<br /><br /><br />';
    //echo mysql_error();
    //vardump($Config['_ReturnFields']);
    //$Data = mysql_fetch_assoc($Res);
    $Data = dr_BuildReportGrid($EID, false, false, false, 'data', false, array($Config['_ReturnFields'][0] => $Item));
    if (!empty($Config['_UseViewTemplate'])) {
        //dump($Config);
        $PreReturn = $Config['_ViewTemplateContentWrapperStart'];
        $PreReturn .= $Config['_ViewTemplatePreContent'];
        $PreReturn .= $Config['_ViewTemplateContent'];
        $PreReturn .= $Config['_ViewTemplatePostContent'];
        $PreReturn .= $Config['_ViewTemplateContentWrapperEnd'];
        //echo $Config['_ViewTemplateContent'];
        $newTitle = 'View Item';
        if (!empty($Config['_ViewFormText'])) {
            $newTitle = $Config['_ViewFormText'];
        }
        foreach ($Config['_Field'] as $Field => $Types) {
            if (!empty($Config['_ViewFormText'])) {
                //dump($Data);
                if (!empty($Data['_outvalue'][$Field])) {
                    $newTitle = str_replace('{{' . $Field . '}}', $Data['_outvalue'][$Field], $newTitle);
                } else {
                    $newTitle = str_replace('{{' . $Field . '}}', $Data[$Field], $newTitle);
                }
            }
            //	dump($Type);
            if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php')) {
                if (!empty($Config['_FieldTitle'][$Field])) {
                    $name = $Config['_FieldTitle'][$Field];
                } else {
                    $name = df_parseCamelCase($Field);
                }
                $PreReturn = str_replace('{{_' . $Field . '_name}}', $name, $PreReturn);
                if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php')) {
                    $Out = false;
                    include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php';
                    $PreReturn = str_replace('{{' . $Field . '}}', $Out, $PreReturn);
                }
                $PreReturn = str_replace('{{_PageID}}', $Element['ParentDocument'], $PreReturn);
                $PreReturn = str_replace('{{_PageName}}', getdocument($Element['ParentDocument']), $PreReturn);
                $PreReturn = str_replace('{{_EID}}', $EID, $PreReturn);
            }
        }
        $Output['title'] = $newTitle;
        $Output['width'] = $Config['_popupWidthview'];
        $Output['html'] = $PreReturn;
        return $Output;
    }
    //dump($Data);
    $Row = 'list_row2';
    $LeftColumn = '';
    $RightColumn = '';
    $FarRightColumn = '';
    //vardump($Config);
    //dump($Config['_Field']);
    if (!empty($Config['_gridViewLayout'])) {
        //$Config['_gridViewLayout'] = str_replace('=viewrow', '=row', $Config['_gridLayoutView']);
        parse_str($Config['_gridViewLayout'], $Layout);
        //vardump($Config['_gridView']);
        //vardump($Layout);
        $Form = '';
        $CurrRow = '0';
        $CurrCol = '0';
        $Index = 0;
        $newTitle = 'View Item';
        if (!empty($Config['_ViewFormText'])) {
            $newTitle = $Config['_ViewFormText'];
        }
        //dump($Setup);
        foreach ($Config['_gridView'] as $row => $cols) {
            $Form .= "<div style=\"clear: both;\" class=\"view-gen-row\" id=\"pg-view-" . $row . "\">\n";
            foreach ($cols as $col => $width) {
                $Form .= "<div class=\"view-" . $row . "-" . $col . "\" style=\"float: left; overflow: hidden; width: " . $width . ";\">\n";
                $Form .= "<div id=\"pg-view-" . $row . "-" . $col . "\" class=\"view-gen-row view-gen-col view-col-" . $col . "\">\n";
                // check for section breaks
                $contentKeys = array_keys($Layout, $row . '_' . $col);
                foreach ($contentKeys as $Field) {
                    $Field = str_replace('View_Field_', '', $Field);
                    $FieldSet = $Config['_Field'][$Field];
                    if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/conf.php') && count($FieldSet) == 2) {
                        include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/conf.php';
                        if (!empty($FieldTypes[$FieldSet[1]]['visible']) && (empty($Config['_CloneField'][$Field]) || !empty($FieldTypes[$FieldSet[1]]['cloneview']))) {
                            // Check if is visible or not
                            $Out = false;
                            $Type = $FieldSet[1];
                            $Types = $FieldSet;
                            $Form .= "<label class=\"view-gen-lable singletext\" for=\"entry_" . $Element['ID'] . "_" . $Field . "\" id=\"lable_" . $Element['ID'] . "_" . $Field . "\">" . $Config['_FieldTitle'][$Field] . "</label>\n";
                            $Form .= "<div class=\"view-gen-field-data-wrapper\" id=\"view-data-" . $Field . "\">\n";
                            //$Val = $Defaults[$Field];]
                            include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/output.php';
                            //$Form = str_replace('{{'.$Field.'}}', $Out, $Form);
                            $Form .= $Out;
                            $Form .= "&nbsp;</div>\n";
                            $Form .= "<span class=\"description\" id=\"caption_" . $Element['ID'] . "_" . $Field . "\">\n";
                            $Form .= $Config['_FieldCaption'][$Field] . '&nbsp';
                            $Form .= "</span>\n";
                        } else {
                            if (empty($FieldTypes[$FieldSet[1]]['visible'])) {
                                ob_start();
                                $Val = $Defaults[$Field];
                                include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/input.php';
                                $Hidden .= ob_get_clean();
                            }
                        }
                    } else {
                        if (!empty($Config['_SectionBreak'][$Field])) {
                            $Form .= "<div class=\"sectionbreak\">\n";
                            $Form .= "<h2>" . $Config['_SectionBreak'][$Field]['Title'] . "</h2>\n";
                            if (!empty($Config['_SectionBreak'][$Field]['Caption'])) {
                                $Form .= "<span class=\"description\">" . $Config['_SectionBreak'][$Field]['Caption'] . "</span>\n";
                            }
                            $Form .= "</div>\n";
                        }
                        $Form .= '&nbsp;';
                    }
                }
                if (empty($contentKeys)) {
                    $Form .= '&nbsp;';
                }
                $Form .= "</div>\n";
                $Form .= "</div>\n";
            }
            $Form .= "</div>\n";
        }
        $Form .= '<div style="clear:left;"></div>';
        $Shown = '';
        // add title
        if (!empty($Config['_ViewFormText'])) {
            //dump($Data);
            if (!empty($Data['_outvalue'][$Field])) {
                $newTitle = str_replace('{{' . $Field . '}}', $Data['_outvalue'][$Field], $newTitle);
            } else {
                $newTitle = str_replace('{{' . $Field . '}}', $Data[$Field], $newTitle);
            }
            $Output['title'] = $newTitle;
        }
        $Output['width'] = '420';
        if (!empty($Config['_popupWidthview'])) {
            $Output['width'] = $Config['_popupWidthview'];
        }
        $Output['html'] = '<div class="formular">' . $Form . '</div>';
        if (!empty($Config['_Show_Edit'])) {
            $OutPut['edit'] = true;
        }
        return $Output;
    }
    if (!empty($Config['_FormLayout'])) {
        parse_str($Config['_FormLayout'], $Columns);
        if (empty($Columns['FieldList_left'])) {
            unset($Columns);
            unset($Config['_FormLayout']);
        }
    }
    if (!empty($Columns)) {
        foreach ($Columns as $Key => $Side) {
            if ($Key == 'FieldList_Main') {
                $ColumnSet = 'LeftColumn';
            }
            if ($Key == 'FieldList_left') {
                $ColumnSet = 'RightColumn';
            }
            if ($Key == 'FieldList_right') {
                $ColumnSet = 'FarRightColumn';
            }
            foreach ($Side as $Entry) {
                if (substr($Entry, 0, 12) != 'SectionBreak') {
                    $Row = dais_rowSwitch($Row);
                    $Field = $Entry;
                    $Types = $Config['_Field'][$Field];
                    ${$ColumnSet} .= $FieldSet[1];
                    //ob_start();
                    //dump($Config['_Field']);
                    //$$ColumnSet = ob_get_clean();
                    //$$ColumnSet .= $FieldSet[0].'<br />';
                    if (!empty($Config['_FieldTitle'][$Field])) {
                        $FieldTitle = $Config['_FieldTitle'][$Field];
                    } else {
                        $FieldTitle = df_parsecamelcase($Field);
                    }
                    if (!empty($Types[1])) {
                        include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php';
                        if ($FieldTypes[$Types[1]]['visible'] == true) {
                            $Out = false;
                            $Out = '<div id="lable_' . $Element['ID'] . '_' . $Field . '" for="entry_' . $Element['ID'] . '_' . $Field . '" class="view-gen-lable"><strong>' . $FieldTitle . '</strong></div>';
                            include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php';
                            ${$ColumnSet} .= $Out;
                        }
                    }
                } else {
                    ${$ColumnSet} .= '<h3>' . $Config['_SectionBreak']['_' . $Entry] . '</h3>';
                }
            }
        }
    } else {
        foreach ($Config['_Field'] as $Field => $Types) {
            $Row = dais_rowswitch($Row);
            if (!empty($Types[1])) {
                if (!empty($Config['_FieldTitle'][$Field])) {
                    $FieldTitle = $Config['_FieldTitle'][$Field];
                } else {
                    $FieldTitle = df_parsecamelcase($Field);
                }
                include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php';
                if ($FieldTypes[$Types[1]]['visible'] == true) {
                    $Out = false;
                    $Out = '<div id="lable_' . $Element['ID'] . '_' . $Field . '" for="entry_' . $Element['ID'] . '_' . $Field . '" class="view-gen-lable"><strong>' . $FieldTitle . '</strong></div>';
                    include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php';
                    //echo $Out;
                    if (!empty($Columns)) {
                        if (in_array($Field, $Columns['FieldList_Main'])) {
                            $LeftColumn .= $Out;
                        } elseif (in_array($Field, $Columns['FieldList_left'])) {
                            $RightColumn .= $Out;
                        }
                    } else {
                        $RightColumn .= $Out;
                    }
                }
            }
        }
    }
    if (!empty($Config['_titleField'])) {
        //infobox($Setup['_Prefix'].$Data[$Setup['_titleField']].$Setup['Suffix']);
        $OutPut['title'] = $Config['_Prefix'] . $Data[$Config['_titleField']] . $Config['Suffix'];
    } else {
        //echo '<h2>View Entry</h2>';
        $OutPut['title'] = 'View Entry';
        //$Setup['_Prefix'].$Data[$Setup['_titleField']].$Setup['Suffix'];
    }
    $Return = '<table width="100%" border="0" cellspacing="0" cellpadding="2">
		<tr>';
    $OutPut['width'] = 300;
    if (!empty($LeftColumn)) {
        $ColWidth = '33';
        if (empty($FarRightColumn)) {
            $ColWidth = '50';
        }
        $Return .= '<td width="' . $ColWidth . '%" valign="top">' . $LeftColumn . '</td>';
        $OutPut['width'] = $OutPut['width'] + 100;
    }
    if (!empty($RightColumn)) {
        $Return .= '<td valign="top">' . $RightColumn . '</td>';
        $OutPut['width'] = $OutPut['width'] + 100;
    }
    if (!empty($FarRightColumn)) {
        $Return .= '<td width="33%" valign="top">' . $FarRightColumn . '</td>';
        $OutPut['width'] = $OutPut['width'] + 100;
    }
    $Return .= '</tr>';
    $Return .= '</table>';
    if (!empty($Config['_Show_Edit'])) {
        $OutPut['edit'] = true;
        //$Return .= '<input type="button" value="Edit" class="close" onclick="dr_BuildUpDateForm('.$EID.', '.$Item.');" />';
    }
    if (!empty($Config['_EnableAudit'])) {
        $revres = mysql_query("SELECT count(_ID) as Rev FROM `_audit_" . $Config['_main_table'] . "` WHERE `" . $Config['_ReturnFields'][0] . "` = '" . $Data[$Config['_ReturnFields'][0]] . "';");
        if ($revres) {
            if (mysql_num_rows($revres) == 1) {
                $R = mysql_fetch_assoc($revres);
                $Return .= '<div class="captions">Revision ' . $R['Rev'] . '</div>';
            }
        }
    }
    $OutPut['html'] = $Return;
    return $OutPut;
}
Example #10
0
function dr_buildImportManager($EID, $delim = ',')
{
    if (($handle = fopen($_SESSION['import_' . $EID]['import']['file'], "r")) !== FALSE) {
        $_SESSION['importKey'] = uniqid(rand(100, 999) . '_importKey_');
        $Row = 1;
        $head = array();
        $body = array();
        $titles = array();
        while ($data = fgetcsv($handle, 1000, $delim)) {
            //vardump($data);
            if ($Row == 1) {
                foreach ($data as $field) {
                    $head[] = '<th style="white-space: nowrap;" scope="col">' . $field . '</th>';
                    $titles[] = $field;
                }
            } elseif ($Row == 2) {
                foreach ($data as $field) {
                    $body[] = '<td style="white-space: nowrap;">' . $field . '</td>';
                }
            }
            if ($Row == 2) {
                break;
            }
            $Row++;
        }
        fclose($handle);
    } else {
        $Out['title'] = 'Error';
        $Out['html'] = 'Could not import. Please try again.';
        $Out['width'] = 250;
    }
    //vardump($data);
    // setup selector
    $Selector = '';
    foreach ($titles as $csvField => $column) {
        $Selector .= '<option value="' . $csvField . '">' . $column . '</option>';
    }
    //vardump($titles);
    //vardump($head);
    //vardump($body);
    //ob_start();
    //vardump($_SESSION['import_'.$EID]);
    $html = '<form enctype="multipart/form-data" method="post" action="' . $_SERVER['HTTP_REFERER'] . '" class="formular" id="import_form_' . $EID . '" >';
    $html .= '<input type="hidden" name="importInterface" id="importInterface" value="' . $EID . '" />';
    $html .= '<input type="hidden" name="importPrepairKey" id="importPrepairKey" value="' . $_SESSION['importKey'] . '" />';
    $html .= '<h3>';
    $html .= 'Delimiter: <input type="text" name="importDelimeter" id="importDelimeter" value="' . stripslashes_deep($delim) . '" style="width: 20px;" onkeyup="dr_reloadImport(\'' . $EID . '\', this.value);" /> ';
    $html .= '&nbsp;Skip First Row : <input type="checkbox" name="importSkipFirst" id="importSkipFirst" value="1" checked="checked" /> ';
    $html .= '</h3>';
    $html .= '<div style="width:780px; overflow:auto">';
    $html .= '<table width="100%" cellspacing="2" cellpadding="2" border="0" class="widefat">';
    $html .= '<thead>';
    $html .= '<tr>';
    $html .= '<th scope="col"></th>';
    // heading
    $html .= implode('', $head);
    $html .= '</tr>';
    $html .= '</thead>';
    $html .= '<tbody>';
    $html .= '<tr >';
    $html .= '<td>1</td>';
    // body
    $html .= implode('', $body);
    $html .= '</tr>';
    $html .= '</tbody>';
    $html .= '</table>';
    $html .= '</div>';
    $html .= '<h3>Field Mapping</h3>';
    $Element = getelement($EID);
    //vardump($Element);
    foreach ($Element['Content']['_Field'] as $Field => $Type) {
        $html .= '<div style="float: left; overflow: hidden; width: 22.5%;">';
        $html .= '<div class="form-gen-field-wrapper" id="form-field-' . $Field . '">';
        $html .= '<label>' . $Element['Content']['_FieldTitle'][$Field] . '</label>';
        $html .= '<select id="dataField_' . $Field . '" name="importMap[' . $Field . ']">';
        $html .= '<option value="null"></option>';
        $html .= $Selector;
        $html .= '</select>';
        $html .= '<div class="caption" id="caption_' . $EID . '_Name">' . $Element['Content']['_FieldCaption'][$Field] . '&nbsp;</div>';
        $html .= '</div>';
        $html .= '</div>';
    }
    $html .= '<div style="clear:both;"></div>';
    $html .= '</form>';
    $Out['title'] = 'Import Data Setup';
    $Out['html'] = $html;
    $Out['width'] = 800;
    return $Out;
}