当前位置: 首页>>代码示例>>PHP>>正文


PHP misc::money_formats方法代码示例

本文整理汇总了PHP中misc::money_formats方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::money_formats方法的具体用法?PHP misc::money_formats怎么用?PHP misc::money_formats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在misc的用法示例。


在下文中一共展示了misc::money_formats方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderTemplateAreaNoCaption

 public static function renderTemplateAreaNoCaption($templateArea, $listingID)
 {
     // renders all the elements in a given template area on the listing pages
     // this time without the corresponding captions
     global $conn, $config, $lang;
     require_once $config['basepath'] . '/include/misc.inc.php';
     $misc = new misc();
     require_once $config['basepath'] . '/include/login.inc.php';
     $listingID = $misc->make_db_extra_safe($listingID);
     $templateArea = $misc->make_db_extra_safe($templateArea);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption, listingsformelements_display_priv FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsformelements_location = {$templateArea})) ORDER BY listingsformelements_rank ASC";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     $display = '';
     while (!$recordSet->EOF) {
         $field_value = $misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']);
         $field_type = $misc->make_db_unsafe($recordSet->fields['listingsformelements_field_type']);
         $field_caption = $misc->make_db_unsafe($recordSet->fields['listingsformelements_field_caption']);
         $display_priv = $misc->make_db_unsafe($recordSet->fields['listingsformelements_display_priv']);
         $display_status = false;
         if ($display_priv == 1) {
             $display_status = login::loginCheck('Member', true);
         } elseif ($display_priv == 2) {
             $display_status = login::loginCheck('Agent', true);
         } elseif ($display_priv == 3) {
             $display_status = login::loginCheck('Admin', true);
         } else {
             $display_status = true;
         }
         if ($display_status === true) {
             if ($field_value != "") {
                 if ($field_type == "select-multiple" or $field_type == "option" or $field_type == "checkbox") {
                     // handle field types with multiple options
                     $feature_index_list = explode("||", $field_value);
                     sort($feature_index_list);
                     $list_count = count($feature_index_list);
                     $l = 1;
                     foreach ($feature_index_list as $feature_list_item) {
                         if ($l < $list_count) {
                             $display .= $feature_list_item;
                             $display .= $config['feature_list_separator'];
                             $l++;
                         } else {
                             $display .= $feature_list_item;
                         }
                     }
                     // end while
                 } elseif ($field_type == "price") {
                     $money_amount = $misc->international_num_format($field_value, $config['number_decimals_price_fields']);
                     $display .= "<strong>{$field_caption}</strong>: " . $misc->money_formats($money_amount);
                 } elseif ($field_type == "number") {
                     $display .= "<strong>{$field_caption}</strong>: " . $misc->international_num_format($field_value, $config['number_decimals_number_fields']);
                 } elseif ($field_type == "url") {
                     $display .= "<a href=\"{$field_value}\" onclick=\"window.open(this.href,'_blank','location=1,resizable=1,status=1,scrollbars=1,toolbar=1,menubar=1');return false\">{$field_value}</a>";
                 } elseif ($field_type == "email") {
                     $display .= "<a href=\"mailto:{$field_value}\">{$field_value}</a>";
                 } elseif ($field_type == "text" or $field_type == "textarea") {
                     if ($config['add_linefeeds'] === "1") {
                         $field_value = nl2br($field_value);
                         //replace returns with <br />
                     }
                     // end if
                     $display .= "{$field_value}";
                 } elseif ($field_type == "Date") {
                     if ($config['date_format'] == 1) {
                         $format = "m/d/Y";
                     } elseif ($config['date_format'] == 2) {
                         $format = "Y/d/m";
                     } elseif ($config['date_format'] == 3) {
                         $format = "d/m/Y";
                     }
                     $field_value = date($format, $field_value);
                     $display .= "{$field_value}";
                 } else {
                     $display .= "{$field_value}";
                 }
                 // end else
                 $display .= '<br />';
             } else {
                 if ($field_type == "price" && $config["zero_price"] == "1") {
                     $display .= $lang['call_for_price'] . '<br />';
                 }
                 // end if
             }
             // end else
         }
         $recordSet->MoveNext();
     }
     // end while
     return $display;
 }
