dolibarr  7.0.0-beta
bloc_showhide.tpl.php
1 <?php
2 /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
3  * Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 // Protection to avoid direct call of template
20 if (empty($blocname))
21 {
22  print "Error, template page can't be called as URL";
23  exit;
24 }
25 
26 $hide = true; // Hide by default
27 if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false);
28 if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false);
29 
30 ?>
31 <!-- BEGIN PHP TEMPLATE bloc_showhide.tpl.php -->
32 
33 <?php
34 print '<script type="text/javascript">'."\n";
35 print '$(document).ready(function() {'."\n";
36 print '$("#hide-'.$blocname.'").click(function(){'."\n";
37 print ' setShowHide(0);'."\n";
38 print ' $("#'.$blocname.'_bloc").hide("blind", {direction: "vertical"}, 300).removeClass("nohideobject");'."\n";
39 print ' $(this).hide();'."\n";
40 print ' $("#show-'.$blocname.'").show();'."\n";
41 print '});'."\n";
42 
43 print '$("#show-'.$blocname.'").click(function(){'."\n";
44 print ' setShowHide(1);'."\n";
45 print ' $("#'.$blocname.'").show("blind", {direction: "vertical"}, 300).addClass("nohideobject");'."\n";
46 print ' $(this).hide();'."\n";
47 print ' $("#hide-'.$blocname.'").show();'."\n";
48 print '});'."\n";
49 
50 print 'function setShowHide(status) {'."\n";
51 print ' var id = '.$object->id.";\n";
52 print " var element = '".$object->element."';\n";
53 print " var htmlelement = '".$blocname."';\n";
54 print ' var type = "showhide";'."\n";
55 print ' $.get("'.dol_buildpath('/core/ajax/extraparams.php', 1);
56 print '?id="+id+"&element="+element+"&htmlelement="+htmlelement+"&type="+type+"&value="+status);'."\n";
57 print '}'."\n";
58 
59 print '});'."\n";
60 print '</script>'."\n";
61 
62 print '<div style="float:right; position: relative; top: 3px; right:5px;" id="hide-'.$blocname.'"';
63 print ' class="linkobject'.($hide ? ' hideobject' : '').'">'.img_picto('', '1uparrow.png').'</div>'."\n";
64 print '<div style="float:right; position: relative; top: 3px; right:5px;" id="show-'.$blocname.'"';
65 print ' class="linkobject'.($hide ? '' : ' hideobject').'">'.img_picto('', '1downarrow.png').'</div>'."\n";
66 print '<div id="'.$blocname.'_title" class="liste_titre">'.$title.'</div>'."\n";
67 print '<div id="'.$blocname.'_bloc" class="'.($hide ? 'hideobject' : 'nohideobject').'">'."\n";
68 
69 include DOL_DOCUMENT_ROOT.'/core/tpl/'.$blocname.'.tpl.php';
70 print '</div><br>';
71 ?>
72 <!-- END PHP TEMPLATE BLOC SHOW/HIDE -->
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
print
Draft customers invoices.
Definition: index.php:91