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


PHP number_pad函数代码示例

本文整理汇总了PHP中number_pad函数的典型用法代码示例。如果您正苦于以下问题:PHP number_pad函数的具体用法?PHP number_pad怎么用?PHP number_pad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_item_kits_barcode_data

function get_item_kits_barcode_data($item_kits_ids)
{
    $CI =& get_instance();
    $result = array();
    $item_kit_ids = explode('~', $item_kits_ids);
    foreach ($item_kit_ids as $item_kit_id) {
        $item_kit_info = $CI->Item_kit->get_info($item_kit_id);
        $item_kit_location_info = $CI->Item_kit_location->get_info($item_kit_id);
        $item_kit_price = $item_kit_location_info->unit_price ? $item_kit_location_info->unit_price : $item_kit_info->unit_price;
        if ($CI->config->item('barcode_price_include_tax')) {
            if ($item_kit_info->tax_included) {
                $result[] = array('name' => to_currency($item_kit_price) . ' ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
            } else {
                $result[] = array('name' => to_currency(get_price_for_item_kit_including_taxes($item_kit_id, $item_kit_price)) . ': ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
            }
        } else {
            if ($item_kit_info->tax_included) {
                $result[] = array('name' => to_currency(get_price_for_item_kit_excluding_taxes($item_kit_id, $item_kit_price)) . ': ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
            } else {
                $result[] = array('name' => to_currency($item_kit_price) . ': ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
            }
        }
    }
    return $result;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:25,代码来源:item_kits_helper.php

示例2: get_items_barcode_data

function get_items_barcode_data($item_ids)
{
    $CI =& get_instance();
    $result = array();
    $item_ids = explode('~', $item_ids);
    foreach ($item_ids as $item_id) {
        $item_info = $CI->Item->get_info($item_id);
        $item_location_info = $CI->Item_location->get_info($item_id);
        $today = strtotime(date('Y-m-d'));
        $is_item_location_promo = $item_location_info->start_date !== NULL && $item_location_info->end_date !== NULL && (strtotime($item_location_info->start_date) <= $today && strtotime($item_location_info->end_date) >= $today);
        $is_item_promo = $item_info->start_date !== NULL && $item_info->end_date !== NULL && (strtotime($item_info->start_date) <= $today && strtotime($item_info->end_date) >= $today);
        $regular_item_price = $item_location_info->unit_price ? $item_location_info->unit_price : $item_info->unit_price;
        if ($is_item_location_promo) {
            $item_price = $item_location_info->promo_price;
        } elseif ($is_item_promo) {
            $item_price = $item_info->promo_price;
        } else {
            $item_price = $item_location_info->unit_price ? $item_location_info->unit_price : $item_info->unit_price;
        }
        if ($CI->config->item('barcode_price_include_tax')) {
            if ($item_info->tax_included) {
                $result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency($regular_item_price) . '</span> ' : ' ') . to_currency($item_price) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
            } else {
                $result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency(get_price_for_item_including_taxes($item_id, $regular_item_price)) . '</span> ' : ' ') . to_currency(get_price_for_item_including_taxes($item_id, $item_price)) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
            }
        } else {
            if ($item_info->tax_included) {
                $result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency(get_price_for_item_excluding_taxes($item_id, $regular_item_price)) . '</span> ' : ' ') . to_currency(get_price_for_item_excluding_taxes($item_id, $item_price)) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
            } else {
                $result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency($regular_item_price) . '</span> ' : ' ') . to_currency($item_price) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
            }
        }
    }
    return $result;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:35,代码来源:items_helper.php

示例3: process_medal

function process_medal($row)
{
    $materials = array_filter(explode('|', $row['material']));
    $manufactures = array_filter(explode('|', $row['manufacture']));
    $manufacture_array = array();
    $material_array = array();
    if (count($manufactures) > 0) {
        foreach ($manufactures as $manufacture) {
            $manufacture_array[] = normalize_manufacture(trim($manufacture));
        }
    }
    if (count($materials) > 0) {
        foreach ($materials as $material) {
            $material_array[] = normalize_material(trim($material));
        }
    }
    if (is_numeric(trim($row['measurements']))) {
        $diameter = trim($row['measurements']);
    } else {
        $diameter = '';
    }
    return array('material' => implode('|', $material_array), 'manufacture' => implode('|', $manufacture_array), 'diameter' => number_pad($diameter, 4));
}
开发者ID:AmericanNumismaticSociety,项目名称:migration_scripts,代码行数:23,代码来源:variants.php

示例4: render


//.........这里部分代码省略.........
     if (strlen($device_uuid) > 0) {
         $sql = "SELECT * FROM v_device_settings ";
         $sql .= "WHERE device_uuid = '" . $device_uuid . "' ";
         $sql .= "AND device_setting_enabled = 'true' ";
         $prep_statement = $this->db->prepare(check_sql($sql));
         $prep_statement->execute();
         $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
         $result_count = count($result);
         foreach ($result as $row) {
             $key = $row['device_setting_subcategory'];
             $value = $row['device_setting_value'];
             $provision[$key] = $value;
         }
         unset($prep_statement);
     }
     //initialize a template object
     $view = new template();
     if (strlen($_SESSION['provision']['template_engine']['text']) > 0) {
         $view->engine = $_SESSION['provision']['template_engine']['text'];
         //raintpl, smarty, twig
     } else {
         $view->engine = "smarty";
     }
     $view->template_dir = $template_dir . "/" . $device_template . "/";
     $view->cache_dir = $_SESSION['server']['temp']['dir'];
     $view->init();
     //replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
     //get the time zone
     $time_zone_name = $_SESSION['domain']['time_zone']['name'];
     if (strlen($time_zone_name) > 0) {
         $time_zone_offset_raw = get_time_zone_offset($time_zone_name) / 3600;
         $time_zone_offset_hours = floor($time_zone_offset_raw);
         $time_zone_offset_minutes = ($time_zone_offset_raw - $time_zone_offset_hours) * 60;
         $time_zone_offset_minutes = number_pad($time_zone_offset_minutes, 2);
         if ($time_zone_offset_raw > 0) {
             $time_zone_offset_hours = number_pad($time_zone_offset_hours, 2);
             $time_zone_offset_hours = "+" . $time_zone_offset_hours;
         } else {
             $time_zone_offset_hours = str_replace("-", "", $time_zone_offset_hours);
             $time_zone_offset_hours = "-" . number_pad($time_zone_offset_hours, 2);
         }
         $time_zone_offset = $time_zone_offset_hours . ":" . $time_zone_offset_minutes;
         $view->assign("time_zone_offset", $time_zone_offset);
     }
     //create a mac address with back slashes for backwards compatability
     $mac_dash = substr($mac, 0, 2) . '-' . substr($mac, 2, 2) . '-' . substr($mac, 4, 2) . '-' . substr($mac, 6, 2) . '-' . substr($mac, 8, 2) . '-' . substr($mac, 10, 2);
     //get the contacts array and add to the template engine
     if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory']['boolean'] == "true") {
         //get contacts from the database
         $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
         $sql .= "from v_contacts as c, v_contact_phones as p ";
         $sql .= "where c.domain_uuid = '" . $domain_uuid . "' ";
         $sql .= "and c.contact_uuid = p.contact_uuid ";
         $sql .= "and p.phone_type_voice = '1' ";
         $sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc ";
         $prep_statement = $this->db->prepare(check_sql($sql));
         $prep_statement->execute();
         $contacts = $prep_statement->fetchAll(PDO::FETCH_NAMED);
         unset($prep_statement, $sql);
         //assign the contacts array
         $view->assign("contacts", $contacts);
     }
     //get the provisioning information from device lines table
     if (strlen($device_uuid) > 0) {
         //get the device lines array
         $sql = "select * from v_device_lines ";
开发者ID:reliberate,项目名称:fusionpbx,代码行数:67,代码来源:provision.php

示例5: foreach

 echo "\t<br />";
 echo "</div>";
 if ($action == 'update' && is_array($current_presets) && $current_presets[$preset_number] != '') {
     //add (potentially customized) preset conditions and populate
     foreach ($current_conditions[$preset_group_id] as $cond_var => $cond_val) {
         $range_indicator = $cond_var == 'date-time' ? '~' : '-';
         $tmp = explode($range_indicator, $cond_val);
         $cond_val_start = $tmp[0];
         $cond_val_stop = $tmp[1];
         unset($tmp);
         //convert minute-of-day to time-of-day values
         if ($cond_var == 'minute-of-day') {
             $cond_var = 'time-of-day';
             $cond_val_start = number_pad(floor($cond_val_start / 60), 2) . ":" . number_pad(fmod($cond_val_start, 60), 2);
             if ($cond_val_stop != '') {
                 $cond_val_stop = number_pad(floor($cond_val_stop / 60), 2) . ":" . number_pad(fmod($cond_val_stop, 60), 2);
             }
         }
         echo "<script>\n";
         echo "\tcondition_id = add_condition(" . $preset_group_id . ",'preset');\n";
         echo "\t\$('#variable_" . $preset_group_id . "_' + condition_id + ' option[value=\"" . $cond_var . "\"]').prop('selected', true);\n";
         if ($cond_var == 'date-time') {
             echo "\tchange_to_input(document.getElementById('value_" . $preset_group_id . "_' + condition_id + '_start'));\n";
             echo "\tchange_to_input(document.getElementById('value_" . $preset_group_id . "_' + condition_id + '_stop'));\n";
             echo "\t\$('#value_" . $preset_group_id . "_' + condition_id + '_start').val('" . $cond_val_start . "');\n";
             echo "\t\$('#value_" . $preset_group_id . "_' + condition_id + '_stop').val('" . $cond_val_stop . "');\n";
         } else {
             echo "\tload_value_fields(" . $preset_group_id . ", condition_id, '" . $cond_var . "');\n";
             echo "\t\$('#value_" . $preset_group_id . "_' + condition_id + '_start option[value=\"" . $cond_val_start . "\"]').prop('selected', true);\n";
             echo "\t\$('#value_" . $preset_group_id . "_' + condition_id + '_stop option[value=\"" . $cond_val_stop . "\"]').prop('selected', true);\n";
         }
开发者ID:reliberate,项目名称:fusionpbx,代码行数:31,代码来源:time_condition_edit.php

示例6: number

<div class="error">The following judging number(s) have already been assigned to entries. Please use another judging number for each.<br /><?php 
    echo rtrim($jnum_info, "<br>");
    ?>
</div>
<?php 
}
if (!empty($flag_enum)) {
    // Build list of already used numbers and the entry number that it was associated with at scan
    $enum_info = "";
    foreach ($flag_enum as $num) {
        if ($num != "") {
            $num = explode("*", $num);
            if (NHC && $prefix == "final_") {
                $enum_info .= "<li>Entry " . number_pad($num[1], 6) . " has already been assigned judging number " . $num[0] . "</li>";
            } else {
                $enum_info .= "<li>Entry " . number_pad($num[1], 4) . " has already been assigned judging number " . $num[0] . "</li>";
            }
        }
    }
    ?>
<div class="error">The following entries already have 6 digit judging numbers assigned to them - the original 6 digit judging number has been kept. <ul style="font-size: .9em; font-weight:normal; "><?php 
    echo $enum_info;
    ?>
</ul>If any of the above are incorrect, you can update its judging number via the <a href="<?php 
    $base_url;
    ?>
index.php?section=admin&amp;go=entries">Administration: Entries</a> list.</div>
<?php 
}
?>
<h2>Check-In Entries with a Barcode Reader/Scanner</h2>
开发者ID:dducrest,项目名称:brewcompetitiononlineentry,代码行数:31,代码来源:barcode_check-in.admin.php

示例7: get_time_zone_offset

            if ($x > 0) {
                echo "\t\t</optgroup>\n";
            }
            echo "\t\t<optgroup label='" . $category . "'>\n";
        }
        if (strlen($val) > 0) {
            $time_zone_offset = get_time_zone_offset($val) / 3600;
            $time_zone_offset_hours = floor($time_zone_offset);
            $time_zone_offset_minutes = ($time_zone_offset - $time_zone_offset_hours) * 60;
            $time_zone_offset_minutes = number_pad($time_zone_offset_minutes, 2);
            if ($time_zone_offset > 0) {
                $time_zone_offset_hours = number_pad($time_zone_offset_hours, 2);
                $time_zone_offset_hours = "+" . $time_zone_offset_hours;
            } else {
                $time_zone_offset_hours = str_replace("-", "", $time_zone_offset_hours);
                $time_zone_offset_hours = "-" . number_pad($time_zone_offset_hours, 2);
            }
        }
        if ($val == $default_setting_value) {
            echo "\t\t\t<option value='" . $val . "' selected='selected'>(UTC " . $time_zone_offset_hours . ":" . $time_zone_offset_minutes . ") " . $val . "</option>\n";
        } else {
            echo "\t\t\t<option value='" . $val . "'>(UTC " . $time_zone_offset_hours . ":" . $time_zone_offset_minutes . ") " . $val . "</option>\n";
        }
        $previous_category = $category;
        $x++;
    }
    echo "\t\t</select>\n";
} elseif ($subcategory == 'password' || substr_count($subcategory, '_password') > 0 || $category == "login" && $subcategory == "password_reset_key" && $name == "text") {
    echo "\t<input class='formfld' type='password' name='default_setting_value' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!\$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' value=\"" . $default_setting_value . "\">\n";
} elseif ($category == "theme" && $subcategory == "background_color" && $name == "array" || $category == "theme" && $subcategory == "login_shadow_color" && $name == "text" || $category == "theme" && $subcategory == "login_background_color" && $name == "text" || $category == "theme" && $subcategory == "domain_color" && $name == "text" || $category == "theme" && $subcategory == "domain_shadow_color" && $name == "text" || $category == "theme" && $subcategory == "domain_background_color" && $name == "text" || $category == "theme" && $subcategory == "footer_color" && $name == "text" || $category == "theme" && $subcategory == "footer_background_color" && $name == "text" || $category == "theme" && $subcategory == "message_default_background_color" && $name == "text" || $category == "theme" && $subcategory == "message_default_color" && $name == "text" || $category == "theme" && $subcategory == "message_negative_background_color" && $name == "text" || $category == "theme" && $subcategory == "message_negative_color" && $name == "text" || $category == "theme" && $subcategory == "message_alert_background_color" && $name == "text" || $category == "theme" && $subcategory == "message_alert_color" && $name == "text") {
    echo "\t<style>";
开发者ID:reliberate,项目名称:fusionpbx,代码行数:31,代码来源:default_setting_edit.php

示例8: elseif

                    } elseif ($_POST['eid' . $id] >= 10000 && $_POST['eid' . $id] <= 99999) {
                        $eid = ltrim($_POST['eid' . $id], "0");
                    } else {
                        $eid = $_POST['eid' . $id];
                    }
                    $entries_updated[] = number_pad($_POST['eid' . $id], 6);
                } else {
                    if ($_POST['eid' . $id] < 9) {
                        $eid = ltrim($_POST['eid' . $id], "000");
                    } elseif ($_POST['eid' . $id] >= 10 && $_POST['eid' . $id] <= 99) {
                        $eid = ltrim($_POST['eid' . $id], "00");
                    } elseif ($_POST['eid' . $id] >= 100 && $_POST['eid' . $id] <= 999) {
                        $eid = ltrim($_POST['eid' . $id], "0");
                    } else {
                        $eid = $_POST['eid' . $id];
                    }
                    $entries_updated[] = number_pad($_POST['eid' . $id], 4);
                }
                if ($_POST['brewPaid' . $id] == 1) {
                    $brewPaid = 1;
                } else {
                    $brewPaid = $row_enum['brewPaid'];
                }
                $updateSQL = sprintf("UPDATE %s SET brewReceived='1', brewJudgingNumber='%s', brewBoxNum='%s', brewPaid='%s' WHERE id='%s';", $brewing_db_table, $judging_number, $_POST['box' . $id], $brewPaid, $eid);
                $result = mysql_query($updateSQL, $brewing) or die(mysql_error());
                //echo $updateSQL."<br>";
            }
        }
    }
    $entry_list .= display_array_content($entries_updated, 2);
}
开发者ID:dducrest,项目名称:brewcompetitiononlineentry,代码行数:31,代码来源:process_barcode_check_in.inc.php