开发者ID:josegonzalez,项目名称:php-openrealty,代码行数:93,代码来源:listing.inc.php

示例2: misc


//.........这里部分代码省略.........
                         $max = $max->fields['max'];
                         $min = $conn->Execute("select min(listingsdbelements_field_value+0) as min  FROM {$field_list} AND listingsdbelements_field_name = '{$browse_field_name}'" . $class_sql);
                         $min = $min->fields['min'];
                     } else {
                         $max = $conn->Execute("select max(CAST(listingsdbelements_field_value as int4)) as max  FROM {$field_list} AND listingsdbelements_field_name = '{$browse_field_name}'" . $class_sql);
                         $max = $max->fields['max'];
                         $min = $conn->Execute("select min(CAST(listingsdbelements_field_value as int4)) as min  FROM {$field_list} AND listingsdbelements_field_name = '{$browse_field_name}'" . $class_sql);
                         $min = $min->fields['min'];
                         if ($field_type == 'price') {
                             $min = substr_replace($min, '000', -3);
                         }
                     }
                 }
             }
             if ($step == 0) {
                 if ($max > $min) {
                     $step = ceil(($max - $min) / 10);
                 } else {
                     $step = ceil($max / 10);
                 }
             }
             if ($config["search_step_max"] >= '1') {
                 $step_val = ($max - $min) / $config["search_step_max"];
                 if ($step_val > $step) {
                     $step = $step_val;
                 }
             }
             $display .= '<select name="' . $browse_field_name . '-min">' . "\n";
             $options = '<option value="">' . $lang['all'] . '</option>' . "\n";
             if ($field_type == 'price') {
                 $i = $min;
                 while ($i < $max) {
                     $z = $misc->international_num_format($i, $config['number_decimals_price_fields']);
                     $z = $misc->money_formats($z);
                     $selected = '';
                     if (isset($_GET[$browse_field_name . '-min']) && $_GET[$browse_field_name . '-min'] == $i) {
                         $selected = 'selected="selected"';
                     }
                     $options .= '<option value="' . $i . '" ' . $selected . '>' . $z . '</option>';
                     $i += $step;
                 }
                 $z = $misc->international_num_format($max, $config['number_decimals_price_fields']);
                 $z = $misc->money_formats($z);
                 $selected = '';
                 if (isset($_GET[$browse_field_name . '-min']) && $_GET[$browse_field_name . '-min'] == $i) {
                     $selected = 'selected="selected"';
                 }
                 $options .= '<option value="' . $max . '" ' . $selected . '>' . $z . '</option>';
             } else {
                 $i = $min;
                 while ($i < $max) {
                     $selected = '';
                     if (isset($_GET[$browse_field_name . '-min']) && $_GET[$browse_field_name . '-min'] == $i) {
                         $selected = 'selected="selected"';
                     }
                     $options .= '<option ' . $selected . '>' . $i . '</option>';
                     $i += $step;
                 }
                 $selected = '';
                 if (isset($_GET[$browse_field_name . '-min']) && $_GET[$browse_field_name . '-min'] == $max) {
                     $selected = 'selected="selected"';
                 }
                 $options .= '<option ' . $selected . '>' . $max . '</option>';
             }
             $options .= '</select>';
             $display .= $options . ' ' . $lang['to'] . '<br />';
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:67,代码来源:search.inc.php

