dolibarr  9.0.0
actions_contactcard_default.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.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 
69  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
77  function assign_values(&$action, $id)
78  {
79  // phpcs:enable
80  global $limit, $offset, $sortfield, $sortorder;
81  global $conf, $db, $langs, $user;
82  global $form;
83 
84  $ret = $this->getObject($id);
85 
86  parent::assign_values($action, $id);
87 
88  $this->tpl['title'] = $this->getTitle($action);
89  $this->tpl['error'] = $this->error;
90  $this->tpl['errors']= $this->errors;
91 
92  if ($action == 'view')
93  {
94  // Card header
95  $head = contact_prepare_head($this->object);
96  $title = $this->getTitle($action);
97 
98  $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'contact');
99  $this->tpl['showend']=dol_get_fiche_end();
100 
101  $objsoc = new Societe($db);
102  $objsoc->fetch($this->object->socid);
103 
104  $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);
105 
106  $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
107  }
108  else
109  {
110  // Confirm delete contact
111  if ($action == 'delete' && $user->rights->societe->contact->supprimer)
112  {
113  $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
114  }
115  }
116 
117  if ($action == 'list')
118  {
119  $this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
120  }
121  }
122 
123 
124  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
134  function LoadListDatas($limit, $offset, $sortfield, $sortorder)
135  {
136  // phpcs:enable
137  global $conf, $langs;
138 
139  //$this->getFieldList();
140 
141  $this->list_datas = array();
142  }
143 }
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
show_actions_todo($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='')
Show html area with actions to do.
__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.
Classe permettant la gestion des contacts par defaut.
contact_prepare_head(Contact $object)
Prepare array with list of tabs.
Definition: contact.lib.php:33
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)