/**
 * Prepare array with list of different ecm main dashboard
 *
 * @param   object	$object		Object related to tabs
 * @return  array				Array of tabs to shoc
 */
function ecm_prepare_dasboard_head($object)
{
    global $langs, $conf, $user;
    $h = 0;
    $head = array();
    $head[$h][0] = DOL_URL_ROOT . '/ecm/index.php';
    $head[$h][1] = $langs->trans("ECMSectionsManual") . img_help(1, $helptext1);
    $head[$h][2] = 'index';
    $h++;
    if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
        $head[$h][0] = DOL_URL_ROOT . '/ecm/index_auto.php';
        $head[$h][1] = $langs->trans("ECMSectionsAuto") . img_help(1, $helptext2);
        $head[$h][2] = 'index_auto';
        $h++;
    }
    // Show more tabs from modules
    // Entries must be declared in modules descriptor with line
    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
    complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm');
    complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm', 'remove');
    return $head;
}
Beispiel #2
0
        // Date
        print "<td align=\"center\" width=\"100\">";
        if ($obj->dc) {
            print dol_print_date($db->jdate($obj->dc), "day");
        } else {
            print "-";
        }
        print '</td>';
        // Delivery date
        print '<td align="right">';
        print dol_print_date($db->jdate($obj->date_livraison), 'day');
        print '</td>';
        // Statut
        print '<td align="right">' . $commandestatic->LibStatut($obj->fk_statut, 5) . '</td>';
        // Billed
        print '<td align="center">' . yn($obj->billed) . '</td>';
        print '<td></td>';
        print "</tr>\n";
        $i++;
    }
    print "</table>\n";
    print "</form>\n";
    if (!empty($conf->facture->enable)) {
        print '<br>' . img_help(1, '') . ' ' . $langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")) . '<br>';
    }
    $db->free($resql);
} else {
    dol_print_error($db);
}
llxFooter();
$db->close();
Beispiel #3
0
         $valuetoshow = $langs->trans("TypeOfTemplate");
     }
     if ($id == 2) {
         if ($fieldlist[$field] == 'region_id') {
             $valuetoshow = '&nbsp;';
             $showfield = 1;
         }
         if ($fieldlist[$field] == 'region') {
             $valuetoshow = $langs->trans("Country") . '/' . $langs->trans("Region");
             $showfield = 1;
         }
     }
     if ($valuetoshow != '') {
         print '<td align="' . $align . '">';
         if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
             print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>';
         } else {
             if (!empty($tabhelp[$id][$value])) {
                 print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
             } else {
                 print $valuetoshow;
             }
         }
         print '</td>';
     }
     if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
         $alabelisused = 1;
     }
 }
 if ($id == 4) {
     print '<td></td>';
Beispiel #4
0
 print '<table class="border" width="100%">';
 // Ref
 print '<tr><td class="fieldrequired" width="30%">' . $langs->trans("Ref") . '</td>';
 print '<td><input size="12" name="ref" value="' . $object->ref . '"></td></tr>';
 // Label
 print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td>';
 print '<td><input size="40" name="title" value="' . $object->title . '"></td></tr>';
 // Customer
 print '<tr><td>' . $langs->trans("ThirdParty") . '</td><td>';
 $filteronlist = '';
 if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
     $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
 }
 $text = $form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 1, 1);
 $texthelp = $langs->trans("IfNeedToUseOhterObjectKeepEmpty");
 print $form->textwithtooltip($text . ' ' . img_help(), $texthelp, 1, 0, '', '', 2);
 print '</td></tr>';
 // Visibility
 print '<tr><td>' . $langs->trans("Visibility") . '</td><td>';
 $array = array(0 => $langs->trans("PrivateProject"), 1 => $langs->trans("SharedProject"));
 print $form->selectarray('public', $array, $object->public);
 print '</td></tr>';
 // Status
 print '<tr><td>' . $langs->trans("Status") . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
 // Date start
 print '<tr><td>' . $langs->trans("DateStart") . '</td><td>';
 print $form->select_date($object->date_start ? $object->date_start : -1, 'projectstart', 0, 0, 0, '', 1, 0, 1);
 print ' &nbsp; &nbsp; <input type="checkbox" name="reportdate" value="yes" ';
 if ($comefromclone) {
     print ' checked ';
 }
