Dotclear

source: plugins/myForms/trunk/TplDatabase.php @ 728

Revision 728, 1.8 KB checked in by Oaz, 15 years ago (diff)

new plugin : myForms (create custom forms)

Line 
1<?php
2# ***** BEGIN LICENSE BLOCK *****
3# Copyright (c) 2009 Olivier Azeau and contributors. All rights  reserved.
4#
5# This 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 2 of the License, or
8# (at your option) any later version.
9#
10# This 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 DotClear; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18#
19# ***** END LICENSE BLOCK *****
20
21require_once("Record.php");
22
23$core->tpl->addBlock('myformsInsertRecord',array('MyFormsTplDatabase','InsertRecord'));
24$core->tpl->addBlock('myformsInsertOrUpdateRecord',array('MyFormsTplDatabase','InsertOrUpdateRecord'));
25$core->tpl->addBlock('myformsRecordField',array('MyFormsTplDatabase','RecordField'));
26
27class MyFormsTplDatabase
28{
29  public static function InsertRecord($attr,$content)
30  {
31    return '<?php $record=new MyFormsRecord("'.$attr['table'].'"); ?>'.$content.'<?php MyForms::execute( $record->insert() ); ?>';
32  }
33 
34  public static function InsertOrUpdateRecord($attr,$content)
35  {
36    return '<?php $record=new MyFormsRecord("'.$attr['table'].'"); ?>'.$content.'<?php MyForms::execute( $record->insertOrUpdate() ); ?>';
37  }
38 
39  public static function RecordField($attr,$content)
40  {
41    return '<?php ob_start(); ?>'.$content.'<?php $record->set("'.$attr['name'].'",ob_get_clean(),'.(isset($attr['key'])?'true':'false').'); ?>';
42  }
43 
44}
45?>
Note: See TracBrowser for help on using the repository browser.

Sites map