" . getLngt("KUNDE") . ":   " . $tmpCsEid . "   (" . $tmpCmpComp . ")\n"; else : $specialCallMode = "" . getLngt("KUNDE") . ":   " . $tmpCsEid . "   (" . $tmpCmpComp . ")

\n"; endif; if ($f_act_mtfl == "") : $f_act_mtfl = "search"; endif; endif; endif; endif; $f_search = trim($f_search); // Init mail address for VCards with the mail address of the user $f_vcard_email = getFieldValueFromId("user", "usr_id", $usr_id, "usr_email"); $htmlClass01 = "class=\"smaller\""; // input,select $htmlClass02 = "class=\"f7np1\""; // write $numOfRows = 0; // Mandator filter if ($f_hq_id == "") : $f_hq_id = array(); endif; if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif; if ($presetFields != "") : $presetFields = urldecode($presetFields); endif; $tableHeaderSearchFields = ""; // OUTPUT: Table header search fields /* $tableHeaderSearchFields .= " "; $searchString = ""; for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) : getSecHttpVars("1",array("f_" . $j)); ${("f_" . $j)} = trim(${("f_" . $j)}); $searchString .= ${("f_" . $j)}; $cellColor = getListColor(1, 1); $tableHeaderSearchFields .= "" . "" . "\n"; endfor; */ // Usage of only one search field according to an OR-search in all fields $tableHeaderSearchFields .= "" . getLngt("Suchbegriff") . ":  " . "" . "

