2
0
forked from Wavyzz/dolibarr
Files
dolibarr-fork/dev/skeletons/skeleton_page.php
2010-02-28 15:13:27 +00:00

94 lines
2.4 KiB
PHP

<?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file dev/skeletons/skeleton_page.php
* \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example of a php page
* \version $Id$
* \author Put author name here
* \remarks Put here some comments
*/
// Change this following line to use the correct relative path (../, ../../, etc)
require("../main.inc.php");
// Change this following line to use the correct relative path from htdocs (do not remove DOL_DOCUMENT_ROOT)
require_once(DOL_DOCUMENT_ROOT."/skeleton/skeleton_class.class.php");
// Load traductions files requiredby by page
$langs->load("companies");
$langs->load("other");
// Get parameters
$myparam = isset($_GET["myparam"])?$_GET["myparam"]:'';
// Protection if external user
if ($user->societe_id > 0)
{
//accessforbidden();
}
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
if ($_REQUEST["action"] == 'add')
{
$myobject=new Skeleton_class($db);
$myobject->prop1=$_POST["field1"];
$myobject->prop2=$_POST["field2"];
$result=$myobject->create($user);
if ($result > 0)
{
// Creation OK
}
{
// Creation KO
$mesg=$myobject->error;
}
}
/***************************************************
* PAGE
*
* Put here all code to build page
****************************************************/
llxHeader('MyPageName','','');
$form=new Form($db);
// Put here content of your page
// ...
// End of page
$db->close();
llxFooter('$Date$ - $Revision$');
?>