dolibarr  7.0.0-beta
actions_contactcard_default.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
3  * Copyright (C) 2011 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 
24 include_once DOL_DOCUMENT_ROOT.'/contact/canvas/actions_contactcard_common.class.php';
25 
31 {
41  function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
42  {
43  $this->db = $db;
44  $this->dirmodule = $dirmodule;
45  $this->targetmodule = $targetmodule;
46  $this->canvas = $canvas;
47  $this->card = $card;
48  }
49 
56  private function getTitle($action)
57  {
58  global $langs;
59 
60  $out='';
61 
62  if ($action == 'view') $out.= (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contact") : $langs->trans("ContactAddress"));
63  if ($action == 'edit') $out.= (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("EditContact") : $langs->trans("EditContactAddress"));
64  if ($action == 'create') $out.= (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
65 
66  return $out;
67  }
68 
76  function assign_values(&$action, $id)
77  {
78  global $limit, $offset, $sortfield, $sortorder;
79  global $conf, $db, $langs, $user;
80  global $form;
81 
82  $ret = $this->getObject($id);
83 
84  parent::assign_values($action, $id);
85 
86  $this->tpl['title'] = $this->getTitle($action);
87  $this->tpl['error'] = $this->error;
88  $this->tpl['errors']= $this->errors;
89 
90  if ($action == 'view')
91  {
92  // Card header
93  $head = contact_prepare_head($this->object);
94  $title = $this->getTitle($action);
95 
96  $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'contact');
97  $this->tpl['showend']=dol_get_fiche_end();
98 
99  $objsoc = new Societe($db);
100  $objsoc->fetch($this->object->socid);
101 
102  $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);
103 
104  $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
105  }
106  else
107  {
108  // Confirm delete contact
109  if ($action == 'delete' && $user->rights->societe->contact->supprimer)
110  {
111  $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
112  }
113  }
114 
115  if ($action == 'list')
116  {
117  $this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
118  }
119 
120  }
121 
122 
132  function LoadListDatas($limit, $offset, $sortfield, $sortorder)
133  {
134  global $conf, $langs;
135 
136  //$this->getFieldList();
137 
138  $this->list_datas = array();
139  }
140 }
141 
show_actions_todo($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='')
Show html area with actions to do.
if(empty($reshook)) $form
View.
Definition: perms.php:103
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
LoadListDatas($limit, $offset, $sortfield, $sortorder)
Fetch datas list and save into ->list_datas.
Class to manage third parties objects (customers, suppliers, prospects...)
getTitle($action)
Return the title of card.
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
Classe permettant la gestion des contacts par defaut.
contact_prepare_head(Contact $object)
Prepare array with list of tabs.
Definition: contact.lib.php:33
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
Classe permettant la gestion des contacts par defaut.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
assign_values(&$action, $id)
Assign custom values for canvas.
show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions (done or not, ignore the name of function)