Beispiel #5
0
        print '</form>';
        print "</td>\n";
        print "</tr>\n";
    }
    print '</table>';
}
$virtualdiffersfromphysical = 0;
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
    $virtualdiffersfromphysical = 1;
}
// According to increase/decrease stock options, virtual and physical stock may differs.
if ($virtualdiffersfromphysical) {
    print '<br>';
    print '<table class="noborder" width="100%">';
    print '<tr class="liste_titre">';
    print "  <td>" . $langs->trans("RuleForStockReplenishment") . " " . img_help('help', $langs->trans("VirtualDiffersFromPhysical")) . "</td>\n";
    print "  <td align=\"right\" width=\"160\">&nbsp;</td>\n";
    print '</tr>' . "\n";
    $var = !$var;
    print "<tr " . $bc[$var] . ">";
    print '<td width="60%">' . $langs->trans("UseVirtualStockByDefault") . '</td>';
    print '<td width="160" align="right">';
    print "<form method=\"post\" action=\"stock.php\">";
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
    print $form->selectyesno("STOCK_USE_VIRTUAL_STOCK", $conf->global->STOCK_USE_VIRTUAL_STOCK, 1);
    print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
    print '</form>';
    print "</td>\n";
    print "</tr>\n";
    print '</table>';
Beispiel #6
0
     } else {
         $valuetoshow = $langs->trans("Amount");
     }
     $align = 'right';
 }
 if ($fieldlist[$field] == 'localtax1_type') {
     $valuetoshow = $form->textwithtooltip($langs->trans("UseLocalTax") . " 2", $langs->trans("LocalTaxDesc"), 2, 1, img_help(1, ''));
     $align = "center";
     $sortable = 0;
 }
 if ($fieldlist[$field] == 'localtax1') {
     $valuetoshow = $langs->trans("Rate") . " 2";
     $sortable = 0;
 }
 if ($fieldlist[$field] == 'localtax2_type') {
     $valuetoshow = $form->textwithtooltip($langs->trans("UseLocalTax") . " 3", $langs->trans("LocalTaxDesc"), 2, 1, img_help(1, ''));
     $align = "center";
     $sortable = 0;
 }
 if ($fieldlist[$field] == 'localtax2') {
     $valuetoshow = $langs->trans("Rate") . " 3";
     $sortable = 0;
 }
 if ($fieldlist[$field] == 'organization') {
     $valuetoshow = $langs->trans("Organization");
 }
 if ($fieldlist[$field] == 'lang') {
     $valuetoshow = $langs->trans("Language");
 }
 if ($fieldlist[$field] == 'type') {
     $valuetoshow = $langs->trans("Type");
				$ul.append('<li class="category '+spc_line_class+'" catid="'+item.id+'"><a href="javascript:getArboSPC('+item.id+', $(\'li[catid='+item.id+']\') )">'+item.label+'</a></li>');
			});
			
			$.each(data.TProduct,function(i,item) {
				spc_line_class = (spc_line_class == 'even') ? 'odd' : 'even';
				$li = $('<li class="product '+spc_line_class+'" productid="'+item.id+'"><input type="checkbox" value="1" name="TProductSPCtoAdd['+item.id+']" fk_product="'+item.id+'" class="checkSPC" /> <a class="checkIt" href="javascript:;" onclick="checkProductSPC('+item.id+')" >'+item.label+'</a> <a class="addToForm" href="javascript:;" onclick="addProductSPC('+item.id+',\''+item.label.replace(/\'/g, "&quot;")+'\', \''+item.ref+'\')"><?php 
echo img_right($langs->trans('SelectThisProduct'));
?>
</a></li>');
				
				<?php 
if ($conf->global->SPC_DISPLAY_DESC_OF_PRODUCT) {
    ?>
					var desc = item.description.replace(/'/g, "\\'");
					var bubble = $("<?php 
    echo addslashes(img_help());
    ?>
");
					bubble.attr('title', desc);
					$li.append(bubble);
				<?php 
}
?>
				
				$ul.append($li);
			});
		}
		
		container.find('span.loading').remove();
		container.append($ul);
		
Beispiel #8
0
    /**
     *     Show a confirmation HTML form or AJAX popup
     *     @param  page        	   Url of page to call if confirmation is OK
     *     @param  title       	   title
     *     @param  question    	   question
     *     @param  action      	   action
     *	   @param  formquestion	   an array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
     * 	   @param  selectedchoice  "" or "no" or "yes"
     * 	   @param  useajax		   0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
     *     @param  height          Force height of box
     *     @return string          'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
     */
    function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
    {
        global $langs, $conf;
        $more = '';
        $formconfirm = '';
        $inputarray = array();
        if ($formquestion) {
            $more .= '<table class="nobordernopadding" width="100%">' . "\n";
            $more .= '<tr><td colspan="3" valign="top">' . $formquestion['text'] . '</td></tr>' . "\n";
            foreach ($formquestion as $key => $input) {
                if (is_array($input)) {
                    if ($input['type'] == 'text') {
                        $more .= '<tr><td valign="top">' . $input['label'] . '</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" size="' . $input['size'] . '" value="' . $input['value'] . '" /></td></tr>' . "\n";
                    } else {
                        if ($input['type'] == 'password') {
                            $more .= '<tr><td valign="top">' . $input['label'] . '</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" size="' . $input['size'] . '" value="' . $input['value'] . '" /></td></tr>' . "\n";
                        } else {
                            if ($input['type'] == 'select') {
                                $more .= '<tr><td valign="top">';
                                if (!empty($input['label'])) {
                                    $more .= $input['label'] . '</td><td valign="top" colspan="2" align="left">';
                                }
                                $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1);
                                $more .= '</td></tr>' . "\n";
                            } else {
                                if ($input['type'] == 'checkbox') {
                                    $more .= '<tr>';
                                    $more .= '<td valign="top">' . $input['label'] . ' </td><td valign="top" align="left">';
                                    $more .= '<input type="checkbox" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '"';
                                    if (!is_bool($input['value']) && $input['value'] != 'false') {
                                        $more .= ' checked="true"';
                                    }
                                    if (is_bool($input['value']) && $input['value']) {
                                        $more .= ' checked="true"';
                                    }
                                    if ($input['disabled']) {
                                        $more .= ' disabled="true"';
                                    }
                                    $more .= ' /></td>';
                                    $more .= '<td valign="top" align="left">&nbsp;</td>';
                                    $more .= '</tr>' . "\n";
                                } else {
                                    if ($input['type'] == 'radio') {
                                        $i = 0;
                                        foreach ($input['values'] as $selkey => $selval) {
                                            $more .= '<tr>';
                                            if ($i == 0) {
                                                $more .= '<td valign="top">' . $input['label'] . '</td>';
                                            } else {
                                                $more .= '<td>&nbsp;</td>';
                                            }
                                            $more .= '<td valign="top" width="20"><input type="radio" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"';
                                            if ($input['disabled']) {
                                                $more .= ' disabled="true"';
                                            }
                                            $more .= ' /></td>';
                                            $more .= '<td valign="top" align="left">';
                                            $more .= $selval;
                                            $more .= '</td></tr>' . "\n";
                                            $i++;
                                        }
                                    } else {
                                        if ($input['type'] == 'other') {
                                            $more .= '<tr><td valign="top">';
                                            if (!empty($input['label'])) {
                                                $more .= $input['label'] . '</td><td valign="top" colspan="2" align="left">';
                                            }
                                            $more .= $input['value'];
                                            $more .= '</td></tr>' . "\n";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    array_push($inputarray, $input['name']);
                }
            }
            $more .= '</table>' . "\n";
        }
        $formconfirm .= "\n<!-- begin form_confirm -->\n";
        if ($useajax && $conf->use_javascript_ajax) {
            $autoOpen = true;
            $dialogconfirm = 'dialog-confirm';
            if (!is_int($useajax)) {
                $button = $useajax;
                $useajax = 1;
                $autoOpen = false;
                $dialogconfirm .= '-' . $button;
            }
            $pageyes = $page . '&action=' . $action . '&confirm=yes';
            $pageno = $useajax == 2 ? $page . '&confirm=no' : '';
            // New code using jQuery only
            $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
            if (!empty($more)) {
                $formconfirm .= '<p>' . $more . '</p>';
            }
            $formconfirm .= img_help('', '') . ' ' . $question;
            $formconfirm .= '</div>' . "\n";
            $formconfirm .= '<script type="text/javascript">
            $(function() {
                var choice=\'ko\';
                var	$inputarray=' . json_encode($inputarray) . ';
                var button=\'' . $button . '\';
            	var dialogconfirm=\'' . $dialogconfirm . '\';

			    $( "#" + dialogconfirm ).dialog({
			        autoOpen: ' . ($autoOpen ? 'true' : 'false') . ',
			        resizable: false,
			        height:' . $height . ',
			        width:' . $width . ',
			        modal: true,
			        closeOnEscape: false,
			        close: function(event, ui) {
			             if (choice == \'ok\') {
			             	var options="";
			             	if ($inputarray.length>0) {
			             		$.each($inputarray, function() {
			             			var inputname = this;
			             			var inputvalue = $("#" + this).val();
			             			options += \'&\' + inputname + \'=\' + inputvalue;
			             		});
			             		//alert( options );
			             	}
			             	location.href=\'' . $pageyes . '\' + options;
			             }
                         ' . ($pageno ? 'if (choice == \'ko\') location.href=\'' . $pageno . '\';' : '') . '
		              },
			        buttons: {
			            \'' . dol_escape_js($langs->transnoentities("Yes")) . '\': function() {
			                choice=\'ok\';
			                $(this).dialog(\'close\');
			            },
			            \'' . dol_escape_js($langs->transnoentities("No")) . '\': function() {
			            	choice=\'ko\';
			                $(this).dialog(\'close\');
			            }
			        }
			    });

			    if (button.length > 0) {
			    	$( "#" + button ).click(function() {
			    		$( "#" + dialogconfirm ).dialog( \'open\' );
			    	});
			    }
			});
			</script>';
            $formconfirm .= "\n";
        } else {
            $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
            $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">';
            $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
            $formconfirm .= '<table width="100%" class="valid">' . "\n";
            // Ligne titre
            $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">' . img_picto('', 'recent') . ' ' . $title . '</td></tr>' . "\n";
            // Ligne formulaire
            if ($more) {
                $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">' . "\n";
                $formconfirm .= $more;
                $formconfirm .= '</td></tr>' . "\n";
            }
            // Ligne message
            $formconfirm .= '<tr class="valid">';
            $formconfirm .= '<td class="valid">' . $question . '</td>';
            $formconfirm .= '<td class="valid">';
            $newselectedchoice = empty($selectedchoice) ? "no" : $selectedchoice;
            $formconfirm .= $this->selectyesno("confirm", $newselectedchoice);
            $formconfirm .= '</td>';
            $formconfirm .= '<td class="valid" align="center"><input class="button" type="submit" value="' . $langs->trans("Validate") . '"></td>';
            $formconfirm .= '</tr>' . "\n";
            $formconfirm .= '</table>' . "\n";
            if (is_array($formquestion)) {
                foreach ($formquestion as $key => $input) {
                    if ($input['type'] == 'hidden') {
                        $formconfirm .= '<input type="hidden" name="' . $input['name'] . '" value="' . $input['value'] . '">';
                    }
                }
            }
            $formconfirm .= "</form>\n";
            $formconfirm .= '<br>';
        }
        $formconfirm .= "<!-- end form_confirm -->\n";
        return $formconfirm;
    }
Beispiel #9
0
    /**
     *     Show a confirmation HTML form or AJAX popup.
     *     Easiest way to use this is with useajax=1.
     *     If you use useajax='xxx', you must also add jquery code to trigger opening of box (with correct parameters)
     *     just after calling this method. For example:
     *       print '<script type="text/javascript">'."\n";
     *       print 'jQuery(document).ready(function() {'."\n";
     *       print 'jQuery(".xxxlink").click(function(e) { jQuery("#aparamid").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-xxx").dialog("open"); return false; });'."\n";
     *       print '});'."\n";
     *       print '</script>'."\n";
     *
     *     @param  	string		$page        	   	Url of page to call if confirmation is OK
     *     @param	string		$title       	   	Title
     *     @param	string		$question    	   	Question
     *     @param 	string		$action      	   	Action
     *	   @param  	array		$formquestion	   	An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
     * 	   @param  	string		$selectedchoice  	"" or "no" or "yes"
     * 	   @param  	int			$useajax		   	0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
     *     @param  	int			$height          	Force height of box
     *     @param	int			$width				Force width of bow
     *     @return 	string      	    			HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
     */
    function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
    {
        global $langs, $conf;
        global $useglobalvars;
        $more = '';
        $formconfirm = '';
        $inputok = array();
        $inputko = array();
        // Clean parameters
        $newselectedchoice = empty($selectedchoice) ? "no" : $selectedchoice;
        if (is_array($formquestion) && !empty($formquestion)) {
            // First add hidden fields and value
            foreach ($formquestion as $key => $input) {
                if (is_array($input) && !empty($input)) {
                    if ($input['type'] == 'hidden') {
                        $more .= '<input type="hidden" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . dol_escape_htmltag($input['value']) . '">' . "\n";
                    }
                }
            }
            // Now add questions
            $more .= '<table class="paddingrightonly" width="100%">' . "\n";
            $more .= '<tr><td colspan="3" valign="top">' . (!empty($formquestion['text']) ? $formquestion['text'] : '') . '</td></tr>' . "\n";
            foreach ($formquestion as $key => $input) {
                if (is_array($input) && !empty($input)) {
                    $size = !empty($input['size']) ? ' size="' . $input['size'] . '"' : '';
                    if ($input['type'] == 'text') {
                        $more .= '<tr><td valign="top">' . $input['label'] . '</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '" /></td></tr>' . "\n";
                    } else {
                        if ($input['type'] == 'password') {
                            $more .= '<tr><td valign="top">' . $input['label'] . '</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '" /></td></tr>' . "\n";
                        } else {
                            if ($input['type'] == 'select') {
                                $more .= '<tr><td valign="top">';
                                if (!empty($input['label'])) {
                                    $more .= $input['label'] . '</td><td valign="top" colspan="2" align="left">';
                                }
                                $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1);
                                $more .= '</td></tr>' . "\n";
                            } else {
                                if ($input['type'] == 'checkbox') {
                                    $more .= '<tr>';
                                    $more .= '<td valign="top">' . $input['label'] . ' </td><td valign="top" align="left">';
                                    $more .= '<input type="checkbox" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '"';
                                    if (!is_bool($input['value']) && $input['value'] != 'false') {
                                        $more .= ' checked="checked"';
                                    }
                                    if (is_bool($input['value']) && $input['value']) {
                                        $more .= ' checked="checked"';
                                    }
                                    if (isset($input['disabled'])) {
                                        $more .= ' disabled="disabled"';
                                    }
                                    $more .= ' /></td>';
                                    $more .= '<td valign="top" align="left">&nbsp;</td>';
                                    $more .= '</tr>' . "\n";
                                } else {
                                    if ($input['type'] == 'radio') {
                                        $i = 0;
                                        foreach ($input['values'] as $selkey => $selval) {
                                            $more .= '<tr>';
                                            if ($i == 0) {
                                                $more .= '<td valign="top">' . $input['label'] . '</td>';
                                            } else {
                                                $more .= '<td>&nbsp;</td>';
                                            }
                                            $more .= '<td valign="top" width="20"><input type="radio" class="flat" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"';
                                            if ($input['disabled']) {
                                                $more .= ' disabled="disabled"';
                                            }
                                            $more .= ' /></td>';
                                            $more .= '<td valign="top" align="left">';
                                            $more .= $selval;
                                            $more .= '</td></tr>' . "\n";
                                            $i++;
                                        }
                                    } else {
                                        if ($input['type'] == 'other') {
                                            $more .= '<tr><td valign="top">';
                                            if (!empty($input['label'])) {
                                                $more .= $input['label'] . '</td><td valign="top" colspan="2" align="left">';
                                            }
                                            $more .= $input['value'];
                                            $more .= '</td></tr>' . "\n";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $more .= '</table>' . "\n";
        }
        // JQUI method dialog is broken with jmobile, we use standard HTML.
        // Note: When using dol_use_jmobile or no js, you must also check code for button use a GET url with action=xxx and check that you also output the confirm code when action=xxx
        // See page product/card.php for example
        if (!empty($conf->dol_use_jmobile)) {
            $useajax = 0;
        }
        if (empty($conf->use_javascript_ajax)) {
            $useajax = 0;
        }
        if ($useajax) {
            $autoOpen = true;
            $dialogconfirm = 'dialog-confirm';
            $button = '';
            if (!is_numeric($useajax)) {
                $button = $useajax;
                $useajax = 1;
                $autoOpen = false;
                $dialogconfirm .= '-' . $button;
            }
            $pageyes = $page . (preg_match('/\\?/', $page) ? '&' : '?') . 'action=' . $action . '&confirm=yes';
            $pageno = $useajax == 2 ? $page . (preg_match('/\\?/', $page) ? '&' : '?') . 'confirm=no' : '';
            // Add input fields into list of fields to read during submit (inputok and inputko)
            if (is_array($formquestion)) {
                foreach ($formquestion as $key => $input) {
                    if (isset($input['name'])) {
                        array_push($inputok, $input['name']);
                    }
                    if (isset($input['inputko']) && $input['inputko'] == 1) {
                        array_push($inputko, $input['name']);
                    }
                }
            }
            // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template
            $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
            if (!empty($more)) {
                $formconfirm .= '<p>' . $more . '</p>';
            }
            $formconfirm .= img_help('', '') . ' ' . $question;
            $formconfirm .= '</div>';
            $formconfirm .= '<script type="text/javascript">';
            $formconfirm .= '
            $(function() {
            	$( "#' . $dialogconfirm . '" ).dialog({
                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
            if ($newselectedchoice == 'no') {
                $formconfirm .= '
						open: function() {
            				$(this).parent().find("button.ui-button:eq(1)").focus();
						},';
            }
            $formconfirm .= '
                    resizable: false,
                    height: "' . $height . '",
                    width: "' . $width . '",
                    modal: true,
                    closeOnEscape: false,
                    buttons: {
                        "' . dol_escape_js($langs->transnoentities("Yes")) . '": function() {
                        	var options="";
                        	var inputok = ' . json_encode($inputok) . ';
                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
                         	if (inputok.length>0) {
                         		$.each(inputok, function(i, inputname) {
                         			var more = "";
                         			if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; }
                         		    if ($("#" + inputname).attr("type") == "radio") { more = ":checked"; }
                         			var inputvalue = $("#" + inputname + more).val();
                         			if (typeof inputvalue == "undefined") { inputvalue=""; }
                         			options += "&" + inputname + "=" + inputvalue;
                         		});
                         	}
                         	var urljump = pageyes + (pageyes.indexOf("?") < 0 ? "?" : "") + options;
                         	//alert(urljump);
            				if (pageyes.length > 0) { location.href = urljump; }
                            $(this).dialog("close");
                        },
                        "' . dol_escape_js($langs->transnoentities("No")) . '": function() {
                        	var options = "";
                         	var inputko = ' . json_encode($inputko) . ';
                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
                         	if (inputko.length>0) {
                         		$.each(inputko, function(i, inputname) {
                         			var more = "";
                         			if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; }
                         			var inputvalue = $("#" + inputname + more).val();
                         			if (typeof inputvalue == "undefined") { inputvalue=""; }
                         			options += "&" + inputname + "=" + inputvalue;
                         		});
                         	}
                         	var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options;
                         	//alert(urljump);
            				if (pageno.length > 0) { location.href = urljump; }
                            $(this).dialog("close");
                        }
                    }
                });

            	var button = "' . $button . '";
            	if (button.length > 0) {
                	$( "#" + button ).click(function() {
                		$("#' . $dialogconfirm . '").dialog("open");
        			});
                }
            });
            </script>';
        } else {
            $formconfirm .= "\n<!-- begin form_confirm page=" . $page . " -->\n";
            $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
            $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">';
            $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
            $formconfirm .= '<table width="100%" class="valid">' . "\n";
            // Line title
            $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">' . img_picto('', 'recent') . ' ' . $title . '</td></tr>' . "\n";
            // Line form fields
            if ($more) {
                $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">' . "\n";
                $formconfirm .= $more;
                $formconfirm .= '</td></tr>' . "\n";
            }
            // Line with question
            $formconfirm .= '<tr class="valid">';
            $formconfirm .= '<td class="valid">' . $question . '</td>';
            $formconfirm .= '<td class="valid">';
            $formconfirm .= $this->selectyesno("confirm", $newselectedchoice);
            $formconfirm .= '</td>';
            $formconfirm .= '<td class="valid" align="center"><input class="button" type="submit" value="' . $langs->trans("Validate") . '"></td>';
            $formconfirm .= '</tr>' . "\n";
            $formconfirm .= '</table>' . "\n";
            $formconfirm .= "</form>\n";
            $formconfirm .= '<br>';
            $formconfirm .= "<!-- end form_confirm -->\n";
        }
        return $formconfirm;
    }
Beispiel #10
0
        $defaultref = $modProject->getNextValue($soc,$project);
    }

    if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';

    // Ref
    print '<tr><td><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$defaultref).'"></td></tr>';

    // Label
    print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="30" type="text" name="title" value="'.$_POST["title"].'"></td></tr>';

    // Customer
    print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
    $text=$html->select_company(GETPOST("socid"),'socid','',1,1);
    $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
    print $html->textwithtooltip($text.' '.img_help(),$texthelp,1);
    print '</td></tr>';

    // Public
    print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
    $array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));
    print $html->selectarray('public',$array,$project->public);
    print '</td></tr>';

    // Date start
    print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
    print $html->select_date('','project');
    print '</td></tr>';

    // Date end
    print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
Beispiel #11
0
 /**
  * 	Show a text with a picto and a tooltip on picto
  *
  * 	@param	string	$text				Text to show
  * 	@param  string	$htmltext	     	Content of tooltip
  * 	@param	int		$direction			1=Icon is after text, -1=Icon is before text, 0=no icon
  * 	@param	string	$type				Type of picto (info, help, warning, superadmin...)
  *  @param  string	$extracss           Add a CSS style to td tags
  *  @param  int		$noencodehtmltext   Do not encode into html entity the htmltext
  * 	@return	string						HTML code of text, picto, tooltip
  */
 function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0)
 {
     global $conf;
     if ("{$type}" == "0") {
         $type = 'info';
     }
     // For backward compatibility
     $alt = '';
     // If info or help with no javascript, show only text
     if (empty($conf->use_javascript_ajax)) {
         if ($type == 'info' || $type == 'help') {
             return $text;
         } else {
             $alt = $htmltext;
             $htmltext = '';
         }
     }
     // If info or help with smartphone, show only text
     if (!empty($conf->browser->phone)) {
         if ($type == 'info' || $type == 'help') {
             return $text;
         }
     }
     // Info or help
     if ($type == 'info') {
         $img = img_help(0, $alt);
     }
     if ($type == 'help' || $type == 1) {
         $img = img_help(1, $alt);
     }
     if ($type == 'superadmin') {
         $img = img_picto($alt, "redstar");
     }
     if ($type == 'admin') {
         $img = img_picto($alt, "star");
     }
     // Warnings
     if ($type == 'warning') {
         $img = img_warning($alt);
     }
     return $this->textwithtooltip($text, $htmltext, 2, $direction, $img, $extracss, 0, '', $noencodehtmltext);
 }
Beispiel #12
0
" title="<?php 
echo dol_escape_htmltag($title);
?>
" style="display: none;">
	<?php 
if (!empty($more)) {
    ?>
	<p><?php 
    echo $more;
    ?>
</p>
	<?php 
}
?>
	<?php 
echo img_help('', '') . ' ' . $question;
?>
</div>
<script type="text/javascript">

/*
 * Warning: function is loaded once and not overwritten if loaded by another ajax page.
 * So if we need inputok/ko and pageyes/no to be different according to ajax calls (to have several confirm box loaded
 * from different ajax parts of page, we must place such variables outside of function. For this $useglobalvars must be set to 1.
 */

<?php 
if (!empty($useglobalvars)) {
    ?>
var inputok=<?php 
    echo json_encode($inputok);