コード例 #1
0
function BuildSelectControl($field, $value, $fieldNum = 0, $mode, $id = "", $additionalCtrlParams, &$pageObj)
{
    global $conn, $strTableName;
    //	read control settings
    $table = $strTableName;
    $strLabel = Label($field);
    $is508 = isEnableSection508();
    $alt = "";
    if (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $is508) {
        $alt = ' alt="' . htmlspecialchars($strLabel) . '" ';
    }
    $cfield = "value_" . GoodFieldName($field) . "_" . $id;
    $clookupfield = "display_value_" . GoodFieldName($field) . "_" . $id;
    $openlookup = "open_lookup_" . GoodFieldName($field) . "_" . $id;
    $ctype = "type_" . GoodFieldName($field) . "_" . $id;
    if ($fieldNum) {
        $cfield = "value" . $fieldNum . "_" . GoodFieldName($field) . "_" . $id;
        $ctype = "type" . $fieldNum . "_" . GoodFieldName($field) . "_" . $id;
    }
    $addnewitem = false;
    $advancedadd = false;
    $strCategoryControl = CategoryControl($field, $table);
    $categoryFieldId = GoodFieldName(CategoryControl($field, $table));
    $bUseCategory = UseCategory($field, $table);
    $dependentLookups = GetFieldData($table, $field, "DependentLookups", array());
    $lookupType = GetLookupType($field, $table);
    $LCType = LookupControlType($field, $table);
    $horizontalLookup = GetFieldData($table, $field, "HorizontalLookup", false);
    $inputStyle = $additionalCtrlParams['style'] ? 'style="' . $additionalCtrlParams['style'] . '"' : '';
    $lookupTable = GetLookupTable($field, $table);
    $strLookupWhere = LookupWhere($field, $table);
    $lookupSize = SelectSize($field, $table);
    if ($LCType == LCT_CBLIST) {
        $lookupSize = 2;
    }
    // simply > 1 for CBLIST
    $add_page = GetTableURL($lookupTable) . "_add.php";
    $list_page = GetTableURL($lookupTable) . "_list.php";
    $strPerm = GetUserPermissions($lookupTable);
    //	alter "add on the fly" settings
    if (strpos($strPerm, "A") !== false) {
        $addnewitem = GetFieldData($table, $field, "AllowToAdd", false);
        $advancedadd = !GetFieldData($table, $field, "SimpleAdd", false);
        if (!$advancedadd) {
            $addnewitem = false;
        }
    }
    //	alter lookuptype settings
    if ($LCType == LCT_LIST && strpos($strPerm, "S") === false) {
        $LCType = LCT_DROPDOWN;
    }
    if ($LCType == LCT_LIST) {
        $addnewitem = false;
    }
    if ($mode == MODE_SEARCH) {
        $addnewitem = false;
    }
    //	prepare multi-select attributes
    $multiple = "";
    $postfix = "";
    if ($lookupSize > 1) {
        $avalue = splitvalues($value);
        $multiple = " multiple";
        $postfix = "[]";
    } else {
        $avalue = array((string) $value);
    }
    //	prepare JS code
    $className = "DropDownLookup";
    if ($LCType == LCT_AJAX) {
        $className = "EditBoxLookup";
    } elseif ($LCType == LCT_LIST) {
        $className = "ListPageLookup";
    } elseif ($LCType == LCT_CBLIST) {
        $className = "CheckBoxLookup";
    }
    //	build the control
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //	list of values
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    if ($lookupType == LT_LISTOFVALUES) {
        //	read lookup values
        $arr = GetFieldData($table, $field, "LookupValues", array());
        //	print Type control to allow selecting nothing
        if ($lookupSize > 1) {
            echo "<input id=\"" . $ctype . "\" type=hidden name=\"" . $ctype . "\" value=\"multiselect\">";
        }
        //	dropdown control
        if ($LCType == LCT_DROPDOWN) {
            $alt = "";
            echo '<select id="' . $cfield . '" size = "' . $lookupSize . '" ' . $alt . 'name="' . $cfield . $postfix . '" ' . $multiple . '>';
            if ($lookupSize < 2) {
                echo '<option value="">' . mlang_message("PLEASE_SELECT") . '</option>';
            } else {
                if ($mode == MODE_SEARCH) {
                    echo '<option value=""> </option>';
                }
            }
            foreach ($arr as $opt) {
                $res = array_search((string) $opt, $avalue);
                if (!($res === NULL || $res === FALSE)) {
                    echo '<option value="' . htmlspecialchars($opt) . '" selected>' . htmlspecialchars($opt) . '</option>';
                } else {
                    echo '<option value="' . htmlspecialchars($opt) . '">' . htmlspecialchars($opt) . '</option>';
                }
            }
            echo "</select>";
        } elseif ($LCType == LCT_CBLIST) {
            echo '<div align=\'left\'>';
            $spacer = '<br/>';
            if ($horizontalLookup) {
                $spacer = '&nbsp;';
            }
            $i = 0;
            foreach ($arr as $opt) {
                echo '<input id="' . $cfield . '_' . $i . '" type="checkbox" ' . $alt . ' name="' . $cfield . $postfix . '" value="' . htmlspecialchars($opt) . '"';
                $res = array_search((string) $opt, $avalue);
                if (!($res === NULL || $res === FALSE)) {
                    echo ' checked="checked" ';
                }
                echo '/>';
                echo '&nbsp;<b id="data_' . $cfield . '_' . $i . '">' . htmlspecialchars($opt) . '</b>' . $spacer;
                $i++;
            }
            echo '</div>';
        }
        return;
    }
    // build table-based lookup
    ////////////////////////////////////////////////////////////////////////////////////////////
    //	table-based ajax-lookup control
    ////////////////////////////////////////////////////////////////////////////////////////////
    if ($LCType == LCT_AJAX || $LCType == LCT_LIST) {
        ////////////////////////////////////////////////////////////////////////////////////////////
        //	dependent ajax-lookup control
        ////////////////////////////////////////////////////////////////////////////////////////////
        if (UseCategory($field)) {
            // ajax	dependent dropdown
            // get parent value
            $celementvalue = "var parVal = ''; var parCtrl = Runner.controls.ControlManager.getAt('" . jsreplace($strTableName) . "', " . $id . ", '" . jsreplace($field) . "', 0).parentCtrl; if (parCtrl){ parVal = parCtrl.getStringValue();};";
            if ($LCType == LCT_AJAX) {
                echo '<input type="text" categoryId="' . $categoryFieldId . '" autocomplete="off" id="' . $clookupfield . '" name="' . $clookupfield . '" ' . $inputStyle . '>';
            } elseif ($LCType == LCT_LIST) {
                echo '<input type="text" categoryId="' . $categoryFieldId . '" autocomplete="off" id="' . $clookupfield . '" name="' . $clookupfield . '"  readonly ' . $inputStyle . '>';
                echo "&nbsp;<a href=# id=" . $openlookup . ">" . mlang_message("SELECT_LIST") . "</a>";
            }
            echo '<input type="hidden" id="' . $cfield . '" name="' . $cfield . '">';
            //	add new item link
            if ($addnewitem) {
                echo "&nbsp;<a href=# id='addnew_" . $cfield . "'>" . mlang_message("ADD_NEW") . "</a>";
            }
            return;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////
        //	regular ajax-lookup control
        ////////////////////////////////////////////////////////////////////////////////////////////
        //	get the initial value
        $lookup_value = "";
        $lookupSQL = buildLookupSQL($field, $table, "", $value, false, true, false, true);
        $rs_lookup = db_query($lookupSQL, $conn);
        if ($data = db_fetch_numarray($rs_lookup)) {
            $lookup_value = $data[1];
        } elseif (strlen($strLookupWhere)) {
            // try w/o WHERE expression
            $lookupSQL = buildLookupSQL($field, $table, "", $value, false, true, false, true);
            $rs_lookup = db_query($lookupSQL, $conn);
            if ($data = db_fetch_numarray($rs_lookup)) {
                $lookup_value = $data[1];
            }
        }
        //	build the control
        if ($LCType == LCT_AJAX) {
            if (!strlen($lookup_value) && GetFieldData($strTableName, $field, "freeInput", false)) {
                $lookup_value = $value;
            }
            echo '<input type="text" ' . $inputStyle . ' autocomplete="off" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'id="' . $clookupfield . '" name="' . $clookupfield . '" value="' . htmlspecialchars($lookup_value) . '">';
        } elseif ($LCType == LCT_LIST) {
            echo '<input type="text" autocomplete="off" ' . $inputStyle . ' id="' . $clookupfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $clookupfield . '" value="' . htmlspecialchars($lookup_value) . '" 	readonly >';
            echo "&nbsp;<a href=# id=" . $openlookup . ">" . mlang_message("SELECT_LIST") . "</a>";
        }
        echo '<input type="hidden" id="' . $cfield . '" name="' . $cfield . '" value="' . htmlspecialchars($value) . '">';
        //	add new item
        if ($addnewitem) {
            echo "&nbsp;<a href=# id='addnew_" . $cfield . "'>" . mlang_message("ADD_NEW") . "</a>";
        }
        return;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////
    //	classic lookup - start
    ////////////////////////////////////////////////////////////////////////////////////////////
    $lookupSQL = buildLookupSQL($field, $table, "", "", false, false, false);
    $rs = db_query($lookupSQL, $conn);
    ////////////////////////////////////////////////////////////////////////////////////////////
    //	dependent classic lookup
    ////////////////////////////////////////////////////////////////////////////////////////////
    if ($bUseCategory) {
        //	print Type control to allow selecting nothing
        if ($lookupSize > 1) {
            echo "<input id=\"" . $ctype . "\" type=hidden name=\"" . $ctype . "\" value=\"multiselect\">";
        }
        echo '<select size = "' . $lookupSize . '" id="' . $cfield . '" name="' . $cfield . $postfix . '"' . $multiple . '>';
        echo '<option value="">' . mlang_message("PLEASE_SELECT") . '</option>';
        echo "</select>";
        if ($addnewitem) {
            echo "&nbsp;<a href=# id='addnew_" . $cfield . "'>" . mlang_message("ADD_NEW") . "</a>";
        }
        return;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////
    //	simple classic lookup
    ////////////////////////////////////////////////////////////////////////////////////////////
    //	print control header
    if ($lookupSize > 1) {
        echo "<input id=\"" . $ctype . "\" type=hidden name=\"" . $ctype . "\" value=\"multiselect\">";
    }
    if ($LCType != LCT_CBLIST) {
        echo '<select size = "' . $lookupSize . '" id="' . $cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . $postfix . '"' . $multiple . '>';
        if ($lookupSize < 2) {
            echo '<option value="">' . mlang_message("PLEASE_SELECT") . '</option>';
        } else {
            if ($mode == MODE_SEARCH) {
                echo '<option value=""> </option>';
            }
        }
    } else {
        echo '<div align=\'left\'>';
        $spacer = '<br/>';
        if ($horizontalLookup) {
            $spacer = '&nbsp;';
        }
    }
    //	print lookup data
    $found = false;
    $i = 0;
    while ($data = db_fetch_numarray($rs)) {
        $res = array_search((string) $data[0], $avalue);
        $checked = "";
        if (!($res === NULL || $res === FALSE)) {
            $found = true;
            if ($LCType == LCT_CBLIST) {
                $checked = " checked=\"checked\"";
            } else {
                $checked = " selected";
            }
        }
        if ($LCType == LCT_CBLIST) {
            echo '<input id="' . $cfield . '_' . $i . '" type="checkbox" ' . $alt . ' name="' . $cfield . $postfix . '" value="' . htmlspecialchars($data[0]) . '"' . $checked . '/>';
            echo '&nbsp;<b id="data_' . $cfield . '_' . $i . '">' . htmlspecialchars($data[1]) . '</b>' . $spacer;
        } else {
            echo '<option value="' . htmlspecialchars($data[0]) . '"' . $checked . '>' . htmlspecialchars($data[1]) . '</option>';
        }
        $i++;
    }
    //	try the same query w/o WHERE clause if current value not found
    if (!$found && strlen($value) && $mode == MODE_EDIT && strlen($strLookupWhere)) {
        $lookupSQL = buildLookupSQL($field, $table, "", $value, false, true, false, false, true);
        $rs = db_query($lookupSQL, $conn);
        if ($data = db_fetch_numarray($rs)) {
            if ($LCType == LCT_CBLIST) {
                echo '<input id="' . $cfield . '_' . $i . '" type="checkbox" ' . $alt . ' name="' . $cfield . $postfix . '" value="' . htmlspecialchars($data[0]) . '" checked="checked"/>';
                echo '&nbsp;<b id="data_' . $cfield . '_' . $i . '">' . htmlspecialchars($data[1]) . '</b>' . $spacer;
            } else {
                echo '<option value="' . htmlspecialchars($data[0]) . '" selected>' . htmlspecialchars($data[1]) . '</option>';
            }
        }
    }
    //	print footer
    if ($LCType != LCT_CBLIST) {
        echo "</select>";
    } else {
        echo '</div>';
    }
    //	add new item
    if ($addnewitem) {
        echo "&nbsp;<a href=# id='addnew_" . $cfield . "'>" . mlang_message("ADD_NEW") . "</a>";
    }
}
コード例 #2
0
 function labelFormat($fieldName, $data)
 {
     $table = $this->sessionPrefix;
     $strViewFormat = GetFieldData($table, $fieldName, "ViewFormat", "");
     $strEditFormat = GetFieldData($table, $fieldName, "EditFormat", "");
     if (($strEditFormat == EDIT_FORMAT_LOOKUP_WIZARD || $strEditFormat == EDIT_FORMAT_RADIO) && GetLookupType($fieldName, $table) == LT_LOOKUPTABLE && GetLWLinkField($fieldName, $table) != GetLWDisplayField($fieldName, $table)) {
         $value = DisplayLookupWizard($fieldName, $data[$fieldName], $data, "", MODE_PRINT);
     } else {
         $value = GetData($data, $fieldName, $strViewFormat);
     }
     if (strlen($value) > 50) {
         $value = substr($value, 0, 47) . "...";
     }
     return $this->chart_xmlencode($value);
 }
コード例 #3
0
 /**
  * Proccess record values
  *
  * @param array $record
  * @param array $data
  * @param string $keylink
  */
 function proccessRecordValue(&$data, &$keylink, $listFieldInfo)
 {
     $value = "";
     if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_IMAGE) {
         if (ShowThumbnail($listFieldInfo['fName'], $this->tName)) {
             $thumbPref = GetThumbnailPrefix($listFieldInfo['fName'], $this->tName);
             $value .= "<a";
             if (IsUseiBox($listFieldInfo['fName'], $this->tName)) {
                 $value .= " rel='ibox'";
             } else {
                 $value .= " target=_blank";
             }
             $value .= " href='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
             $value .= "<img border=0";
             if ($this->is508) {
                 $value .= " alt=\"Image from DB\"";
             }
             $value .= " src='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($thumbPref) . "&alt=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
             $value .= "</a>";
         } else {
             $value = "<img";
             if ($this->is508) {
                 $value .= " alt=\"Image from DB\"";
             }
             $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName);
             $value .= $imgWidth ? " width=" . $imgWidth : "";
             $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName);
             $value .= $imgHeight ? " height=" . $imgHeight : "";
             $value .= " border=0";
             $value .= " src='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
         }
     } else {
         if ($listFieldInfo['viewFormat'] == FORMAT_FILE_IMAGE) {
             if (CheckImageExtension($data[$listFieldInfo['fName']])) {
                 if (ShowThumbnail($listFieldInfo['fName'], $this->tName)) {
                     // show thumbnail
                     $thumbPref = GetThumbnailPrefix($listFieldInfo['fName'], $this->tName);
                     $thumbname = $thumbPref . $data[$listFieldInfo['fName']];
                     if (substr(GetLinkPrefix($listFieldInfo['fName'], $this->tName), 0, 7) != "http://" && !myfile_exists(GetUploadFolder($listFieldInfo['fName']) . $thumbname)) {
                         $thumbname = $data[$listFieldInfo['fName']];
                     }
                     $value = "<a";
                     if (IsUseiBox($listFieldInfo['fName'], $this->tName)) {
                         $value .= " rel='ibox'";
                     } else {
                         $value .= " target=_blank";
                     }
                     $value .= " href=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $data[$listFieldInfo['fName']])) . "\">";
                     $value .= "<img";
                     if ($thumbname == $data[$listFieldInfo['fName']]) {
                         $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName);
                         $value .= $imgWidth ? " width=" . $imgWidth : "";
                         $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName);
                         $value .= $imgHeight ? " height=" . $imgHeight : "";
                     }
                     $value .= " border=0";
                     if ($this->is508) {
                         $value .= " alt=\"" . htmlspecialchars($data[$listFieldInfo['fName']]) . "\"";
                     }
                     $value .= " src=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $thumbname)) . "\"></a>";
                 } else {
                     $value = "<img";
                     $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName);
                     $value .= $imgWidth ? " width=" . $imgWidth : "";
                     $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName);
                     $value .= $imgHeight ? " height=" . $imgHeight : "";
                     $value .= " border=0";
                     if ($this->is508) {
                         $value .= " alt=\"" . htmlspecialchars($data[$listFieldInfo['fName']]) . "\"";
                     }
                     $value .= " src=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $data[$listFieldInfo['fName']])) . "\">";
                 }
             }
         } else {
             if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_FILE) {
                 $fileNameF = GetFilenameField($listFieldInfo['fName'], $this->tName);
                 if ($fileNameF) {
                     $fileName = $data[$fileNameF];
                     if (!$fileName) {
                         $fileName = "file.bin";
                     }
                 } else {
                     $fileName = "file.bin";
                 }
                 if (strlen($data[$listFieldInfo['fName']])) {
                     $value = "<a href='getfile.php?table=" . $this->shortTableName . "&filename=" . rawurlencode($fileName) . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
                     $value .= htmlspecialchars($fileName);
                     $value .= "</a>";
                 }
             } else {
                 if ($listFieldInfo['viewFormat'] == FORMAT_AUDIO) {
                     $fileName = GetData($data, $listFieldInfo['fName'], FORMAT_NONE);
                     $fieldIsUrl = GetFieldData($this->tName, $listFieldInfo['fName'], "fieldIsVideoUrl", false);
                     if (strlen($fileName)) {
                         $absFileName = "";
                         if (!$fieldIsUrl && GetFieldData($this->tName, $listFieldInfo['fName'], "Absolute", false)) {
                             $absFileName = GetUploadFolder($listFieldInfo['fName']) . $fileName;
                         } elseif (!$fieldIsUrl) {
                             $absFileName = getabspath(GetUploadFolder($listFieldInfo['fName']) . $fileName);
                         }
                         // if file
                         if ($fieldIsUrl || file_exists($absFileName)) {
                             $titleField = GetFieldData($this->tName, $listFieldInfo['fName'], 'audioTitleField', "");
                             $title = "";
                             if ($titleField) {
                                 $title = htmlspecialchars(GetData($data, $titleField, ViewFormat($titleField, $titleField)));
                             }
                             if ($fieldIsUrl) {
                                 $href = $fileName;
                             } else {
                                 $href = 'download.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink;
                             }
                             $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="' . $href . '">' . $title . '</a>';
                         }
                     }
                 } else {
                     if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_AUDIO) {
                         $titleField = GetFieldData($this->tName, $listFieldInfo['fName'], 'audioTitleField', "");
                         $title = "";
                         if ($titleField) {
                             $title = htmlspecialchars(GetData($data, $titleField, ViewFormat($titleField, $titleField)));
                         }
                         if (@$data[$listFieldInfo['fName']] != NULL) {
                             $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="getfile.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink . '">' . $title . '</a>';
                         } else {
                             $value = $title;
                         }
                     } else {
                         if ($listFieldInfo['viewFormat'] == FORMAT_VIDEO) {
                             $value = "";
                             $fieldIsUrl = GetFieldData($this->tName, $listFieldInfo['fName'], "fieldIsVideoUrl", false);
                             $fileName = GetData($data, $listFieldInfo['fName'], FORMAT_NONE);
                             if (strlen($fileName)) {
                                 $absFileName = "";
                                 if (!$fieldIsUrl && GetFieldData($this->tName, $listFieldInfo['fName'], "Absolute", false)) {
                                     $absFileName = GetUploadFolder($listFieldInfo['fName']) . $fileName;
                                 } elseif (!$fieldIsUrl) {
                                     $absFileName = getabspath(GetUploadFolder($listFieldInfo['fName']) . $fileName);
                                 }
                                 // if file
                                 if ($fieldIsUrl || file_exists($absFileName)) {
                                     $videoId = 'video_' . GoodFieldName(htmlspecialchars($listFieldInfo['fName'])) . '_' . $this->recId;
                                     if ($fieldIsUrl) {
                                         $href = $fileName;
                                     } else {
                                         $href = 'download.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink;
                                     }
                                     $value = '<a href="' . $href . '" style="display:block;width:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoWidth', "") . 'px;height:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoHeight', "") . 'px;" id="' . $videoId . '"></a>';
                                     $this->controlsMap['video'][] = $videoId;
                                 }
                             }
                         } else {
                             if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_VIDEO) {
                                 if (@$data[$listFieldInfo['fName']] != NULL) {
                                     $videoId = 'video_' . GoodFieldName(htmlspecialchars($listFieldInfo['fName'])) . '_' . $this->recId;
                                     $value = '<a href="getfile.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink . '" style="display:block;width:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoWidth', 0) . 'px;height:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoHeight', 0) . 'px;" id="' . $videoId . '"></a>';
                                     $this->controlsMap['video'][] = $videoId;
                                 }
                             } else {
                                 if ($listFieldInfo['viewFormat'] == FORMAT_MAP) {
                                     $value = '<div id="littleMap_' . GoodFieldName($listFieldInfo['fName']) . '_' . $this->recId . '" style="width: ' . $this->googleMapCfg['fieldsAsMap'][$listFieldInfo['fName']]['width'] . 'px; height: ' . $this->googleMapCfg['fieldsAsMap'][$listFieldInfo['fName']]['height'] . 'px;"></div>';
                                 } else {
                                     if (($listFieldInfo['editFormat'] == EDIT_FORMAT_LOOKUP_WIZARD || $listFieldInfo['editFormat'] == EDIT_FORMAT_RADIO) && GetLookupType($listFieldInfo['fName'], $this->tName) == LT_LOOKUPTABLE && GetLWLinkField($listFieldInfo['fName'], $this->tName) != GetLWDisplayField($listFieldInfo['fName'], $this->tName)) {
                                         $value = DisplayLookupWizard($listFieldInfo['fName'], $data[$listFieldInfo['fName']], $data, $keylink, MODE_LIST);
                                     } else {
                                         if (NeedEncode($listFieldInfo['fName'], $this->tName)) {
                                             $value = ProcessLargeText(GetData($data, $listFieldInfo['fName'], $listFieldInfo['viewFormat']), "field=" . rawurlencode($listFieldInfo['fName']) . $keylink, "", MODE_LIST);
                                         } else {
                                             $value = GetData($data, $listFieldInfo['fName'], $listFieldInfo['viewFormat']);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // create address field as center link
     $value = $this->addCenterLink($value, $listFieldInfo['fName']);
     return $value;
 }
コード例 #4
0
 function getFormattedRow($value)
 {
     $row = array('row_data' => true);
     $keylink = "";
     for ($i = 0; $i < count($this->tKeyFields); $i++) {
         $keylink .= "&key" . ($i + 1) . "=" . htmlspecialchars(rawurlencode(@$value[$this->tKeyFields[$i]]));
     }
     for ($i = 0; $i < count($this->fieldsArr); $i++) {
         // for change pseudo foreach with condition with PHP for
         // foreach Fields as @f filter @f.bReportPage && (@TABLE.bReportShowDetails || @TABLE.arrReportGroupFields[strGroupField==@f.strName && nGroupInterval==0].len) order nReportPageOrder
         $pass = false;
         for ($j = 0; $j < count($this->repGroupFields); $j++) {
             if (!$this->fieldsArr[$i]['repPage'] || !($this->repShowDet || $this->repGroupFields[$j]['strGroupField'] == $this->fieldsArr[$i]['name'] && $this->repGroupFields[$j]['groupInterval'] === 0)) {
                 $pass = true;
             }
         }
         if ($pass) {
             continue;
         }
         if ($this->fieldsArr[$i]['viewFormat'] == FORMAT_DATABASE_IMAGE) {
             if (!$this->forExport) {
                 if ($this->fieldsArr[$i]['showThumb']) {
                     $val .= "<a ";
                     if (IsUseiBox($this->fieldsArr[$i]['name'], $this->tName)) {
                         $val .= " rel='ibox'";
                     } else {
                         $val .= " target=_blank";
                     }
                     $val .= " href=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">";
                     $val .= "<img border=0";
                     if (isEnableSection508()) {
                         $val .= " alt=\"Image from DB\"";
                     }
                     $val .= " src=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['thumbnail'])) . "&alt=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['repPage'])) . $keylink . "\">";
                     $val .= "</a>";
                 } else {
                     $val = "<img";
                     if ($this->fieldsArr[$i]['imageWidth']) {
                         $val .= " width=" . $this->fieldsArr[$i]['imageWidth'];
                     }
                     if ($this->fieldsArr[$i]['imageHeight']) {
                         $val .= " height=" . $this->fieldsArr[$i]['imageHeight'];
                     }
                     $val .= " border=0";
                     if (isEnableSection508()) {
                         $val .= " alt=\"Image from DB\"";
                     }
                     $val .= " src=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">";
                 }
             } else {
                 $val = mlang_message("LONG_BINARY");
             }
         } elseif ($this->fieldsArr[$i]['viewFormat'] == FORMAT_FILE_IMAGE) {
             if (!$this->forExport) {
                 if (CheckImageExtension($value[$this->fieldsArr[$i]['name']])) {
                     if ($this->fieldsArr[$i]['showThumb']) {
                         // show thumbnail
                         $thumbname = $this->fieldsArr[$i]['thumbnail'] . $value[$this->fieldsArr[$i]['name']];
                         if (substr($this->fieldsArr[$i]['strhlPrefix'], 0, 7) != "http://" && !myfile_exists(getabspath($this->fieldsArr[$i]['strhlPrefix'] . $thumbname))) {
                             $thumbname = $value[$this->fieldsArr[$i]['name']];
                         }
                         $val = "<a";
                         if (IsUseiBox($this->fieldsArr[$i]['name'], $this->tName)) {
                             $val .= " rel='ibox'";
                         } else {
                             $val .= " target=_blank";
                         }
                         $val .= " href=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']])) . "\">";
                         $val .= "<img";
                         if ($thumbname == $value[$this->fieldsArr[$i]['name']]) {
                             if ($this->fieldsArr[$i]['imageWidth']) {
                                 $val .= " width=" . $this->fieldsArr[$i]['imageWidth'];
                             }
                             if ($this->fieldsArr[$i]['imageHeight']) {
                                 $val .= " height=" . $this->fieldsArr[$i]['imageHeight'];
                             }
                         }
                         $val .= " border=0";
                         if (isEnableSection508()) {
                             $val .= " alt=\"" . htmlspecialchars($value[$this->fieldsArr[$i]['name']]) . "\"";
                         }
                         $val .= " src=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $thumbname)) . "\"></a>";
                     } else {
                         $val = "<img";
                         if ($this->fieldsArr[$i]['imageWidth']) {
                             $val .= " width=" . $this->fieldsArr[$i]['imageWidth'];
                         }
                         if ($this->fieldsArr[$i]['imageHeight']) {
                             $val .= " height=" . $this->fieldsArr[$i]['imageHeight'];
                         }
                         $val .= " border=0";
                         if (isEnableSection508()) {
                             $val .= " alt=\"" . htmlspecialchars($value[$this->fieldsArr[$i]['name']]) . "\"";
                         }
                         $val .= " src=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']])) . "\">";
                     }
                 }
             } else {
                 $val = mlang_message("LONG_BINARY");
             }
         } elseif ($this->fieldsArr[$i]['viewFormat'] == FORMAT_DATABASE_FILE) {
             if (!$this->forExport) {
                 if ($this->fieldsArr[$i]['fileName']) {
                     $filename = $value[$this->fieldsArr[$i]['fileName']];
                     if (!$filename) {
                         $filename = "file.bin";
                     }
                 } else {
                     $filename = "file.bin";
                 }
                 if (strlen($value[$this->fieldsArr[$i]['name']])) {
                     $val = "<a href=\"getfile.php?table=" . $this->shortTName . "&filename=" . rawurlencode($filename) . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">";
                     $val .= htmlspecialchars($filename);
                     $val .= "</a>";
                 }
             } else {
                 $val = mlang_message("LONG_BINARY");
             }
         } elseif (($this->fieldsArr[$i]['editFormat'] == EDIT_FORMAT_LOOKUP_WIZARD || $this->fieldsArr[$i]['editFormat'] == EDIT_FORMAT_RADIO) && GetLookupType($this->fieldsArr[$i]['name'], $this->tName) == LT_LOOKUPTABLE) {
             $val = DisplayLookupWizard($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']], $value, $keylink, $this->mode);
         } elseif (NeedEncode($this->fieldsArr[$i]['name'], $this->tName)) {
             $val = ProcessLargeText(GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']), "field=" . rawurlencode($this->fieldsArr[$i]['name']) . $keylink, "", $this->mode);
         } else {
             //$val = GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']);
             if ($this->fieldsArr[$i]['viewFormat'] == FORMAT_CHECKBOX && $this->forExport) {
                 $val = GetData($value, $this->fieldsArr[$i]['name'], FORMAT_NONE);
             } else {
                 $val = GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']);
             }
         }
         $row[$this->fieldsArr[$i]['goodName'] . "_value"] = $val;
     }
     if ($this->repLayout == REPORT_BLOCK) {
         $row[GoodFieldName('nonewgroup')] = true;
     }
     return $row;
 }