示例3: renderSingleListingItem

 function renderSingleListingItem($userID, $name, $display_type = 'both')
 {
     // Display_type - Sets what should be returned.
     // both - Displays both the caption and the formated value
     // value - Displays just the formated value
     // rawvalue - Displays just the raw value
     // caption - Displays only the captions
     global $conn, $config;
     require_once $config['basepath'] . '/include/misc.inc.php';
     $misc = new misc();
     $display = '';
     $formDB = user::determine_user_formtype($userID);
     $userID = $misc->make_db_safe($userID);
     $name = $misc->make_db_safe($name);
     $sql = "SELECT userdbelements_field_value, " . $formDB . "_id, " . $formDB . "_field_type,\n\t\t\t" . $formDB . "_field_caption FROM " . $config['table_prefix'] . "userdbelements, " . $config['table_prefix'] . $formDB . " WHERE ((userdb_id = {$userID}) AND\n\t\t\t(" . $formDB . "_field_name = userdbelements_field_name) AND (userdbelements_field_name = {$name}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $field_value = $misc->make_db_unsafe($recordSet->fields['userdbelements_field_value']);
         $field_type = $misc->make_db_unsafe($recordSet->fields[$formDB . '_field_type']);
         $form_elements_id = $misc->make_db_unsafe($recordSet->fields[$formDB . '_id']);
         if (!isset($_SESSION["users_lang"])) {
             // Hold empty string for translation fields, as we are workgin with teh default lang
             $field_caption = $misc->make_db_unsafe($recordSet->fields[$formDB . '_field_caption']);
         } else {
             $lang_sql = "SELECT " . $formDB . "_field_caption FROM " . $config['lang_table_prefix'] . $formDB . " WHERE " . $formDB . "_id = {$form_elements_id}";
             $lang_recordSet = $conn->Execute($lang_sql);
             if ($lang_recordSet === false) {
                 $misc->log_error($lang_sql);
             }
             $field_caption = $misc->make_db_unsafe($lang_recordSet->fields[$formDB . '_field_caption']);
         }
         if ($field_value != "") {
             if ($display_type === 'both' || $display_type === 'caption') {
                 $display .= '<span class="field_caption">' . $field_caption . '</span>';
             }
             if ($display_type == 'both') {
                 $display .= ':&nbsp;';
             }
             if ($display_type === 'both' || $display_type === 'value') {
                 if ($field_type == "select-multiple" or $field_type == "option" or $field_type == "checkbox") {
                     // handle field types with multiple options
                     // $display .= "<br /><b>$field_caption</b>";
                     $feature_index_list = explode("||", $field_value);
                     sort($feature_index_list);
                     foreach ($feature_index_list as $feature_list_item) {
                         $display .= "<br />{$feature_list_item}";
                     }
                     // end while
                 } elseif ($field_type == "price") {
                     $money_amount = $misc->international_num_format($field_value, $config['number_decimals_price_fields']);
                     $display .= $misc->money_formats($money_amount);
                 } elseif ($field_type == "number") {
                     $display .= $misc->international_num_format($field_value, $config['number_decimals_number_fields']);
                 } elseif ($field_type == "url") {
                     $display .= "<a href=\"{$field_value}\" onclick=\"window.open(this.href,'_blank','location=1,resizable=1,status=1,scrollbars=1,toolbar=1,menubar=1');return false\">{$field_value}</a>";
                 } elseif ($field_type == "email") {
                     $display .= "<a href=\"mailto:{$field_value}\">{$field_value}</a>";
                 } elseif ($field_type == "text" or $field_type == "textarea") {
                     if ($config['add_linefeeds'] === "1") {
                         $field_value = nl2br($field_value);
                         //replace returns with <br />
                     }
                     // end if
                     $display .= $field_value;
                 } elseif ($field_type == "date") {
                     if ($config['date_format'] == 1) {
                         $format = "m/d/Y";
                     } elseif ($config['date_format'] == 2) {
                         $format = "Y/d/m";
                     } elseif ($config['date_format'] == 3) {
                         $format = "d/m/Y";
                     }
                     $field_value = date($format, "{$field_value}");
                     $display .= $field_value;
                 } else {
                     $display .= $field_value;
                 }
                 // end else
             }
             if ($display_type === 'rawvalue') {
                 $display .= $field_value;
             }
         }
         // end if ($field_value != "")
         $recordSet->MoveNext();
     }
     // end while
     return $display;
 }
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:92,代码来源:user.inc.php

示例4: init_map2


