forked from extern/egroupware
fixed AND tested et_media
This commit is contained in:
commit
a52c23c0dc
42
etemplate/doc/et_media/inc/class.bo_et_media.inc.php
Normal file
42
etemplate/doc/et_media/inc/class.bo_et_media.inc.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare editable Templates - Example media database (et_media)
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage et_media
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.so_sql.inc.php');
|
||||
|
||||
/**
|
||||
* Business object for et_media
|
||||
*/
|
||||
class bo_et_media extends so_sql
|
||||
{
|
||||
/**
|
||||
* Availible media types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $types = array(
|
||||
'' => 'Select one ...',
|
||||
'cd' => 'Compact Disc',
|
||||
'dvd' => 'DVD',
|
||||
'book' => 'Book',
|
||||
'video' => 'Video Tape'
|
||||
);
|
||||
/**
|
||||
* Constructor initialising so_sql
|
||||
*
|
||||
* @return so_et_media
|
||||
*/
|
||||
function bo_et_media()
|
||||
{
|
||||
$this->so_sql('et_media','egw_et_media');
|
||||
$this->empty_on_write = "''";
|
||||
}
|
||||
}
|
137
etemplate/doc/et_media/inc/class.ui_et_media.inc.php
Normal file
137
etemplate/doc/et_media/inc/class.ui_et_media.inc.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare editable Templates - Example media database (et_media)
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage et_media
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
include_once(EGW_INCLUDE_ROOT . '/et_media/inc/class.bo_et_media.inc.php');
|
||||
|
||||
class ui_et_media extends bo_et_media
|
||||
{
|
||||
/**
|
||||
* Public functions callable via menuaction
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $public_functions = array(
|
||||
'edit' => True,
|
||||
'writeLangFile' => True
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return ui_et_media
|
||||
*/
|
||||
function ui_et_media()
|
||||
{
|
||||
$this->bo_et_media(); // calling the constructor of the extended bo object
|
||||
|
||||
$this->tmpl =& CreateObject('etemplate.etemplate','et_media.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a media database entry
|
||||
*
|
||||
* @param array $content=null
|
||||
* @param string $msg=''
|
||||
*/
|
||||
function edit($content=null,$msg = '')
|
||||
{
|
||||
if (is_array($content)) // not first call from index
|
||||
{
|
||||
if ($content['id'] > 0)
|
||||
{
|
||||
$this->read($content);
|
||||
}
|
||||
//echo "<p>edit: content ="; _debug_array($content);
|
||||
$this->data_merge($content);
|
||||
//echo "<p>edit: data ="; _debug_array($this->data);
|
||||
|
||||
if (isset($content['save']))
|
||||
{
|
||||
$msg .= !$this->save() ? lang('Entry saved') : lang('Error: while saving !!!');
|
||||
}
|
||||
elseif (isset($content['read']))
|
||||
{
|
||||
unset($content['id']);
|
||||
unset($content['read']);
|
||||
$found = $this->search($content,False,'name,author');
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
$msg .= lang('Nothing matched search criteria !!!');
|
||||
}
|
||||
elseif (count($found) == 1)
|
||||
{
|
||||
$this->init($found[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->show($found);
|
||||
return;
|
||||
}
|
||||
}
|
||||
elseif (isset($content['cancel']))
|
||||
{
|
||||
$this->init();
|
||||
}
|
||||
elseif (isset($content['delete']))
|
||||
{
|
||||
$this->delete();
|
||||
$this->init();
|
||||
}
|
||||
elseif (isset($content['entry']['edit']))
|
||||
{
|
||||
list($id) = each($content['entry']['edit']);
|
||||
if ($id > 0)
|
||||
{
|
||||
$this->read(array('id' => $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now we filling the content array for the next call to etemplate.exec
|
||||
|
||||
$content = $this->data + array(
|
||||
'msg' => $msg
|
||||
);
|
||||
$sel_options = array(
|
||||
'type' => $this->types
|
||||
);
|
||||
$no_button = array(
|
||||
'delete' => !$this->data[$this->db_key_cols[$this->autoinc_id]]
|
||||
);
|
||||
$this->tmpl->exec('et_media.ui_et_media.edit',$content,$sel_options,$no_button,array(
|
||||
'id' => $this->data['id']
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Showing entries from the media database
|
||||
*
|
||||
* @param array $found
|
||||
*/
|
||||
function show($found=null)
|
||||
{
|
||||
if (!is_array($found) || !count($found))
|
||||
{
|
||||
$this->edit();
|
||||
return;
|
||||
}
|
||||
array_unshift($found,false); // change the array to start with index 1
|
||||
$content = array(
|
||||
'msg' => lang('%1 matches on search criteria',count($found)),
|
||||
'entry' => $found,
|
||||
);
|
||||
$this->tmpl->read('et_media.show');
|
||||
|
||||
$this->tmpl->exec('et_media.ui_et_media.edit',$content);
|
||||
}
|
||||
}
|
22
etemplate/doc/et_media/index.php
Normal file
22
etemplate/doc/et_media/index.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare editable Templates - Example media database (et_media)
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage et_media
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
$GLOBALS['egw_info'] = array(
|
||||
'flags' => array(
|
||||
'currentapp' => 'et_media',
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
),
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=et_media.ui_et_media.edit');
|
42
etemplate/doc/et_media/setup/setup.inc.php
Normal file
42
etemplate/doc/et_media/setup/setup.inc.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Editable Templates: Example App of the tutorial *
|
||||
* http://www.egroupware.org *
|
||||
" Written by Ralf Becker <RalfBecker@outdoor-training.de> *
|
||||
* -------------------------------------------- *
|
||||
* 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. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$setup_info['et_media']['name'] = 'et_media';
|
||||
$setup_info['et_media']['title'] = 'eT-Media';
|
||||
$setup_info['et_media']['version'] = '1.2';
|
||||
$setup_info['et_media']['app_order'] = 100; // at the end
|
||||
$setup_info['et_media']['tables'] = array('egw_et_media');
|
||||
$setup_info['et_media']['enable'] = 1;
|
||||
$setup_info['et_media']['author'] =
|
||||
$setup_info['et_media']['maintainer'] = array(
|
||||
'name' => 'Ralf Becker',
|
||||
'email' => 'ralfbecker@outdoor-training.de'
|
||||
);
|
||||
$setup_info['et_media']['license'] = 'GPL';
|
||||
$setup_info['et_media']['description'] =
|
||||
'<b>eTemplates</b> are a new widget-based template system for eGroupWare.<br>
|
||||
<b>eT-Media</b> is the example application of the eTemplates tutorial.';
|
||||
$setup_info['et_media']['note'] =
|
||||
'For more information check out the <a href="etemplate/doc/etemplate.html" target="_blank">Tutorial</a>
|
||||
and the <a href="etemplate/doc/referenz.html" target="_blank">Referenz Documentation</a>.';
|
||||
|
||||
/* Dependencies for this app to work */
|
||||
$setup_info['et_media']['depends'][] = array(
|
||||
'appname' => 'phpgwapi',
|
||||
'versions' => Array('1.2','1.3','1.4')
|
||||
);
|
||||
$setup_info['et_media']['depends'][] = array(
|
||||
'appname' => 'etemplate',
|
||||
'versions' => Array('1.2','1.3','1.4')
|
||||
);
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user