\n"; // OUTPUT: Table header column links $tableHeaderLinks = "Bearbeiten "; for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) : $tableHeaderLinks .= "" . $mtfk_allFieldNames[$mtfck_mtfkIds[$j]] . "  "; /* $cellColor = getListColor(1, 1); $tableHeaderLinks .= " " . $mtfk_allFieldNames[$mtfck_mtfkIds[$j]] . " "; */ endfor; $tableHeaderLinks .= "Löschen "; // Remove specified object if ($f_act_mtfl == "remove" && $f_objIdRemove != "") : TA("B"); deleteStmt("metafieldvalue","mtfv_id = " . $f_objIdRemove); $f_act_mtfl = "search"; TA("C"); TA("E"); endif; // Generate search-resultset if ($f_searchmode == "") : $f_searchmode = "1"; endif; if ($f_act_mtfl == "search") : $doSearch = TRUE; if (strlen($f_search) == 0 && $callMode == "" && $f_letter == "") : $doSearch = FALSE; if (getCountOfTable("metafieldvalue") <= (MAX_CARDINALITY * 10)) : $doSearch = TRUE; endif; endif; if ($doSearch) : if ($f_searchmode == "1") : $prefix = "%"; else : $prefix = ""; endif; $whereClause = ""; $objIdArray = array(); if ($callMode != "" && $callObjId != "") : // [1.] Customer contacts if ($category == "1") : if ($callMode == "1") : // Get the object IDs equal to $sqlquery = "SELECT DISTINCT mtfv.mtfv_id" . " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk" . " WHERE mtfv.mtfv_value = '" . $callObjId . "' AND" . " mtfck.mtfc_id = '" . $category . "' AND" . " mtfv.mtfck_id = mtfck.mtfck_id AND" . " mtfk.mtfk_id = mtfck.mtfk_id AND" . " mtfk.mtfk_type = 'co2cs'"; endif; endif; else : /* Use this to search in each field by AND (like lists for cs, cr, etc.) for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) : if ($whereClause != "" && ${("f_" . $j)} != "") : $whereClause .= " OR "; endif; if (${("f_" . $j)} != "") : $whereClause .= "(mtfv.mtfck_id = '" . $mtfck_mtfckIds[$j] . "' AND mtfv.mtfv_value LIKE '" . $prefix . ${("f_" . $j)} . "%')"; endif; endfor; if ($whereClause != "") : $whereClause = " WHERE " . $whereClause; endif; */ if ($f_search != "") : $whereClause .= " AND mtfv.mtfv_value LIKE '" . $prefix . $f_search . "%'"; endif; if ($f_letter != "") : $whereClause .= " AND mtfv.mtfv_value LIKE '" . $f_letter . "%' AND (mtfk.mtfk_name = 'Name' OR mtfk.mtfk_type = 'surname')"; endif; // In the first step get the involved object IDs $sqlquery = "SELECT DISTINCT mtfv.mtfv_id" . " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk" . " WHERE mtfv.mtfck_id = mtfck.mtfck_id AND" . " mtfck.mtfc_id = '" . $category . "' AND" . " mtfck.mtfk_id = mtfk.mtfk_id" . $whereClause; // Special search for type co2cs, additional search in customer data if ($whereClause != "" && $f_letter == "") : $sqlquery2 = "SELECT DISTINCT mtfv.mtfv_id" . " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk, customer AS cs, company AS cmp" . " WHERE mtfv.mtfck_id = mtfck.mtfck_id AND" . " mtfck.mtfc_id = '" . $category . "' AND" . " mtfk.mtfk_id = mtfck.mtfk_id AND" . " mtfk.mtfk_type = 'co2cs' AND" . " cs.cs_id = mtfv.mtfv_value AND" . " cs.cmp_id = cmp.cmp_id AND" . " (cs.cs_eid LIKE '" . $prefix . $f_search . "%' OR" . " cmp.cmp_comp LIKE '" . $prefix . $f_search . "%')"; $sqlquery = "(" . $sqlquery . ") UNION (" . $sqlquery2 . ")"; endif; endif; $result = $db->dbQ($sqlquery); while ($row = $result->fetch_assoc()): $objIdArray[] = $row["mtfv_id"]; endwhile; $result->free(); if (count($objIdArray) > 0) : // Next step get all object informations of all involved objects $whereClauseHQ = " mtfck.hq_id IN " . getSQLMandatorArray($f_hq_id) . " "; if ($gHqId) : $whereClauseHQ = " mtfck.hq_id = '0' "; endif; $sqlquery = "SELECT mtfv.mtfck_id, mtfv.mtfv_id, mtfv.mtfv_value, mtfk.mtfk_type" . " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk" . " WHERE mtfv.mtfv_id IN (" . implode(",",$objIdArray) . ") AND" . " mtfck.mtfc_id = '" . $category . "' AND" . " mtfk.mtfk_id = mtfck.mtfk_id AND " . " mtfv.mtfck_id = mtfck.mtfck_id AND " . $whereClauseHQ . " ORDER BY mtfv.mtfv_id, mtfck.mtfck_sort"; $result = $db->dbQ($sqlquery); if ($viewItemsMode == "1") : if ($category == "1") : // *** [Contacts] *** // Converts formular DB data into an array and sorts it according to a special column $mtfvArray = array(); $mtfvTypeArray = array(); $constContactSortFields = getParameterValue("0", "MASK_CONTACT_SORT_FIELDS", "0"); if ($constContactSortFields == "") : $constContactSortFields = "1,2"; endif; // Sort contacts by "Name" (here first coumn) $mtfvArraySortColArray = spliti(",",$constContactSortFields); convertFormdataToArray(); // Get fields of the header to be displayed (according to contact it will be the "name" and the "firstname") $constContactHeaderFieldsDisplayed = getParameterValue("0", "MASK_CONTACT_HEADER_FIELDS_DISPLAYED", "0"); if ($constContactHeaderFieldsDisplayed == "") : $constContactHeaderFieldsDisplayed = "1,2"; endif; $contactHeaderFieldsDisplayedArray = spliti(",",$constContactHeaderFieldsDisplayed); // Get fields of the body to be displayed $constContactBodyFieldsDisplayed = getParameterValue("0", "MASK_CONTACT_BODY_FIELDS_DISPLAYED", "0"); if ($constContactBodyFieldsDisplayed == "") : $constContactBodyFieldsDisplayed = "3,4,5,6,7,8,9,10"; endif; $contactBodyFieldsDisplayedArray = spliti(",",$constContactBodyFieldsDisplayed); // Get ADDRESS fields of the body to be displayed ([0]=street, [1]=housenumber, [2]=zipcode, [3]=city) $constContactAddressFieldsDisplayed = getParameterValue("0", "MASK_CONTACT_ADDRESS_FIELDS_DISPLAYED", "0"); if ($constContactAddressFieldsDisplayed == "") : $constContactAddressFieldsDisplayed = "8,9"; endif; $contactAddressFieldsDisplayedArray = spliti(",",$constContactAddressFieldsDisplayed); $styleCell = "float:left;width:350px;height:180px;border:4px;border-style:outset;border-color:#1b12b9;margin:2px;"; $styleHeader = "height:20px;background-color:#4e45ec;padding:5px;color:#FFFFFF;cursor:pointer;"; $styleBody = "height:110px;background-color:#97bcFF;padding:5px;"; $styleFooter = "height:20px;background-color:#6e65ff;padding:5px;color:#FFFFFF;"; $styleFontHeader = "f10np1"; $styleFontBody = "f8np1"; $styleFontFooter = "f8np1"; for ($i = 0; $i < $mtfvKeysArrayLen; $i++) : $VCard = array(); $outputViewMode .= "
\n"; // Card header $outputViewMode .= "
" . substr($mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[0]] . ", " . $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[1]], 0, 29) . "
\n"; $VCard["n_family"] = $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[0]]; if ($VCard["n_family"] == "") : $VCard["n_family"] = "_"; endif; $VCard["n_given"] = $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[1]]; if ($VCard["n_given"] == "") : $VCard["n_given"] = "_"; endif; // $VCard["fn"] = $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[1]] . " " . $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[0]]; $VCard["adr_one_street"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[0]] . " " . $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[1]]; $VCard["adr_one_locality"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[3]]; $VCard["adr_one_region"] = " "; $VCard["adr_one_countryname"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[4]]; $VCard["adr_one_postalcode"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[2]]; /* [n_family] => Simon [n_given] => Frank [n_middle] => [n_prefix] => [n_suffix] => [fn] => Frank Simon [org_name] => Rotterdam Immobilien GmbH [org_unit] => [title] => Bankfachwirt, Vertrieb [tel_work] => 02173 9150 12 [tel_cell] => 0163 691 5012 [tel_fax] => 02173 9150 11 [address2] => [adr_one_street] => Rotterdam Immobilien GmbH Hauptstra=DFe 41 [adr_one_locality] => Langenfeld [adr_one_region] => [adr_one_postalcode] => 40764 [adr_one_countryname] => Deutschland [label] => Rotterdam Immobilien GmbH Hauptstra=DFe 41 Langenfeld 40764 Deutschland [url] => http://www.rotterdam-bau.de [email] => simon@rotterdam-bau.de [email_type] => PREF [tel_prefer] => [adr_one_type] => [adr_two_type] => */ $tmpArray = $mtfvArray[$mtfvKeysArray[$i]]; $tmpArrayLen = count($tmpArray); $outputViewMode .= "
"; for ($j = 0; $j < $tmpArrayLen; $j++) : // Check column to be displayed $displayCurrField = in_array($j, $contactBodyFieldsDisplayedArray); // Card body if ($displayCurrField) : $outputViewMode .= "
" . $mtfk_allFieldNames[$mtfck_mtfkIds[$j]] . "
"; $outputViewMode .= "
:
"; endif; $ftype = $mtfvTypeArray[$mtfvKeysArray[$i]][$j]; $valueToBeDisplayed = $mtfvArray[$mtfvKeysArray[$i]][$j]; if ($ftype == "co2cs") : $tmpCsId = $valueToBeDisplayed; $tmpCmpId = getFieldValueFromId("customer", "cs_id", $tmpCsId, "cmp_id"); $tmpCmpComp1 = trim(getFieldValueFromId("company", "cmp_id", $tmpCmpId, "cmp_comp")); $VCard["org_name"] = $tmpCmpComp1; $valueToBeDisplayed = getFieldValueFromId("customer", "cs_id", $valueToBeDisplayed, "cs_eid"); if ($valueToBeDisplayed != "" && $tmpCmpComp1 != "") : $valueToBeDisplayed .= "
[" . trim($tmpCmpComp1) . "]"; endif; elseif ($ftype == "mail_business" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; $VCard["email"] = $valueToBeDisplayed; $VCard["email_type"] = "PREF"; elseif ($ftype == "url_business" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; $VCard["url_work"] = $valueToBeDisplayed; elseif ($ftype == "mobile_business" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; $VCard["tel_cell"] = $valueToBeDisplayed; elseif ($ftype == "phone_business" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; $VCard["tel_work"] = $valueToBeDisplayed; elseif ($ftype == "fax_business" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; $VCard["tel_fax"] = $valueToBeDisplayed; elseif ($ftype == "phone_private" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; // $VCard[] = $valueToBeDisplayed; elseif ($ftype == "birthdate" && $valueToBeDisplayed != "") : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; $VCard["bday"] = substr($valueToBeDisplayed,3,2) . "/" . substr($valueToBeDisplayed,0,2) . "/" . substr($valueToBeDisplayed,6,4); else : if ($displayCurrField) : $outputViewMode .= "
" . $valueToBeDisplayed . "
"; endif; endif; endfor; $outputViewMode .= "
\n"; // Create vCard object $vCardObj = new vCard(); $VCardString = $vCardObj->out($VCard); // $VCardString = nl2br($VCardString); $VCardStringJs = my_str_check_js($VCardString); $VCardStringHttp = my_str_check_http($VCardString); // Card footer $outputViewMode .= "
\n"; $outputViewMode .= "     "; $outputViewMode .= "     "; $outputViewMode .= "   "; $outputViewMode .= "
\n"; $outputViewMode .= "
\n"; endfor; elseif ($category == "10") : // *** [Newsletter] *** // $viewItemsMode = "0"; $statusMessage = getLngt("Für die Newsletter steht keine Kartenansicht zur Verfügung! Bitte zur Listenansicht wechseln!"); endif; else : // *** Default output as a list, table with header *** $lineToggler = 0; $remObjId = ""; $tableOfRows .= ""; while ($row = $result->fetch_assoc()): if ($remObjId == "" || $remObjId != $row["mtfv_id"]) : if ($remObjId != "") : $tableOfRows .= "  "; $tableOfRows .= ""; endif; $numOfRows++; $remObjId = $row["mtfv_id"]; if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif; $cellColor = getListColor($numOfRows, $lineToggler); $tableOfRows .= "  "; endif; $valueToBeDisplayed = $row["mtfv_value"]; if ($row["mtfk_type"] == "co2cs") : $tmpCsId = $valueToBeDisplayed; $tmpCmpId = getFieldValueFromId("customer", "cs_id", $tmpCsId, "cmp_id"); $tmpCmpComp1 = trim(getFieldValueFromId("company", "cmp_id", $tmpCmpId, "cmp_comp")); $valueToBeDisplayed = getFieldValueFromId("customer", "cs_id", $valueToBeDisplayed, "cs_eid"); if ($valueToBeDisplayed != "" && $tmpCmpComp1 != "") : $valueToBeDisplayed .= "
[" . trim($tmpCmpComp1) . "]"; endif; elseif ($row["mtfk_type"] == "checkboxes_hq") : $tmpHqArray = spliti(",", $row["mtfv_value"]); $tmpHqArrayLen = count($tmpHqArray); for ($i = 0; $i < $tmpHqArrayLen; $i++) : $tmpHqArray[$i] = getFieldValueFromId("headquarters","hq_id",$tmpHqArray[$i],"hq_mnemonic"); endfor; $valueToBeDisplayed = implode(",",$tmpHqArray); elseif (substr($row["mtfk_type"],0,7) == "select:") : // SELECT FIELD $subTypeArray = spliti(":",$row["mtfk_type"]); $table = $subTypeArray[1]; if ($table == "vht") : $valueToBeDisplayed = getFieldValueFromClause("metatype","mt_value","mt_type = 'vehicletype' AND mt_sort = '" . $row["mtfv_value"] . "' AND mt_objid = '0'"); endif; if ($table == "grp") : $valueToBeDisplayed = getFieldValueFromId("groups","grp_id",$row["mtfv_value"],"grp_name"); endif; if ($table == "br") : $valueToBeDisplayed = getFieldValueFromId("branch","br_id",$row["mtfv_value"],"br_name"); endif; endif; $tableOfRows .= " " . $valueToBeDisplayed . ""; endwhile; $tableOfRows .= "  "; $tableOfRows .= ""; $result->free(); endif; endif; else : $statusMessage = getLngt("Es erfolgte keine Suche!"); endif; endif; $headerOps = "   |   "; $headerOps .= " " . "Neuer Eintrag" . " "; $pageHeadline = "" . ($pageTitel != "" ? strtoupper($pageTitel) . "" : strtoupper($mtfcDescription) . "" . "     " . $mtfObjAddressArr["comp"] . ($mtfObjAddressArr["comp2"] != "" ? " :: " . $mtfObjAddressArr["comp2"] : "")); ?> <?php echo $pageTitel ?>
      |       |       > >    |       > >
name="f_search" value="" size="35" placeholder="">
0) : ?>