//.........这里部分代码省略.........
        $count = 0;
        // Loop through the entire set of properties found
        while (!$recordSet->EOF()) {
            $pid = $misc->make_db_unsafe($recordSet->fields['listingsdb_id']);
            // If the current property is the current listing, handle it separately
            // in order to center map on it.
            if ($pid == $listingID) {
                // Get the listing's thumbnail image.
                $irec = $conn->Execute("SELECT listingsimages_thumb_file_name FROM " . $config['table_prefix'] . "listingsimages WHERE listingsdb_id = {$pid} AND listingsimages_rank = 1");
                $fn = $misc->make_db_unsafe($irec->fields['listingsimages_thumb_file_name']);
                $ilink = $config['baseurl'] . "/images/listing_photos/" . $fn;
                // Gather the listing elements fields that will be used to generate
                // the html for the pop-up bubble
                $pinfo = $conn->Execute("SELECT listingsdbelements_field_name, listingsdbelements_field_value FROM " . $config['table_prefix'] . "listingsdbelements WHERE listingsdbelements_field_name IN ('address','city','state','zip','price') AND listingsdb_id = {$pid}");
                // Take the field information from the result set.
                // This is kind of kludgy - need to try to find either a better way
                //  of doing this, or use individual db calls to get fields.
                // Need to determine whether db calls are faster than php.
                while (!$pinfo->EOF()) {
                    switch ($pinfo->fields['listingsdbelements_field_name']) {
                        case 'address':
                            $address = $misc->make_db_unsafe($pinfo->fields['listingsdbelements_field_value']);
                            break;
                        case 'city':
                            $city = $misc->make_db_unsafe($pinfo->fields['listingsdbelements_field_value']);
                            break;
                        case 'state':
                            $state = $misc->make_db_unsafe($pinfo->fields['listingsdbelements_field_value']);
                            break;
                        case 'zip':
                            $zip = $misc->make_db_unsafe($pinfo->fields['listingsdbelements_field_value']);
                            break;
                        case 'price':
                            $price = $misc->money_formats($misc->international_num_format($misc->make_db_unsafe($pinfo->fields['listingsdbelements_field_value']), $config['number_decimals_price_fields']));
                            break;
                    }
                    // switch
                    $pinfo->MoveNext();
                }
                // while
                // Grab the listing title for the pop-up bubble
                $pinfo2 = $conn->Execute("SELECT listingsdb_title FROM " . $config['table_prefix'] . "listingsdb WHERE listingsdb_id = {$pid}");
                $title = $misc->make_db_unsafe($pinfo2->fields['listingsdb_title']);
                // Generate the html for the Google Map pop-up information bubble for this property.
                // *** Change this to code that pulls the html from a template file. ***
                $link = '<a href="' . $config['baseurl'] . '/index.php?action=listingview&listingID=' . $pid . '">';
                $gmhtml = "'" . '<table><tr><td align="center"><b>' . $link . $title . ' </a></b></td></tr><tr><td>';
                $gmhtml .= $link . '<img src="' . $ilink . '" altd="no image"></img></a>';
                $gmhtml .= '</td><td><b>Listing Price: ' . $price . '<br><br>Property Address:</b><br>' . $address . '<br>' . $city . ', ' . $state . ' ' . $zip . '</td></tr></table>' . "'";
                // Save the coordinates and html for the center point on the map
                $centerpoint['latitude'] = $latitude;
                $centerpoint['longitude'] = $longitude;
                $centerpoint['html'] = $gmhtml;
            } else {
                // Get the coordinates of this data point
                $py = $misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']);
                $prec = $conn->Execute("SELECT * FROM " . $config['table_prefix'] . "listingsdbelements WHERE listingsdbelements_field_name = 'longitude' AND listingsdb_id = {$pid}");
                $px = $misc->make_db_unsafe($prec->fields['listingsdbelements_field_value']);
                // Add this property if its longitude is less than the search distance from
                //  the current listing's.
                if (abs($px - $longitude) < $long_dist) {
                    // Get the listing's thumbnail image.
                    $irec = $conn->Execute("SELECT listingsimages_thumb_file_name FROM " . $config['table_prefix'] . "listingsimages WHERE listingsdb_id = {$pid} AND listingsimages_rank = 1");
                    $fn = $misc->make_db_unsafe($irec->fields['listingsimages_thumb_file_name']);
                    $ilink = $config['baseurl'] . "/images/listing_photos/" . $fn;
                    // Gather the listing elements fields that will be used to generate
开发者ID:schappaughc,项目名称:iitmapas,代码行数:67,代码来源:addon.inc.php


注:本文中的misc::money_formats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。