dolibarr  7.0.0-beta
actions_adherentcard_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  * Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
25 include_once DOL_DOCUMENT_ROOT.'/adherents/canvas/actions_adherentcard_common.class.php';
26 
32 {
42  function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
43  {
44  $this->db = $db;
45  $this->dirmodule = $dirmodule;
46  $this->targetmodule = $targetmodule;
47  $this->canvas = $canvas;
48  $this->card = $card;
49  }
50 
57  private function getTitle($action)
58  {
59  global $langs,$conf;
60 
61  $out='';
62 
63  if ($action == 'view') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
64  if ($action == 'edit') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
65  if ($action == 'create') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
66 
67  return $out;
68  }
69 
77  function assign_values(&$action, $id)
78  {
79  global $limit, $offset, $sortfield, $sortorder;
80  global $conf, $db, $langs, $user;
81  global $form;
82 
83  $ret = $this->getObject($id);
84 
85  parent::assign_values($action, $id);
86 
87  $this->tpl['title'] = $this->getTitle($action);
88  $this->tpl['error'] = $this->error;
89  $this->tpl['errors']= $this->errors;
90 
91  if ($action == 'view')
92  {
93  // Card header
94  $head = member_prepare_head($this->object);
95  $title = $this->getTitle($action);
96 
97  $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
98  $this->tpl['showend']=dol_get_fiche_end();
99 
100  $objsoc = new Societe($db);
101  $objsoc->fetch($this->object->socid);
102 
103  $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);
104 
105  $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
106  }
107  else
108  {
109  // Confirm delete contact
110  if ($action == 'delete' && $user->rights->adherent->supprimer)
111  {
112  $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteAdherent"),$langs->trans("ConfirmDeleteAdherent"),"confirm_delete",'',0,1);
113  }
114  }
115 
116  if ($action == 'list')
117  {
118  $this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
119  }
120 
121  }
122 
123 
133  function LoadListDatas($limit, $offset, $sortfield, $sortorder)
134  {
135  global $conf, $langs;
136 
137  //$this->getFieldList();
138 
139  $this->list_datas = array();
140  }
141 }
142 
getTitle($action)
Return the title of card.
Classe permettant la gestion des adherents par defaut.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
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
Class to manage third parties objects (customers, suppliers, prospects...)
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
Class to maage members using default canvas.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
assign_values(&$action, $id)
Assign custom values for canvas.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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)
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
LoadListDatas($limit, $offset, $sortfield, $sortorder)
Fetch datas list and save into ->list_datas.