本文整理汇总了PHP中dol_trunc函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_trunc函数的具体用法?PHP dol_trunc怎么用?PHP dol_trunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_trunc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadBox
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max of records to load
*
* @return void
*/
public function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$this->max = $max;
dol_include_once('/lead/class/lead.class.php');
$lead = new Lead($db);
$lead->fetch_all('DESC', 't.date_closure', $max, 0, array('t.date_closure<' => dol_now()));
$text = $langs->trans("LeadLate", $max);
$this->info_box_head = array('text' => $text, 'limit' => dol_strlen($text));
$i = 0;
foreach ($lead->lines as $line) {
// FIXME: line is an array, not an object
$line->fetch_thirdparty();
// Ref
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $line->ref, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($line->thirdparty->name, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
// Amount Guess
$this->info_box_contents[$i][4] = array('td' => 'align="left"', 'text' => price($line->amount_prosp, 'HTML') . $langs->getCurrencySymbol($conf->currency));
// Amount real
$this->info_box_contents[$i][5] = array('td' => 'align="left"', 'text' => $line->getRealAmount() . $langs->getCurrencySymbol($conf->currency));
$i++;
}
}
示例2: llxHeader
function llxHeader($head = '', $title='', $help_url='', $morehtml='')
{
global $conf,$langs,$user;
$langs->load("ftp");
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
$menu = new Menu();
$MAXFTP=20;
$i=1;
while ($i <= $MAXFTP)
{
$paramkey='FTP_NAME_'.$i;
//print $paramkey;
if (! empty($conf->global->$paramkey))
{
$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
$menu->add($link, dol_trunc($conf->global->$paramkey,24));
}
$i++;
}
left_menu($menu->liste, $help_url, $morehtml, '', 1);
main_area();
}
示例3: loadBox
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $user, $langs, $db, $conf;
$this->max = $max;
$now = dol_now();
$this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices", $max));
if ($user->rights->contrat->lire) {
// Select contracts with at least one expired service
$sql = "SELECT ";
$sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
$sql .= " s.nom as name, s.rowid as socid,";
$sql .= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
$sql .= " FROM " . MAIN_DB_PREFIX . "contrat as c, " . MAIN_DB_PREFIX . "societe s, " . MAIN_DB_PREFIX . "contratdet as cd";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '" . $db->idate($now) . "'";
$sql .= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
if ($user->societe_id) {
$sql .= ' AND c.fk_soc = ' . $user->societe_id;
}
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
$sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid";
$sql .= " ORDER BY date_line ASC";
$sql .= $db->plimit($max, 0);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$late = '';
$objp = $db->fetch_object($resql);
$dateline = $db->jdate($objp->date_line);
if ($dateline + $conf->contrat->services->expires->warning_delay < $now) {
$late = img_warning($langs->trans("Late"));
}
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/contrat/card.php?id=" . $objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref ? $objp->ref : $objp->rowid, 'url' => DOL_URL_ROOT . "/contrat/card.php?id=" . $objp->rowid);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($objp->name, 40), 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="center"', 'text' => dol_print_date($dateline, 'day'), 'text2' => $late);
$this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => $objp->nb_services);
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoExpiredServices"));
}
$db->free($resql);
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
}
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例4: select_type_socialcontrib
/**
* Return list of social contributions.
* Use mysoc->country_id or mysoc->country_code so they must be defined.
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param int $useempty Set to 1 if we want an empty value
* @param int $maxlen Max length of text in combo box
* @param int $help Add or not the admin help picto
* @return void
*/
function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1)
{
global $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_type_socialcontrib with mysoc country not yet defined');
exit;
}
if (!empty($mysoc->country_id)) {
$sql = "SELECT c.id, c.libelle as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.fk_pays = " . $mysoc->country_id;
$sql .= " ORDER BY c.libelle ASC";
} else {
$sql = "SELECT c.id, c.libelle as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales as c, " . MAIN_DB_PREFIX . "c_country as co";
$sql .= " WHERE c.active = 1 AND c.fk_pays = co.rowid";
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql .= " ORDER BY c.libelle ASC";
}
dol_syslog("Form::select_type_socialcontrib", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
if ($num) {
print '<select class="flat" name="' . $htmlname . '">';
$i = 0;
if ($useempty) {
print '<option value="0"> </option>';
}
while ($i < $num) {
$obj = $db->fetch_object($resql);
print '<option value="' . $obj->id . '"';
if ($obj->id == $selected) {
print ' selected="selected"';
}
print '>' . dol_trunc($obj->type, $maxlen);
$i++;
}
print '</select>';
if ($user->admin && $help) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
} else {
print $langs->trans("ErrorNoSocialContributionForSellerCountry", $mysoc->country_code);
}
} else {
dol_print_error($db, $db->lasterror());
}
}
示例5: printBookmarksList
/**
* Add area with bookmarks in menu
*
* @param DoliDb $aDb Database handler
* @param Translate $aLangs Object lang
* @return string
*/
function printBookmarksList($aDb, $aLangs)
{
global $conf, $user;
$db = $aDb;
$langs = $aLangs;
require_once DOL_DOCUMENT_ROOT . '/bookmarks/class/bookmark.class.php';
if (!isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
$conf->global->BOOKMARKS_SHOW_IN_MENU = 5;
}
$bookm = new Bookmark($db);
$langs->load("bookmarks");
$url = $_SERVER["PHP_SELF"] . (!empty($_SERVER["QUERY_STRING"]) ? '?' . $_SERVER["QUERY_STRING"] : '');
$ret = '';
// Menu bookmark
$ret .= '<div class="menu_titre">';
$ret .= '<table class="nobordernopadding" width="100%" summary="bookmarkstable"><tr><td>';
$ret .= '<a class="vmenu" href="' . DOL_URL_ROOT . '/bookmarks/liste.php">' . $langs->trans('Bookmarks') . '</a>';
$ret .= '</td><td align="right">';
if ($user->rights->bookmark->creer) {
$ret .= '<a class="vsmenu" href="' . DOL_URL_ROOT . '/bookmarks/fiche.php?action=create&urlsource=' . urlencode($url) . '&url=' . urlencode($url) . '">';
//$ret.=img_picto($langs->trans('AddThisPageToBookmarks'),'edit_add').' ';
$ret .= img_object($langs->trans('AddThisPageToBookmarks'), 'bookmark');
$ret .= '</a>';
}
$ret .= '</td></tr></table>';
$ret .= '</div>';
$ret .= '<div class="menu_top"></div>' . "\n";
// Menu with all bookmarks
if (!empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
$sql = "SELECT rowid, title, url, target FROM " . MAIN_DB_PREFIX . "bookmark";
$sql .= " WHERE (fk_user = " . $user->id . " OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity = " . $conf->entity;
$sql .= " ORDER BY position";
if ($resql = $db->query($sql)) {
$i = 0;
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && ($obj = $db->fetch_object($resql))) {
$ret .= '<div class="menu_contenu"><a class="vsmenu" title="' . $obj->title . '" href="' . $obj->url . '"' . ($obj->target == 1 ? ' target="_blank"' : '') . '>';
$ret .= ' ' . img_object('', 'bookmark') . ' ';
$ret .= dol_trunc($obj->title, 20) . '</a><br></div>';
$i++;
}
} else {
dol_print_error($db);
}
}
$ret .= '<div class="menu_end"></div>';
return $ret;
}
示例6: RemiseCheque
$bordereaustatic = new RemiseCheque($db);
$bordereaustatic->id = $objp->fk_bordereau;
$label .= ' ' . $bordereaustatic->getNomUrl(2);
}
print $label;
print "</td>\n";
// Num
print '<td class="nowrap">' . ($objp->num_chq ? $objp->num_chq : "") . "</td>\n";
// Description
print '<td>';
// Show generic description
if (preg_match('/^\\((.*)\\)$/i', $objp->label, $reg)) {
// Generic description because between (). We show it after translating.
print $langs->trans($reg[1]);
} else {
print dol_trunc($objp->label, 60);
}
// Add links after description
$links = $object->get_url($objp->rowid);
foreach ($links as $key => $val) {
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$paymentstatic->ref = $links[$key]['url_id'];
print ' ' . $paymentstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
print ' ' . $paymentsupplierstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_sc') {
print '<a href="' . DOL_URL_ROOT . '/compta/payment_sc/card.php?id=' . $links[$key]['url_id'] . '">';
print ' ' . img_object($langs->trans('ShowPayment'), 'payment') . ' ';
示例7: getNomUrl
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option 'withproject' or ''
* @param string $mode Mode 'task', 'time', 'contact', 'note', document' define page to link to.
* @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string
* @param string $sep Separator between ref and label if option addlabel is set
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0, $option = '', $mode = 'task', $addlabel = 0, $sep = ' - ')
{
global $langs;
$result = '';
$label = '<u>' . $langs->trans("ShowTask") . '</u>';
if (!empty($this->ref)) {
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
}
if (!empty($this->label)) {
$label .= '<br><b>' . $langs->trans('LabelTask') . ':</b> ' . $this->label;
}
if ($this->date_start || $this->date_end) {
$label .= "<br>" . get_date_range($this->date_start, $this->date_end, '', $langs, 0);
}
$linkclose = '" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">';
$link = '<a href="' . DOL_URL_ROOT . '/projet/tasks/' . $mode . '.php?id=' . $this->id . ($option == 'withproject' ? '&withproject=1' : '') . $linkclose;
$linkend = '</a>';
$picto = 'projecttask';
if ($withpicto) {
$result .= $link . img_object($label, $picto, 'class="classfortooltip"') . $linkend;
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';
}
if ($withpicto != 2) {
$result .= $link . $this->ref . $linkend . ($addlabel && $this->label ? $sep . dol_trunc($this->label, $addlabel > 1 ? $addlabel : 0) : '');
}
return $result;
}
示例8: build_filterField
/**
* Build an input field used to filter the query
*
* @param string $TypeField Type of Field to filter
* @param string $NameField Name of the field to filter
* @param string $ValueField Initial value of the field to filter
* @return string html string of the input field ex : "<input type=text name=... value=...>"
*/
function build_filterField($TypeField, $NameField, $ValueField)
{
$szFilterField = '';
$InfoFieldList = explode(":", $TypeField);
// build the input field on depend of the type of file
switch ($InfoFieldList[0]) {
case 'Text':
case 'Date':
case 'Duree':
case 'Numeric':
$szFilterField = '<input type="text" name=' . $NameField . " value='" . $ValueField . "'>";
break;
case 'Boolean':
$szFilterField = '<select name="' . $NameField . '" class="flat">';
$szFilterField .= '<option ';
if ($ValueField == '') {
$szFilterField .= ' selected ';
}
$szFilterField .= ' value=""> </option>';
$szFilterField .= '<option ';
if ($ValueField == 'yes') {
$szFilterField .= ' selected ';
}
$szFilterField .= ' value="yes">' . yn(1) . '</option>';
$szFilterField .= '<option ';
if ($ValueField == 'no') {
$szFilterField .= ' selected ';
}
$szFilterField .= ' value="no">' . yn(0) . '</option>';
$szFilterField .= "</select>";
break;
case 'List':
// 0 : Type du champ
// 1 : Nom de la table
// 2 : Nom du champ contenant le libelle
// 3 : Nom du champ contenant la cle (si different de rowid)
if (count($InfoFieldList) == 4) {
$keyList = $InfoFieldList[3];
} else {
$keyList = 'rowid';
}
$sql = 'SELECT ' . $keyList . ' as rowid, ' . $InfoFieldList[2];
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[1];
$resql = $this->db->query($sql);
if ($resql) {
$szFilterField = '<select class="flat" name="' . $NameField . '">';
$szFilterField .= '<option value="0"> </option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($obj->{$InfoFieldList}[2] == '-') {
// Discard entry '-'
$i++;
continue;
}
$labeltoshow = dol_trunc($obj->{$InfoFieldList}[2], 18);
if (!empty($ValueField) && $ValueField == $obj->rowid) {
$szFilterField .= '<option value="' . $obj->rowid . '" selected="selected">' . $labeltoshow . '</option>';
} else {
$szFilterField .= '<option value="' . $obj->rowid . '" >' . $labeltoshow . '</option>';
}
$i++;
}
}
$szFilterField .= "</select>";
$this->db->free();
}
break;
}
return $szFilterField;
}
示例9: dol_trunc
if ($obj->pid) {
$productstatic->id = $obj->pid;
$productstatic->type = $obj->ptype;
$productstatic->ref = $obj->pref;
$productstatic->entity = $obj->pentity;
print $productstatic->getNomUrl(1, '', 20);
print $obj->label ? ' - ' . dol_trunc($obj->label, 16) : '';
if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
print '<br>' . dol_nl2br($obj->description);
}
} else {
if ($obj->type == 0) {
print img_object($obj->description, 'product') . dol_trunc($obj->description, 20);
}
if ($obj->type == 1) {
print img_object($obj->description, 'service') . dol_trunc($obj->description, 20);
}
}
print '</td>';
// Third party
print '<td>';
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->client = 1;
print $companystatic->getNomUrl(1, 'customer', 28);
print '</td>';
// Start date
if ($mode == "0") {
print '<td align="center">';
print $obj->date_ouverture_prevue ? dol_print_date($db->jdate($obj->date_ouverture_prevue)) : ' ';
if ($db->jdate($obj->date_ouverture_prevue) && $db->jdate($obj->date_ouverture_prevue) < $now - $conf->contrat->services->inactifs->warning_delay) {
示例10:
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
$classname = "impayee";
print '<td nowrap>';
$facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->ref;
print $facturestatic->getNomUrl(1);
print "</td>\n";
print "<td nowrap>".dol_trunc($objp->facnumber,12)."</td>\n";
print "<td nowrap align=\"center\">".dol_print_date($db->jdate($objp->df))."</td>\n";
print "<td nowrap align=\"center\">".dol_print_date($db->jdate($objp->datelimite));
if ($db->jdate($objp->datelimite) < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
print "</td>\n";
print '<td>';
$companystatic->id=$objp->socid;
$companystatic->nom=$objp->nom;
print $companystatic->getNomUrl(1,'supplier',32);
print '</td>';
print "<td align=\"right\">".price($objp->total_ht)."</td>";
print "<td align=\"right\">".price($objp->total_ttc)."</td>";
print "<td align=\"right\">".price($objp->am)."</td>";
示例11: dol_trunc
print '<tr ' . $bc[$var] . '>';
// Ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowrap">';
print $product_static->getNomUrl(1, '', 24);
print "</td>\n";
}
// Ref supplier
if (!empty($arrayfields['pfp.ref_fourn']['checked'])) {
print '<td class="nowrap">';
print $product_static->getNomUrl(1, '', 24);
print "</td>\n";
}
// Label
if (!empty($arrayfields['p.label']['checked'])) {
print '<td>' . dol_trunc($objp->label, 40) . '</td>';
}
// Barcode
if (!empty($arrayfields['p.barcode']['checked'])) {
print '<td>' . $objp->barcode . '</td>';
}
// Duration
if (!empty($arrayfields['p.duration']['checked'])) {
print '<td align="center">';
if (preg_match('/([0-9]+)[a-z]/i', $objp->duration)) {
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
print $regs[1] . ' ' . $langs->trans("DurationYear");
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
print $regs[1] . ' ' . $langs->trans("DurationMonth");
} elseif (preg_match('/([0-9]+)w/i', $objp->duration, $regs)) {
print $regs[1] . ' ' . $langs->trans("DurationWeek");
示例12: while
print "</tr>\n";
$i = 1;
$var = false;
while ($objp = $db->fetch_object($resql)) {
$account_id = $objp->bid;
if (!isset($accounts[$objp->bid])) {
$accounts[$objp->bid] = 0;
}
$accounts[$objp->bid] += 1;
print "<tr " . $bc[$var] . ">";
print '<td align="center">' . $i . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
// Date operation
print '<td align="center">' . ($objp->num_chq ? $objp->num_chq : ' ') . '</td>';
print '<td>' . dol_trunc($objp->emetteur, 24) . '</td>';
print '<td>' . dol_trunc($objp->banque, 24) . '</td>';
print '<td align="right">' . price($objp->amount) . '</td>';
print '<td align="center">';
$accountlinestatic->rowid = $objp->rowid;
if ($accountlinestatic->rowid) {
print $accountlinestatic->getNomUrl(1);
} else {
print ' ';
}
print '</td>';
if ($object->statut == 0) {
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=remove&lineid=' . $objp->rowid . '">' . img_delete() . '</a></td>';
} else {
print '<td> </td>';
}
print '</tr>';
示例13: while
if ($resql) {
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">' . $langs->trans("DraftOrders") . '</td></tr>';
$langs->load("orders");
$num = $db->num_rows($resql);
if ($num) {
$i = 0;
$var = True;
while ($i < $num) {
$var = !$var;
$obj = $db->fetch_object($resql);
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">';
print "<a href=\"card.php?id=" . $obj->rowid . "\">" . img_object($langs->trans("ShowOrder"), "order") . ' ' . $obj->ref . "</a></td>";
print '<td><a href="' . DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid . '">' . img_object($langs->trans("ShowCompany"), "company") . ' ' . dol_trunc($obj->name, 24) . '</a></td></tr>';
$i++;
}
}
print "</table><br>";
}
}
/*
* List of users allowed
*/
$sql = "SELECT u.rowid, u.lastname, u.firstname";
$sql .= " FROM " . MAIN_DB_PREFIX . "user as u,";
$sql .= " " . MAIN_DB_PREFIX . "user_rights as ur";
$sql .= ", " . MAIN_DB_PREFIX . "rights_def as rd";
$sql .= " WHERE u.rowid = ur.fk_user";
$sql .= " AND (u.entity IN (0," . $conf->entity . ")";
示例14: dol_sanitizeFileName
print '<td class="nobordernopadding" nowrap="nowrap">';
print $propalstatic->getNomUrl(1);
print '</td>';
print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
if ($db->jdate($obj->dp) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print "</td>";
print '<td align="left"><a href="fiche.php?socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,44).'</a></td>'."\n";
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
print '</tr>'."\n";
$i++;
$total += $obj->total_ttc;
}
if ($total>0) {
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>";
}
print "</table><br>";
}
}
else
示例15: list_of_autoecmfiles
//.........这里部分代码省略.........
$ref = isset($reg[1]) ? $reg[1] : '';
}
if ($modulepart == 'tax') {
preg_match('/(\\d+)\\/[^\\/]+$/', $relativefile, $reg);
$id = isset($reg[1]) ? $reg[1] : '';
}
if ($modulepart == 'project') {
preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
$ref = isset($reg[1]) ? $reg[1] : '';
}
if ($modulepart == 'fichinter') {
preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
$ref = isset($reg[1]) ? $reg[1] : '';
}
if ($modulepart == 'user') {
preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
$id = isset($reg[1]) ? $reg[1] : '';
}
if (!$id && !$ref) {
continue;
}
$found = 0;
if (!empty($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
$found = 1;
} else {
//print 'Fetch '.$id." - ".$ref.'<br>';
if ($id) {
$result = $object_instance->fetch($id);
} else {
//fetchOneLike looks for objects with wildcards in its reference.
//It is useful for those masks who get underscores instead of their actual symbols
//fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
//that's why we look only look fetchOneLike when fetch returns 0
if (!($result = $object_instance->fetch('', $ref))) {
$result = $object_instance->fetchOneLike($ref);
}
}
if ($result > 0) {
// Save object into a cache
$found = 1;
$this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = clone $object_instance;
}
if ($result == 0) {
$found = 1;
$this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = 'notfound';
unset($filearray[$key]);
}
}
if (!$found > 0 || !is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
continue;
}
// We do not show orphelins files
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>';
if ($found > 0 && is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
print $this->cache_objects[$modulepart . '_' . $id . '_' . $ref]->getNomUrl(1, 'document');
} else {
print $langs->trans("ObjectDeleted", $id ? $id : $ref);
}
print '</td>';
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
if ($forcedownload) {
print '&attachment=1';
}
print '&file=' . urlencode($relativefile) . '">';
print img_mime($file['name'], $file['name'] . ' (' . dol_print_size($file['size'], 0, 0) . ')') . ' ';
print dol_trunc($file['name'], $maxlength, 'middle');
print '</a>';
print "</td>\n";
print '<td align="right">' . dol_print_size($file['size'], 1, 1) . '</td>';
print '<td align="center">' . dol_print_date($file['date'], "dayhour") . '</td>';
print '<td align="right">';
if (!empty($useinecm)) {
print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
}
if ($forcedownload) {
print '&attachment=1';
}
print '&file=' . urlencode($relativefile) . '">';
print img_view() . '</a> ';
//if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
//else print ' ';
print "</td></tr>\n";
}
}
if (count($filearray) == 0) {
print '<tr ' . $bc[false] . '><td colspan="4">';
if (empty($textifempty)) {
print $langs->trans("NoFileFound");
} else {
print $textifempty;
}
print '</td></tr>';
}
print "</table>";
// Fin de zone
}