示例9: strtoupper

 $nopesananrasmi = strtoupper(mysql_real_escape_string($_POST['nopesananrasmi']));
 $tempohjaminan = strtoupper(mysql_real_escape_string($_POST['tempohjaminan']));
 $pembekal = mysql_real_escape_string($_POST['pembekal']);
 $catID = explode("-", $kategori);
 $kategoriID = $catID[0];
 $kategoriKod = $catID[1];
 $catSubID = explode("-", $subkategori);
 $kategoriSubID = $catSubID[0];
 $kategoriSubKod = $catSubID[1];
 $jnsID = explode("-", $jenis);
 $jenisID = $jnsID[0];
 $jenisKod = $jnsID[1];
 $year4digit = date("Y");
 $year2digit = date("y");
 $number = $db->get_counter_barcode($year4digit);
 $generateIncrement = number_pad($number, 4);
 //KK = Kod Kementerian
 //BKP10 = Kod Bahagian
 //H/I = H - Harta Modal  I - Harta Inventori
 //07 = Tahun perolehan aset
 //0001 = Bil atau nombor siri aset
 //001002003 = kod klasifikasi (kategori+sub kategori+jenis)
 //DB|SB|LH|HD = Kaedah Perolehan
 //$nosiripendaftaran = "KK/BKP10/H/07/0001/001002003/HD";
 $nosiripendaftaran = "KK/BKP10/H/{$year2digit}/{$generateIncrement}/{$kategoriKod}{$kategoriSubKod}{$jenisKod}/{$kaedahperolehan}";
 //echo '<br/>'.print_r($_POST);
 $tarikhterimaFormat = changeDateBeginYear($tarikhterima);
 $updateHartaModal = "UPDATE  hartamodal set kaedah_peroleh='{$kaedahperolehan}', no_siri_daftar='{$nosiripendaftaran}', kementerian='{$kementerian}',\r\n\t\t\t\t\t\t\t\tbahagian='{$bahagian}',kod_nasional='{$kodnasional}',kategori_id='{$kategoriID}',sub_kategori_id='{$kategoriSubID}',jenis_id='{$jenisID}',\r\n\t\t\t\t\t\t\t\tbuatan='{$buatan}',jenis_no_enjin='{$jenisnoenjin}',no_casis='{$siripembuat}',no_pendaftaran='{$nodaftarkenderaan}',komponen='{$komponen}',\r\n\t\t\t\t\t\t\t\tharga_perolehan_asal='{$hargaasal}',tarikh_terima='{$tarikhterimaFormat}',no_pesanan='{$nopesananrasmi}',\ttempoh_jaminan='{$tempohjaminan}',\t\t\t\t\r\n\t\t\t\t\t\t\t\tpembekal_id='{$pembekal}' where id='{$IdHartaModal}' ";
 $result = $db->sql_query($updateHartaModal);
 if ($result) {
     //	Display success
开发者ID:JhunCabas,项目名称:school-asset-mgmt,代码行数:31,代码来源:pHartamodalKemaskini.php

示例10: get_date

function get_date($startdate, $enddate)
{
    global $warnings;
    $node = '';
    $start_gYear = '';
    $end_gYear = '';
    //validate dates
    if ($startdate != 0 && is_int($startdate) && $startdate < 3000) {
        $start_gYear = number_pad($startdate, 4);
    }
    if ($enddate != 0 && is_int($enddate) && $enddate < 3000) {
        $end_gYear = number_pad($enddate, 4);
    }
    if ($startdate == 0 && $enddate != 0) {
        $node = '<date' . (strlen($end_gYear) > 0 ? ' standardDate="' . $end_gYear . '"' : '') . '>' . get_date_textual($enddate) . '</date>';
    } elseif ($startdate != 0 && $enddate == 0) {
        $node = '<date' . (strlen($start_gYear) > 0 ? ' standardDate="' . $start_gYear . '"' : '') . '>' . get_date_textual($startdate) . '</date>';
    } elseif ($startdate == $enddate) {
        $node = '<date' . (strlen($end_gYear) > 0 ? ' standardDate="' . $end_gYear . '"' : '') . '>' . get_date_textual($enddate) . '</date>';
    } elseif ($startdate != 0 && $enddate != 0) {
        $node = '<dateRange><fromDate' . (strlen($start_gYear) > 0 ? ' standardDate="' . $start_gYear . '"' : '') . '>' . get_date_textual($startdate) . '</fromDate><toDate' . (strlen($start_gYear) > 0 ? ' standardDate="' . $end_gYear . '"' : '') . '>' . get_date_textual($enddate) . '</toDate></dateRange>';
    }
    return $node;
}
开发者ID:AmericanNumismaticSociety,项目名称:migration_scripts,代码行数:24,代码来源:fm-to-nuds.php

示例11: generate_nuds


//.........这里部分代码省略.........
            foreach ($vals as $val) {
                if (substr($val, -1) == '?') {
                    $uri = 'http://nomisma.org/id/' . substr($val, 0, -1);
                    $uncertainty = true;
                    $content = processUri($uri);
                } else {
                    $uri = 'http://nomisma.org/id/' . $val;
                    $uncertainty = false;
                    $content = processUri($uri);
                }
                $doc->startElement($content['element']);
                $doc->writeAttribute('xlink:type', 'simple');
                $doc->writeAttribute('xlink:href', $uri);
                $doc->text($content['label']);
                $doc->endElement();
            }
        }
        if (strlen($row['Denomination']) > 0) {
            $vals = explode('|', $row['Denomination']);
            foreach ($vals as $val) {
                $uri = 'http://nomisma.org/id/' . $val;
                $uncertainty = false;
                $content = processUri($uri);
                $doc->startElement($content['element']);
                $doc->writeAttribute('xlink:type', 'simple');
                $doc->writeAttribute('xlink:href', $uri);
                $doc->text($content['label']);
                $doc->endElement();
            }
        }
        if (is_numeric($row['From Date']) && is_numeric($row['To Date'])) {
            if ($row['From Date'] == $row['To Date']) {
                $doc->startElement('date');
                $doc->writeAttribute('standardDate', number_pad($row['From Date'], 4));
                $doc->text(abs(intval($row['From Date'])) . ' B.C.');
                $doc->endElement();
            } else {
                $doc->startElement('dateRange');
                $doc->startElement('fromDate');
                $doc->writeAttribute('standardDate', number_pad($row['From Date'], 4));
                $doc->text(abs(intval($row['From Date'])) . ' B.C.');
                $doc->endElement();
                $doc->startElement('toDate');
                $doc->writeAttribute('standardDate', number_pad($row['To Date'], 4));
                $doc->text(abs(intval($row['To Date'])) . ' B.C.');
                $doc->endElement();
                $doc->endElement();
            }
        }
        //authority
        if (strlen($row['Authority']) > 0 || strlen($row['Stated authority']) > 0 || strlen($row['Magistrate ID 1']) > 0 || strlen($row['Magistrate ID 2']) > 0) {
            $doc->startElement('authority');
            if (strlen($row['Authority']) > 0) {
                $vals = explode('|', $row['Authority']);
                foreach ($vals as $val) {
                    $uri = 'http://nomisma.org/id/' . $val;
                    $uncertainty = false;
                    $content = processUri($uri);
                    $role = 'authority';
                    $doc->startElement($content['element']);
                    $doc->writeAttribute('xlink:type', 'simple');
                    $doc->writeAttribute('xlink:role', $role);
                    $doc->writeAttribute('xlink:href', $uri);
                    if ($uncertainty == true) {
                        $doc->writeAttribute('certainty', 'uncertain');
                    }
开发者ID:AmericanNumismaticSociety,项目名称:migration_scripts,代码行数:67,代码来源:csv-to-nuds.php

示例12: trim

            if (strlen(trim($row['dynasty'])) > 0) {
                $writer->startElement('org:organization');
                $writer->writeAttribute('rdf:resource', trim($row['dynasty']));
                $writer->endElement();
            }
            //dates
            if (is_numeric($row['fromDate2'])) {
                $writer->startElement('nmo:hasStartDate');
                $writer->writeAttribute('rdf:datatype', 'http://www.w3.org/2001/XMLSchema#gYear');
                $writer->text(number_pad(trim($row['fromDate2']), 4));
                $writer->endElement();
            }
            if (is_numeric($row['toDate2'])) {
                $writer->startElement('nmo:hasEndDate');
                $writer->writeAttribute('rdf:datatype', 'http://www.w3.org/2001/XMLSchema#gYear');
                $writer->text(number_pad(trim($row['toDate2']), 4));
                $writer->endElement();
            }
            $writer->endElement();
        }
        $writer->endElement();
        $writer->endDocument();
        $writer->flush();
        echo "Wrote {$row['nomisma_id']}\n";
    }
}
//create list of ids
/*$list = '';
foreach ($data as $row){
	if (strlen(trim($row['nomisma_id'])) > 0){
		$list .= "{$row['nomisma_id']}\n";
开发者ID:AmericanNumismaticSociety,项目名称:migration_scripts,代码行数:31,代码来源:generate-person-ids.php

示例13: generate_json

$usf = generate_json('coins.csv', true);
$data = generate_json('ric_severan.csv', false);
$deityMatchArray = get_deity_array();
$csv = "Nomisma.org id,Emperor/Authority,Authority URI,Mint,Mint URI,Online Example,Group,Obverse Type,Obverse Legend,Obverse notes,Reverse Type,Reverse Legend,Reverse notes,From Date,To Date,Denomination,Denomination URI,Material,Material URI,Obverse Portrait,Obverse Portrait URI,Reverse Portrait,Reverse Portrait URI,Obverse Deity,Reverse Deity,Issuer,Magistrate,Region,Region URI,Locality,Locality uri,New Region,New Region URI,Object Type URI,Source\n";
foreach ($data as $row) {
    $id = $row['Nomisma.org id'];
    $auth_uri = $row['Nomisma URI for Authority'];
    $array = $usf[$id];
    $fromDate = '';
    $toDate = '';
    $dates = explode('-', $array['sdate']);
    if (strlen($dates[0]) > 0) {
        $fromDate = number_pad($dates[0], 4);
    }
    if (strlen($dates[1]) > 0) {
        $toDate = number_pad($dates[1], 4);
    }
    //get mint uri
    switch ($row['Mint']) {
        case 'Rome':
            $mint_uri = 'http://nomisma.org/id/rome';
            $region_uri = 'http://nomisma.org/id/latium';
            break;
        case 'Alexandria':
            $mint_uri = 'http://nomisma.org/id/alexandreia_egypt';
            $region_uri = 'http://nomisma.org/id/egypt';
            break;
        case 'Emesa':
            $mint_uri = 'http://nomisma.org/id/emisa';
            $region_uri = 'http://nomisma.org/id/syria';
            break;
开发者ID:AmericanNumismaticSociety,项目名称:migration_scripts,代码行数:31,代码来源:csv-to-nm.php

示例14: mysql_db_query

 if ($vars_code && $vars_file) {
     $db_query = mysql_db_query($_MYSQL_BDE, 'SELECT * FROM code_sourcecode WHERE id=' . $vars_code, $db_connect);
     $db_count = mysql_num_rows($db_query);
     if ($db_count != 0) {
         $vars_users = mysql_result($db_query, 0, 'strUser');
         if ($vars_users) {
             $db_querb = @mysql_db_query($_MYSQL_BDE, "SELECT username FROM kod_members WHERE id='{$vars_users}'", $db_connect);
             $db_counb = @mysql_num_rows($db_querb);
             $vars_users = NULL;
             if ($db_counb) {
                 $vars_users = mysql_result($db_querb, 0, 'username');
                 mysql_free_result($db_querb);
             }
         }
         if ($vars_file != -1) {
             $vars_temps = URL_REPS . strtolower($vars_users) . '_sourcepb_' . number_pad(mysql_result($db_query, 0, 'id'), 5) . '.zip';
             $vars_array = unzip($vars_temps, $vars_file);
             if ($vars_array[0] && $vars_array[1]) {
                 header('Content-Description: File Transfer');
                 header('Content-Tranfer-Encoding: none');
                 header('Content-Length: ' . $vars_array[2]);
                 header('Content-Type: application/force-download; name="' . basename(setSpecialChar($vars_array[0])) . '"');
                 header('Content-Disposition: attachment; filename="' . basename(setSpecialChar($vars_array[0])) . '"');
                 echo $vars_array[1];
             }
             mysql_free_result($db_query);
             exit;
         } else {
             $vars_temps = mysql_result($db_query, 0, 'strName');
             header('Content-Description: File Transfer');
             header('Content-Tranfer-Encoding: none');
开发者ID:rkild511,项目名称:pb-source-repositery,代码行数:31,代码来源:thothbox.php


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