本文整理汇总了PHP中dol_string_unaccent函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_string_unaccent函数的具体用法?PHP dol_string_unaccent怎么用?PHP dol_string_unaccent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_string_unaccent函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw_jflot
/**
* Build a graph onto disk using JFlot library. Input when calling this method should be:
* $this->data = array(array( 0=>'labelxA', 1=>yA), array('labelxB',yB)); or
* $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // TODO Syntax not supported. Removed when dol_print_graph_removed
* $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x
* $this->legend= array("Val1",...,"Valn"); // list of n series name
* $this->type = array('bars',...'lines'); or array('pie')
* $this->mode = 'depth' ???
* $this->bgcolorgrid
* $this->datacolor
*
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
* @param string $fileurl Url path to show image if saved onto disk
* @return void
*/
private function draw_jflot($file, $fileurl)
{
global $artichow_defaultfont;
dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type));
if (empty($this->width) && empty($this->height)) {
print 'Error width or height not set';
return;
}
$legends = array();
$nblot = count($this->data[0]) - 1;
// -1 to remove legend
if ($nblot < 0) {
dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw');
}
$firstlot = 0;
// Works with line but not with bars
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
$i = $firstlot;
$serie = array();
while ($i < $nblot) {
$values = array();
// Array with horizontal y values (specific values of a serie) for each abscisse x
$serie[$i] = "var d" . $i . " = [];\n";
// Fill array $values
$x = 0;
foreach ($this->data as $valarray) {
$legends[$x] = $valarray[0];
$values[$x] = is_numeric($valarray[$i + 1]) ? $valarray[$i + 1] : null;
$x++;
}
// TODO Avoid push by adding generated long array...
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') {
foreach ($values as $x => $y) {
if (isset($y)) {
$serie[$i] .= 'd' . $i . '.push({"label":"' . dol_escape_js($legends[$x]) . '", "data":' . $y . '});' . "\n";
}
}
} else {
foreach ($values as $x => $y) {
if (isset($y)) {
$serie[$i] .= 'd' . $i . '.push([' . $x . ', ' . $y . ']);' . "\n";
}
}
}
unset($values);
$i++;
}
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
$this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n";
if (!empty($this->title)) {
$this->_stringtoshow .= '<div align="center" class="dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
}
$this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="dolgraph' . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . '"></div>' . "\n";
$this->_stringtoshow .= '<script id="' . $tag . '">' . "\n";
$this->_stringtoshow .= '$(function () {' . "\n";
$i = $firstlot;
while ($i < $nblot) {
$this->_stringtoshow .= $serie[$i];
$i++;
}
$this->_stringtoshow .= "\n";
// Special case for Graph of type 'pie'
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') {
$datacolor = array();
foreach ($this->datacolor as $val) {
$datacolor[] = "#" . sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]);
}
$urltemp = '';
// TODO Add support for url link into labels
$showlegend = $this->showlegend;
$showpointvalue = $this->showpointvalue;
$showpercent = $this->showpercent;
$this->_stringtoshow .= '
function plotWithOptions_' . $tag . '() {
$.plot($("#placeholder_' . $tag . '"), d0,
{
series: {
pie: {
show: true,
radius: 3/4,
label: {
show: true,
radius: 3/4,
formatter: function(label, series) {
var percent=Math.round(series.percent);
//.........这里部分代码省略.........
示例2: dol_buildlogin
/**
* Build a login from lastname, firstname
*
* @param string $lastname Lastname
* @param string $firstname Firstname
* @return string Login
*/
function dol_buildlogin($lastname, $firstname)
{
$login = strtolower(dol_string_unaccent($firstname));
$login .= $login ? '.' : '';
$login .= strtolower(dol_string_unaccent($lastname));
$login = dol_string_nospecial($login, '');
// For special names
return $login;
}
示例3: Cotisation
$mesg = $member->error;
$error++;
} else {
$subscription = new Cotisation($db);
}
$amount = $subscription->total_ttc;
if (GETPOST("amount", 'int')) {
$amount = GETPOST("amount", 'int');
}
$amount = price2num($amount);
$fulltag = 'MEM=' . $member->id . '.DAT=' . dol_print_date(dol_now(), '%Y%m%d%H%M');
if (!empty($TAG)) {
$tag = $TAG;
$fulltag .= '.TAG=' . $TAG;
}
$fulltag = dol_string_unaccent($fulltag);
// Creditor
$var = !$var;
print '<tr class="CTableRow' . ($var ? '1' : '2') . '"><td class="CTableRow' . ($var ? '1' : '2') . '">' . $langs->trans("Creditor");
print '</td><td class="CTableRow' . ($var ? '1' : '2') . '"><b>' . $creditor . '</b>';
print '<input type="hidden" name="creditor" value="' . $creditor . '">';
print '</td></tr>' . "\n";
// Debitor
$var = !$var;
print '<tr class="CTableRow' . ($var ? '1' : '2') . '"><td class="CTableRow' . ($var ? '1' : '2') . '">' . $langs->trans("Member");
print '</td><td class="CTableRow' . ($var ? '1' : '2') . '"><b>';
if ($member->morphy == 'mor' && !empty($member->societe)) {
print $member->societe;
} else {
print $member->getFullName($langs);
}
示例4: dol_sanitizeFileName
/**
* Clean a string to use it as a file name.
* @param str String to clean
* @param newstr String to replace bad chars with
* @return string String cleaned (a-zA-Z_)
* @see dol_string_nospecial, dol_string_unaccent
*/
function dol_sanitizeFileName($str, $newstr = '_')
{
global $conf;
return dol_string_nospecial(dol_string_unaccent($str), $newstr, $conf->filesystem_forbidden_chars);
}
示例5: EnregDestinataireSEPA
/**
* Write recipient of request (customer)
*
* @param string $row_code_client soc.code_client as code,
* @param string $row_nom pl.client_nom AS nom,
* @param string $row_address soc.address AS adr,
* @param string $row_zip soc.zip
* @param string $row_town soc.town
* @param string $row_country_code p.code AS pays,
* @param string $row_cb pl.code_banque AS cb,
* @param string $row_cg pl.code_guichet AS cg,
* @param string $row_cc pl.number AS cc,
* @param string $row_somme pl.amount AS somme,
* @param string $row_facnumber f.facnumber
* @param string $row_idfac pf.fk_facture AS idfac,
* @param string $row_iban rib.iban_prefix AS iban,
* @param string $row_bic rib.bic AS bic,
* @param string $row_datec soc.datec,
* @param string $row_drum soc.rowid AS drum
* @return string Return string with SEPA part DrctDbtTxInf
*/
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
{
$CrLf = "\n";
$Rowing = sprintf("%06d", $row_idfac);
$Date_Rum = strtotime($row_datec);
$pre = $date_Rum > 1359673200 ? 'Rum' : '++R';
$Rum = $pre . $row_code_client . $row_drum . '-0' . date('U', $Date_Rum);
$XML_DEBITOR = '';
$XML_DEBITOR .= ' <DrctDbtTxInf>' . $CrLf;
$XML_DEBITOR .= ' <PmtId>' . $CrLf;
$XML_DEBITOR .= ' <EndToEndId>' . ('AS-' . $row_facnumber . '-' . $Rowing) . '</EndToEndId>' . $CrLf;
$XML_DEBITOR .= ' </PmtId>' . $CrLf;
$XML_DEBITOR .= ' <InstdAmt Ccy.="EUR">' . round($row_somme, 2) . '</InstdAmt>' . $CrLf;
$XML_DEBITOR .= ' <DrctDbtTx>' . $CrLf;
$XML_DEBITOR .= ' <MndtRltdInf>' . $CrLf;
$XML_DEBITOR .= ' <MndtId>' . $Rum . '</MndtId>' . $CrLf;
$XML_DEBITOR .= ' <DtOfSgntr>' . $row_datec . '</DtOfSgntr>' . $CrLf;
$XML_DEBITOR .= ' <AmdmntInd>false</AmdmntInd>' . $CrLf;
$XML_DEBITOR .= ' </MndtRltdInf>' . $CrLf;
$XML_DEBITOR .= ' </DrctDbtTx>' . $CrLf;
$XML_DEBITOR .= ' <DbtrAgt>' . $CrLf;
$XML_DEBITOR .= ' <FinInstnId>' . $CrLf;
$XML_DEBITOR .= ' <BIC>' . $row_bic . '</BIC>' . $CrLf;
$XML_DEBITOR .= ' </FinInstnId>' . $CrLf;
$XML_DEBITOR .= ' </DbtrAgt>' . $CrLf;
$XML_DEBITOR .= ' <Dbtr>' . $CrLf;
$XML_DEBITOR .= ' <Nm>' . strtoupper(dol_string_unaccent($row_nom)) . '</Nm>' . $CrLf;
$XML_DEBITOR .= ' <PstlAdr>' . $CrLf;
$XML_DEBITOR .= ' <Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
$XML_DEBITOR .= ' <AdrLine>' . strtr($row_adr, array(CHR(13) => ", ", CHR(10) => "")) . '</AdrLine>' . $CrLf;
$XML_DEBITOR .= ' <AdrLine>' . dol_string_unaccent($row_zip . ' ' . $row_town) . '</AdrLine>' . $CrLf;
$XML_DEBITOR .= ' </PstlAdr>' . $CrLf;
$XML_DEBITOR .= ' </Dbtr>' . $CrLf;
$XML_DEBITOR .= ' <DbtrAcct>' . $CrLf;
$XML_DEBITOR .= ' <Id>' . $CrLf;
$XML_DEBITOR .= ' <IBAN>' . $row_iban . '</IBAN>' . $CrLf;
$XML_DEBITOR .= ' </Id>' . $CrLf;
$XML_DEBITOR .= ' </DbtrAcct>' . $CrLf;
$XML_DEBITOR .= ' <RmtInf>' . $CrLf;
$XML_DEBITOR .= ' <Ustrd>' . ($row_facnumber . '/' . $Rowing . '/' . $Rum) . '</Ustrd>' . $CrLf;
$XML_DEBITOR .= ' </RmtInf>' . $CrLf;
$XML_DEBITOR .= ' </DrctDbtTxInf>' . $CrLf;
return $XML_DEBITOR;
}
示例6: format_group_header
function format_group_header(&$col)
{
//cambio 2byte.es
global $db;
$this->text .= '<TR class="swRepGrpHdrRow">';
$this->text .= '<TD class="swRepGrpHdrLbl" ' . $this->get_style_tags($this->query->output_group_header_label_styles) . '>';
$qn = get_query_column($col->query_name, $this->query->columns);
$padstring = $qn->column_value;
//cambio 2byte.es
//if ($db->forcecharset == 'utf8'){
$padstring = dol_string_unaccent($padstring);
/*}
else{
$padstring = dol_htmlentities($padstring,ENT_COMPAT);
}*/
// Create sensible group header label from column name
$tempstring = column_name_to_label($col->query_name);
$tempstring = $col->derive_attribute("column_title", $tempstring);
$tempstring = sw_translate($col->derive_attribute("column_title", $tempstring));
$this->text .= sw_translate($col->derive_attribute("group_header_label", $tempstring));
$this->text .= "</TD>";
$this->text .= '<TD class="swRepGrpHdrDat" ' . $this->get_style_tags($this->query->output_group_header_value_styles) . '>';
if ($qn->output_hyperlinks) {
$this->text .= $this->format_hyperlinks($qn->output_hyperlinks, $padstring);
} else {
$this->text .= "{$padstring}";
}
$this->text .= "</TD>";
$this->text .= "</TR>";
}
示例7: draw_jflot
/**
* Build a graph onto disk using JFlot library
* $graph_data = array(array('labelxA',yA),array('labelxB',yB));
* $graph_data = array(array('labelxA',yA1,...,yAn),array('labelxB',yB1,...yBn)); // when there is n value to show for each x
* $legend = array("Val1",...,"Valn"); // list of n series name
*
* @param string $file Image file name to use if we save onto disk
* @param string $fileurl Url path to show image if saved onto disk
* @return void
*/
private function draw_jflot($file, $fileurl)
{
global $artichow_defaultfont;
dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type));
// On boucle sur chaque lot de donnees
$legends = array();
$nblot = count($this->data[0]) - 1;
// -1 to remove legend
$firstlot = 0;
if ($nblot > 2) {
$firstlot = $nblot - 2;
}
// We limit nblot to 2 because jflot can't manage more than 2 bars on same x
$i = $firstlot;
$serie = array();
while ($i < $nblot) {
$x = 0;
$values = array();
foreach ($this->data as $key => $valarray) {
$legends[$x] = $valarray[0];
$values[$x] = $valarray[$i + 1];
$x++;
}
// We fix unknown values to null
$newvalues = array();
foreach ($values as $val) {
$newvalues[] = is_numeric($val) ? $val : null;
}
//print "Lot de donnees $i<br>";
//print_r($values);
//print '<br>';
$serie[$i] = "var d" . $i . " = [];\n";
$x = 0;
foreach ($newvalues as $key => $val) {
if (isset($val)) {
$serie[$i] .= "d" . $i . ".push([" . $x . ", " . $val . "]);\n";
}
$x++;
}
$i++;
}
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
$this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n";
$this->_stringtoshow .= '<br><div align="center">' . $this->title . '</div><br>';
$this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;"></div>' . "\n";
$this->_stringtoshow .= '<script id="' . $tag . '">' . "\n";
$this->_stringtoshow .= '$(function () {' . "\n";
$i = $firstlot;
while ($i < $nblot) {
$this->_stringtoshow .= $serie[$i];
$i++;
}
$this->_stringtoshow .= "\n";
$this->_stringtoshow .= '
function showTooltip_' . $tag . '(x, y, contents) {
$(\'<div id="tooltip_' . $tag . '">\' + contents + \'</div>\').css( {
position: \'absolute\',
display: \'none\',
top: y + 5,
left: x + 5,
border: \'1px solid #ddd\',
padding: \'2px\',
\'background-color\': \'#ffe\',
width: 200,
opacity: 0.80
}).appendTo("body").fadeIn(20);
}
var previousPoint = null;
$("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
/* console.log(item); */
var x = item.datapoint[0].toFixed(2);
var y = item.datapoint[1].toFixed(2);
var z = item.series.xaxis.ticks[item.dataIndex].label;
showTooltip_' . $tag . '(item.pageX, item.pageY,
item.series.label + "<br>" + z + " => " + y);
}
}
else {
$("#tooltip_' . $tag . '").remove();
previousPoint = null;
//.........这里部分代码省略.........
示例8: EnregEmetteurSEPA
/**
* Write sender of request (me).
* Note: The tag PmtInf is opened here but closed into caller
*
* @param string $configuration conf
* @param int $ladate Date
* @param int $nombre 0 or 1
* @param float $total Total
* @param string $CrLf End of line character
* @return string String with SEAP Sender
*/
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\\n')
{
// SEPA INITIALISATION
global $confs;
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');
$dateTime_YMDHMS = dol_print_date($ladate, '%Y-%m-%dT%H:%M:%S');
// Récupération info demandeur
$sql = "SELECT rowid, ref";
$sql .= " FROM";
$sql .= " " . MAIN_DB_PREFIX . "prelevement_bons as pb";
$sql .= " WHERE pb.rowid = " . $this->id;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
// DONNEES BRUTES : par la suite Rows['XXX'] de la requete au dessus
$country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
$IdBon = sprintf("%05d", $obj->rowid);
$RefBon = $obj->ref;
$type = $nombre == 1 ? 'FRST' : 'RCUR';
// SEPA Paiement Information
$XML_SEPA_INFO = '';
$XML_SEPA_INFO .= ' <PmtInf>' . $CrLf;
$XML_SEPA_INFO .= ' <PmtInfId>' . ('PREL' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
$XML_SEPA_INFO .= ' <PmtMtd>DD</PmtMtd>' . $CrLf;
$XML_SEPA_INFO .= ' <NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
$XML_SEPA_INFO .= ' <CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
$XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf;
$XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf;
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf;
$XML_SEPA_INFO .= ' </SvcLvl>' . $CrLf;
$XML_SEPA_INFO .= ' <LclInstrm>' . $CrLf;
$XML_SEPA_INFO .= ' <Cd>CORE</Cd>' . $CrLf;
$XML_SEPA_INFO .= ' </LclInstrm>' . $CrLf;
$XML_SEPA_INFO .= ' <SeqTp>' . $type . '</SeqTp>' . $CrLf;
$XML_SEPA_INFO .= ' </PmtTpInf>' . $CrLf;
$XML_SEPA_INFO .= ' <ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
$XML_SEPA_INFO .= ' <Cdtr>' . $CrLf;
$XML_SEPA_INFO .= ' <Nm>' . strtoupper(dol_string_unaccent($configuration->global->PRELEVEMENT_RAISON_SOCIALE)) . '</Nm>' . $CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>' . $CrLf;
$XML_SEPA_INFO .= ' <Ctry>' . $country[1] . '</Ctry>' . $CrLf;
$XML_SEPA_INFO .= ' <AdrLine>' . strtoupper(dol_string_unaccent($configuration->global->MAIN_INFO_SOCIETE_ADDRESS)) . '</AdrLine>' . $CrLf;
$XML_SEPA_INFO .= ' <AdrLine>' . strtoupper(dol_string_unaccent($configuration->global->MAIN_INFO_SOCIETE_ZIP . ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN)) . '</AdrLine>' . $CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>' . $CrLf;
$XML_SEPA_INFO .= ' </Cdtr>' . $CrLf;
$XML_SEPA_INFO .= ' <CdtrAcct>' . $CrLf;
$XML_SEPA_INFO .= ' <Id>' . $CrLf;
$XML_SEPA_INFO .= ' <IBAN>' . preg_replace('/\\s/', '', $configuration->global->PRELEVEMENT_IBAN) . '</IBAN>' . $CrLf;
$XML_SEPA_INFO .= ' </Id>' . $CrLf;
$XML_SEPA_INFO .= ' </CdtrAcct>' . $CrLf;
$XML_SEPA_INFO .= ' <CdtrAgt>' . $CrLf;
$XML_SEPA_INFO .= ' <FinInstnId>' . $CrLf;
$XML_SEPA_INFO .= ' <BIC>' . $configuration->global->PRELEVEMENT_BIC . '</BIC>' . $CrLf;
$XML_SEPA_INFO .= ' </FinInstnId>' . $CrLf;
$XML_SEPA_INFO .= ' </CdtrAgt>' . $CrLf;
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
$XML_SEPA_INFO .= ' <Nm>'.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.'</Nm>'.$CrLf;
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;
*/
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>' . $CrLf;
$XML_SEPA_INFO .= ' <CdtrSchmeId>' . $CrLf;
$XML_SEPA_INFO .= ' <Id>' . $CrLf;
$XML_SEPA_INFO .= ' <PrvtId>' . $CrLf;
$XML_SEPA_INFO .= ' <Othr>' . $CrLf;
$XML_SEPA_INFO .= ' <Id>' . $configuration->global->PRELEVEMENT_ICS . '</Id>' . $CrLf;
$XML_SEPA_INFO .= ' <SchmeNm>' . $CrLf;
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>' . $CrLf;
$XML_SEPA_INFO .= ' </SchmeNm>' . $CrLf;
$XML_SEPA_INFO .= ' </Othr>' . $CrLf;
$XML_SEPA_INFO .= ' </PrvtId>' . $CrLf;
$XML_SEPA_INFO .= ' </Id>' . $CrLf;
$XML_SEPA_INFO .= ' </CdtrSchmeId>' . $CrLf;
} else {
fputs($this->file, 'INCORRECT EMETTEUR ' . $XML_SEPA_INFO . $CrLf);
$result = -2;
}
return $XML_SEPA_INFO;
}
示例9: select_country
/**
* Return combo list of activated countries, into language of user
*
* @param string $selected Id or Code or Label of preselected country
* @param string $htmlname Name of html select object
* @param string $htmloption Options html on select object
* @param string $maxlength Max length for labels (0=no limit)
* @return string HTML string with select
*/
function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0)
{
global $conf, $langs;
$langs->load("dict");
$out = '';
$countryArray = array();
$favorite = array();
$label = array();
$atleastonefavorite = 0;
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_country";
$sql .= " WHERE active = 1";
//$sql.= " ORDER BY code ASC";
dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= '<select id="select' . $htmlname . '" class="flat selectcountry" name="' . $htmlname . '" ' . $htmloption . '>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
$foundselected = false;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$countryArray[$i]['rowid'] = $obj->rowid;
$countryArray[$i]['code_iso'] = $obj->code_iso;
$countryArray[$i]['code_iso3'] = $obj->code_iso3;
$countryArray[$i]['label'] = $obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '');
$countryArray[$i]['favorite'] = $obj->favorite;
$favorite[$i] = $obj->favorite;
$label[$i] = dol_string_unaccent($countryArray[$i]['label']);
$i++;
}
array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray);
foreach ($countryArray as $row) {
if ($row['favorite'] && $row['code_iso']) {
$atleastonefavorite++;
}
if (empty($row['favorite']) && $atleastonefavorite) {
$atleastonefavorite = 0;
$out .= '<option value="" disabled="disabled">----------------------</option>';
}
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
$foundselected = true;
$out .= '<option value="' . $row['rowid'] . '" selected="selected">';
} else {
$out .= '<option value="' . $row['rowid'] . '">';
}
$out .= dol_trunc($row['label'], $maxlength, 'middle');
if ($row['code_iso']) {
$out .= ' (' . $row['code_iso'] . ')';
}
$out .= '</option>';
}
}
$out .= '</select>';
} else {
dol_print_error($this->db);
}
return $out;
}
示例10: dol_sanitizeFileName
/**
* Clean a string to use it as a file name
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @return string String cleaned (a-zA-Z_)
*
* @see dol_string_nospecial, dol_string_unaccent
*/
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
{
$filesystem_forbidden_chars = array('<', '>', ':', '/', '\\', '?', '*', '|', '"');
return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
}
示例11: build_column_results
function build_column_results($result_line)
{
// Ensure that values returned from database query are placed
// in the appropriate query column value
$ct = 0;
foreach ($this->columns as $k => $col) {
if ($col->in_select) {
$this->debug("selecting {$col->query_name} in");
// Oracle returns associated array keys in upper case
$assoc_key = $col->query_name;
if (array_key_exists($assoc_key, $result_line)) {
$this->debug("exists");
$colval = $result_line[$assoc_key];
if (is_string($colval)) {
$colval = trim($colval);
}
$this->debug("{$colval}");
} else {
if (array_key_exists(strtoupper($assoc_key), $result_line)) {
$this->debug("exists");
$colval = $result_line[strtoupper($assoc_key)];
if (is_string($colval)) {
$colval = trim($colval);
}
$this->debug("{$colval}");
} else {
$colval = "NULL";
}
}
//2byte.es
$this->columns[$k]->column_value = dol_string_unaccent(sw_translate($colval));
} else {
$this->columns[$k]->column_value = $col->query_name;
}
$ct++;
}
}
示例12: testDolUnaccent
/**
* testDolUnaccent
*
* @return boolean
*/
public function testDolUnaccent()
{
// Text not already HTML
$input = "A string\nwith a à ä é è ë ï ü ö ÿ, &, < and >.";
$after = dol_string_unaccent($input);
$this->assertEquals("A string\nwith a a a e e e i u o y, &, < and >.", $after);
}