本文整理汇总了PHP中product_prepare_head函数的典型用法代码示例。如果您正苦于以下问题:PHP product_prepare_head函数的具体用法?PHP product_prepare_head怎么用?PHP product_prepare_head使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了product_prepare_head函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHeadForObject
static function getHeadForObject($tab_object, $fk_object)
{
global $db, $conf, $langs, $user;
$head = array();
if (empty($tab_object)) {
return $head;
}
if ($tab_object === 'product') {
dol_include_once('/product/class/product.class.php');
dol_include_once('/core/lib/product.lib.php');
$object = new Product($db);
$object->fetch($fk_object);
$head = product_prepare_head($object);
} else {
if ($tab_object === 'thirdparty') {
dol_include_once('/societe/class/societe.class.php');
dol_include_once('/core/lib/company.lib.php');
$object = new Societe($db);
$object->fetch($fk_object);
$head = societe_prepare_head($object);
} else {
if ($tab_object === 'contact') {
dol_include_once('/contact/class/contact.class.php');
dol_include_once('/core/lib/contact.lib.php');
$object = new Contact($db);
$object->fetch($fk_object);
$head = contact_prepare_head($object);
} else {
if ($tab_object === 'user') {
dol_include_once('/user/class/user.class.php');
dol_include_once('/core/lib/usergroups.lib.php');
$object = new User($db);
$object->fetch($fk_object);
$head = user_prepare_head($object);
} else {
if ($tab_object === 'group') {
dol_include_once('/user/class/usergroup.class.php');
dol_include_once('/lib/usergroups.lib.php');
$object = new UserGroup($db);
$object->fetch($fk_object);
$head = group_prepare_head($object);
} else {
if ($tab_object === 'project') {
dol_include_once('/projet/class/project.class.php');
dol_include_once('/core/lib/project.lib.php');
$object = new Project($db);
$object->fetch($fk_object);
$head = project_prepare_head($object);
}
}
}
}
}
}
return $head;
}
示例2: Form
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer)) {
$object->delete_photo($dir . "/" . $_GET["file"]);
}
if ($action == 'addthumb' && $_GET["file"]) {
$object->add_thumb($dir . "/" . $_GET["file"]);
}
/*
* View
*/
$form = new Form($db);
if ($object->id) {
llxHeader("", "", $langs->trans("CardProduct" . $object->type));
/*
* En mode visu
*/
$head = product_prepare_head($object, $user);
$titre = $langs->trans("CardProduct" . $object->type);
$picto = $object->type == 1 ? 'service' : 'product';
dol_fiche_head($head, 'photos', $titre, 0, $picto);
/*
* Confirmation de la suppression de photo
*/
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&file=' . $_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
}
print $mesg;
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">' . $langs->trans("Ref") . '</td><td colspan="2">';
print $form->showrefnav($object, 'ref', '', 1, 'ref');
示例3: natural_search
$params[] = 'pl.note';
}
if (!empty($conf->barcode->enabled)) {
$params[] = 'p.barcode';
}
$sql .= natural_search($params, $key);
}
if (!empty($conf->categorie->enabled) && !empty($parent) && $parent != -1) {
$sql .= " AND cp.fk_categorie ='" . $db->escape($parent) . "'";
}
$sql .= " ORDER BY p.ref ASC";
$resql = $db->query($sql);
}
//print $sql;
llxHeader("", "", $langs->trans("CardProduct" . $object->type));
$head = product_prepare_head($object);
$titre = $langs->trans("CardProduct" . $object->type);
$picto = $object->type == Product::TYPE_SERVICE ? 'service' : 'product';
dol_fiche_head($head, 'subproduct', $titre, 0, $picto);
if ($id > 0 || !empty($ref)) {
/*
* Fiche en mode edition
*/
if ($user->rights->produit->lire || $user->rights->service->lire) {
print '<table class="border" width="100%">';
print "<tr>";
$nblignes = 6;
if ($object->isproduct() && !empty($conf->stock->enabled)) {
$nblignes++;
}
if ($object->isservice()) {
示例4: assign_values
/**
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string &$action Type of action
* @param string $id Id of object
* @param string $ref Ref of object
* @return void
*/
function assign_values(&$action, $id=0, $ref='')
{
global $conf, $langs, $user, $mysoc, $canvas;
global $form, $formproduct;
$tmpobject = new Product($this->db);
if (! empty($id) || ! empty($ref)) $tmpobject->fetch($id,$ref);
$this->object = $tmpobject;
//parent::assign_values($action);
foreach($this->object as $key => $value)
{
$this->tpl[$key] = $value;
}
$this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors);
// canvas
$this->tpl['canvas'] = $this->canvas;
// id
$this->tpl['id'] = $this->id;
// Ref
$this->tpl['ref'] = $this->ref;
// Label
$this->tpl['label'] = $this->libelle;
// Description
$this->tpl['description'] = nl2br($this->description);
// Statut
$this->tpl['status'] = $this->getLibStatut(2);
// Note
$this->tpl['note'] = nl2br($this->note);
if ($action == 'create')
{
// Price
$this->tpl['price'] = $this->price;
$this->tpl['price_min'] = $this->price_min;
$this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type");
// VAT
$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
}
if ($action == 'create' || $action == 'edit')
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);
//To Buy
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view')
{
$head = product_prepare_head($this->object,$user);
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref');
$titre=$langs->trans("CardProduct".$this->object->type);
$picto=($this->object->type==1?'service':'product');
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
$this->tpl['showend']=dol_get_fiche_end();
// Accountancy buy code
$this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer);
$this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer);
// Accountancy sell code
$this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer);
$this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer);
}
$this->tpl['finished'] = $this->object->finished;
$this->tpl['ref'] = $this->object->ref;
$this->tpl['label'] = $this->object->label;
$this->tpl['id'] = $this->object->id;
$this->tpl['type'] = $this->object->type;
$this->tpl['note'] = $this->object->note;
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
//.........这里部分代码省略.........
示例5: _liste
function _liste(&$PDOdb)
{
global $langs, $db, $user, $conf;
llxHeader('', $langs->trans('ListOFAsset'), '', '');
//getStandartJS();
if (isset($_REQUEST['delete_ok'])) {
?>
<br><div class="error"><?php
echo $langs->trans('OFAssetDeleted');
?>
</div><br>
<?php
}
$fk_soc = __get('fk_soc', 0, 'integer');
$fk_product = __get('fk_product', 0, 'integer');
$fk_commande = __get('fk_commande', 0, 'integer');
if ($fk_product > 0) {
dol_include_once('/core/lib/product.lib.php');
$product = new Product($db);
$result = $product->fetch($fk_product);
$head = product_prepare_head($product, $user);
$titre = $langs->trans("CardProduct" . $product->type);
$picto = $product->type == 1 ? 'service' : 'product';
dol_fiche_head($head, 'tabOF2', $titre, 0, $picto);
} elseif ($fk_commande > 0) {
dol_include_once("/core/lib/order.lib.php");
$commande = new Commande($db);
$result = $commande->fetch($fk_commande);
$head = commande_prepare_head($commande, $user);
$titre = $langs->trans("CustomerOrder" . $product->type);
dol_fiche_head($head, 'tabOF3', $titre, 0, "order");
}
$form = new TFormCore();
$assetOf = new TAssetOF();
$r = new TSSRenderControler($assetOf);
$sql = "SELECT ofe.rowid, ofe.numero, ofe.fk_soc, s.nom as client, SUM(ofel.qty) as nb_product_to_make\n\t\t, GROUP_CONCAT(DISTINCT ofel.fk_product SEPARATOR ',') as fk_product, p.label as product, ofe.ordre, ofe.date_lancement , ofe.date_besoin, ofe.fk_commande,ofe.fk_project\n\t\t, ofe.status, ofe.fk_user,ofe.total_estimated_cost, ofe.total_cost, '' AS printTicket\n\t\t FROM " . MAIN_DB_PREFIX . "assetOf as ofe \n\t\t LEFT JOIN " . MAIN_DB_PREFIX . "assetOf_line ofel ON (ofel.fk_assetOf=ofe.rowid AND ofel.type = 'TO_MAKE')\n\t\t LEFT JOIN " . MAIN_DB_PREFIX . "product p ON (p.rowid = ofel.fk_product)\n\t\t LEFT JOIN " . MAIN_DB_PREFIX . "societe s ON (s.rowid = ofe.fk_soc)\n\t\t WHERE ofe.entity=" . $conf->entity;
if ($fk_soc > 0) {
$sql .= " AND ofe.fk_soc=" . $fk_soc;
}
if ($fk_product > 0) {
$sql .= " AND ofel.fk_product=" . $fk_product;
}
if ($fk_commande > 0) {
$sql .= " AND ofe.fk_commande=" . $fk_commande;
}
$sql .= " GROUP BY ofe.rowid ";
// TODO je me rappelle plus pourquoi j'ai fait cette merde mais ça fait planter le tri, donc à virer.
/*if($conf->global->ASSET_OF_LIST_BY_ROWID_DESC) $orderBy['ofe.rowid']='DESC';
else $orderBy['ofe.date_cre']='DESC';*/
$TMath = array();
$THide = array('rowid', 'fk_user', 'fk_product', 'fk_soc');
if ($fk_commande > 0) {
$THide[] = 'fk_commande';
}
if ($conf->global->OF_NB_TICKET_PER_PAGE == -1) {
$THide[] = 'printTicket';
}
if (empty($user->rights->of->of->price)) {
$THide[] = 'total_cost';
$THide[] = 'total_estimated_cost';
} else {
$TMath['total_estimated_cost'] = 'sum';
$TMath['total_cost'] = 'sum';
}
if (!empty($fk_product)) {
$TMath['nb_product_to_make'] = 'sum';
}
$form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'GET');
echo $form->hidden('action', '');
if ($fk_commande > 0) {
echo $form->hidden('fk_commande', $fk_commande);
}
if ($fk_product > 0) {
echo $form->hidden('fk_product', $fk_product);
}
// permet de garder le filtre produit quand on est sur l'onglet OF d'une fiche produit
$r->liste($PDOdb, $sql, array('limit' => array('nbLine' => $conf->liste_limit), 'orderBy' => $orderBy, 'subQuery' => array(), 'link' => array('Utilisateur en charge' => '<a href="' . dol_buildpath('/user/card.php?id=@fk_user@', 2) . '">' . img_picto('', 'object_user.png', '', 0) . ' @val@</a>', 'numero' => '<a href="' . dol_buildpath('/of/fiche_of.php?id=@rowid@"', 2) . '>' . img_picto('', 'object_list.png', '', 0) . ' @val@</a>', 'printTicket' => '<input style=width:40px;"" type="number" value="' . (int) $conf->global->OF_NB_TICKET_PER_PAGE . '" name="printTicket[@rowid@]" min="0" />'), 'translate' => array(), 'hide' => $THide, 'type' => array('date_lancement' => 'date', 'date_besoin' => 'date', 'total_cost' => 'money', 'total_estimated_cost' => 'money', 'nb_product_to_make' => 'number'), 'math' => $TMath, 'liste' => array('titre' => $langs->trans('ListOFAsset'), 'image' => img_picto('', 'title.png', '', 0), 'picto_precedent' => img_picto('', 'back.png', '', 0), 'picto_suivant' => img_picto('', 'next.png', '', 0), 'noheader' => (int) isset($_REQUEST['fk_soc']) | (int) isset($_REQUEST['fk_product']), 'messageNothing' => "Il n'y a aucun " . $langs->trans('OFAsset') . " à afficher", 'picto_search' => img_picto('', 'search.png', '', 0)), 'title' => array('numero' => 'Numéro', 'fk_commande' => 'Commande client', 'ordre' => 'Priorité', 'date_lancement' => 'Date du lancement', 'date_besoin' => 'Date du besoin', 'status' => 'Status', 'login' => 'Utilisateur en charge', 'product' => 'Produit', 'client' => 'Client', 'nb_product_to_make' => 'Nb produits à fabriquer', 'total_cost' => 'Coût réel', 'total_estimated_cost' => 'Coût prévu', 'printTicket' => 'impression<br />étiquette', 'fk_project' => 'Projet'), 'orderBy' => array('rowid' => 'DESC'), 'eval' => array('ordre' => 'TAssetOF::ordre(@val@)', 'status' => 'TAssetOF::status(@val@)', 'product' => 'get_format_libelle_produit("@fk_product@")', 'client' => 'get_format_libelle_societe(@fk_soc@)', 'fk_commande' => 'get_format_libelle_commande(@fk_commande@)', 'fk_project' => 'get_format_libelle_projet(@fk_project@)'), 'search' => array('numero' => array('recherche' => true, 'table' => 'ofe'), 'date_lancement' => array('recherche' => 'calendars', 'table' => 'ofe'), 'date_besoin' => array('recherche' => 'calendars', 'table' => 'ofe'), 'status' => array('recherche' => TAssetOF::$TStatus, 'table' => 'ofe'))));
if ($conf->global->OF_NB_TICKET_PER_PAGE != -1) {
echo '<p align="right"><input class="button" type="button" onclick="$(this).closest(\'form\').find(\'input[name=action]\').val(\'printTicket\'); $(this).closest(\'form\').submit(); " name="print" value="' . $langs->trans('ofPrintTicket') . '" /></p>';
}
$form->end();
// On n'affiche pas le bouton de création d'OF si on est sur la liste OF depuis l'onglet "OF" de la fiche commande
if ($fk_commande) {
$commande = new Commande($db);
$commande->fetch($fk_commande);
$r2 = new TSSRenderControler($assetOf);
$sql = "SELECT c.rowid as fk_commandedet, p.rowid as rowid, p.ref as refProd, p.label as nomProd, c.qty as qteCommandee, c.description, c.product_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "commandedet c LEFT JOIN " . MAIN_DB_PREFIX . "product p";
$sql .= " ON (c.fk_product = p.rowid)";
$sql .= " WHERE c.product_type IN (0,9) AND c.fk_commande = " . $fk_commande;
$resql = $db->query($sql);
//var_dump($db);
$num = $db->num_rows($resql);
print_barre_liste($langs->trans('ListOrderProducts'), $page, "liste.php", $param, $sortfield, $sortorder, '', $num);
$i = 0;
$form = new TFormCore($_SERVER['PHP_SELF'], 'formMakeOk', 'post');
echo $form->hidden('fk_commande', __get('fk_commande', 0, 'int'));
echo $form->hidden('action', 'createOFCommande');
echo $form->hidden('fk_soc', $commande->socid);
echo $form->hidden('token', $_SESSION['newtoken']);
//.........这里部分代码省略.........
示例6: header
}
header("Location: product.php?id=" . $id);
exit;
}
/*
* View
*/
$formproduct = new FormProduct($db);
if ($id > 0 || $ref) {
$product = new Product($db);
$result = $product->fetch($id, $ref);
$product->load_stock();
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
llxHeader("", $langs->trans("CardProduct" . $product->type), $help_url);
if ($result > 0) {
$head = product_prepare_head($product);
$titre = $langs->trans("CardProduct" . $product->type);
$picto = $product->type == Product::TYPE_SERVICE ? 'service' : 'product';
dol_fiche_head($head, 'stock', $titre, 0, $picto);
dol_htmloutput_events();
$form = new Form($db);
print '<table class="border" width="100%">';
// Ref
print '<tr>';
print '<td width="30%">' . $langs->trans("Ref") . '</td><td>';
print $form->showrefnav($product, 'ref', '', 1, 'ref');
print '</td>';
print '</tr>';
// Label
print '<tr><td>' . $langs->trans("Label") . '</td><td>' . $product->label . '</td>';
print '</tr>';
示例7: assign_values
/**
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string $action Type of action
* @param string $id Id of object
* @param string $ref Ref of object
* @return void
*/
function assign_values(&$action, $id = 0, $ref = '')
{
global $conf, $langs, $user, $mysoc, $canvas;
global $form, $formproduct;
$tmpobject = new Product($this->db);
if (!empty($id) || !empty($ref)) {
$tmpobject->fetch($id, $ref);
}
$this->object = $tmpobject;
//parent::assign_values($action);
foreach ($this->object as $key => $value) {
$this->tpl[$key] = $value;
}
$this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors);
// canvas
$this->tpl['canvas'] = $this->canvas;
// id
$this->tpl['id'] = $this->id;
// Ref
$this->tpl['ref'] = $this->ref;
// Label
$this->tpl['label'] = $this->libelle;
// Description
$this->tpl['description'] = nl2br($this->description);
// Statut
$this->tpl['status'] = $this->object->getLibStatut(2);
// Note
$this->tpl['note'] = nl2br($this->note);
if ($action == 'create') {
// Price
$this->tpl['price'] = $this->price;
$this->tpl['price_min'] = $this->price_min;
$this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type");
// VAT
$this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, '');
}
if ($action == 'create' || $action == 'edit') {
// Status
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut', $statutarray, $this->status);
//To Buy
$statutarray = array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy', $statutarray, $this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view') {
$head = product_prepare_head($this->object, $user);
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'ref', '', 1, 'ref');
$titre = $langs->trans("CardProduct" . $this->object->type);
$picto = $this->object->type == 1 ? 'service' : 'product';
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $titre, 0, $picto);
$this->tpl['showend'] = dol_get_fiche_end();
// Accountancy buy code
$this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer);
$this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer);
// Accountancy sell code
$this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer);
$this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer);
}
$this->tpl['finished'] = $this->object->finished;
$this->tpl['ref'] = $this->object->ref;
$this->tpl['label'] = $this->object->label;
$this->tpl['id'] = $this->object->id;
$this->tpl['type'] = $this->object->type;
$this->tpl['note'] = $this->object->note;
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
if ($action == 'create') {
// Title
$this->tpl['title'] = $langs->trans("NewProduct");
}
if ($action == 'edit') {
$this->tpl['title'] = $langs->trans('Modify') . ' ' . $langs->trans('Product') . ' : ' . $this->object->ref;
}
if ($action == 'create' || $action == 'edit') {
// Status
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut', $statutarray, $_POST["statut"]);
$statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy', $statutarray, $_POST["statut_buy"]);
// Finished
$statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
$this->tpl['finished'] = $form->selectarray('finished', $statutarray, $this->object->finished);
// Weight
$this->tpl['weight'] = $this->object->weight;
$this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units", "weight", $this->object->weight_units);
// Length
$this->tpl['length'] = $this->object->length;
$this->tpl['length_units'] = $formproduct->load_measuring_units("length_units", "size", $this->object->length_units);
// Surface
$this->tpl['surface'] = $this->object->surface;
$this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units", "surface", $this->object->surface_units);
//.........这里部分代码省略.........