<?php require '../config.php'; dol_include_once('/ideabox/class/ideabox.class.php'); $get = GETPOST('get'); $put = GETPOST('put'); switch ($put) { case 'item': /* $ideaItem=new TIdeaboxItem; $ideaItem->load($PDOdb, $id); $ideaItem->set_values($_REQUEST); $ideaItem->save($PDOdb); */ $PDOdb = new TPDOdb(); //$PDOdb->debug = true; $i = new TIdeabox(); $i->load($PDOdb, GETPOST('fk_ideabox')); // var_dump($i); $k = $i->addChild($PDOdb, 'TIdeaboxItem'); $i->TIdeaboxItem[$k]->set_values($_REQUEST); $i->save($PDOdb); break; default: break; }
case 'deleteItem': $ideaItem = new TIdeaboxItem(); $ideaItem->load($PDOdb, $id); if ($user->rights->ideabox->create < 1 && $ideaItem->fk_user != $user->id) { accessforbidden(); } $idea = new TIdeabox(); $idea->load($PDOdb, $ideaItem->fk_ideabox); $ideaItem->delete($PDOdb); setEventMessage($langs->trans('IdeaboxItemDeleteControlEvent')); header('Location: ' . dol_buildpath('/ideabox/ideabox.php', 2) . '?id=' . $idea->getId() . '&action=view'); break; case 'liste': default: $idea = new TIdeabox(); $idea->load($PDOdb, $id); _liste($PDOdb, $idea, 'view'); break; } function _fiche(&$PDOdb, &$idea, $mode = 'view', $editValue = false) { global $db, $langs, $user; llxHeader('', $langs->trans('IdeaboxAddItem'), '', ''); /******/ $TBS = new TTemplateTBS(); $TBS->TBS->protect = false; $TBS->TBS->noerr = true; $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'POST'); $form->Set_typeaff($mode); echo $form->hidden('id', $idea->getId()); echo $form->hidden('action', 'save');