egroupware/addressbook/sitemgr/class.module_registration_form.inc.php

127 lines
4.0 KiB
PHP
Raw Normal View History

<?php
/**
2011-01-28 17:00:10 +01:00
* Registration - Sitemgr registration form
*
* @link http://www.egroupware.org
2011-01-28 17:00:10 +01:00
* @author Nathan Gray
* @package registration
* @copyright (c) 2010 Nathan Gray
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
2011-01-28 17:00:10 +01:00
* SiteMgr registration form
*/
2011-01-28 17:00:10 +01:00
class module_registration_form extends sitemgr_module
{
/**
* Constructor
*
*/
function __construct()
{
2011-01-28 17:00:10 +01:00
$this->i18n = true;
$this->arguments = array(); // get's set in get_user_interface
2011-01-28 17:00:10 +01:00
$this->title = lang('Registration');
$this->description = lang('This module displays a registration form, and sends a confirmation email.');
2011-01-28 17:00:10 +01:00
$this->etemplate_method = 'registration.registration_sitemgr.display';
}
/**
2011-01-28 17:00:10 +01:00
* Reimplemented to add the registration translations
*
* @return array
*/
function get_user_interface()
{
2011-01-28 17:00:10 +01:00
$GLOBALS['egw']->translation->add_app('registration');
$uicontacts = new addressbook_ui();
$default = $fields = array(
'org_name' => lang('Company'),
'org_unit' => lang('Department'),
'n_fn' => lang('Prefix').', '.lang('Firstname').' + '.lang('Lastname'),
'sep1' => '----------------------------',
2011-01-28 17:00:10 +01:00
// 'email' => lang('email'), // Required, so don't even make it optional
'tel_work' => lang('work phone'),
'tel_cell' => lang('mobile phone'),
'tel_fax' => lang('fax'),
'tel_home' => lang('home phone'),
'url' => lang('url'),
'sep2' => '----------------------------',
'adr_one_street' => lang('street'),
'adr_one_street2' => lang('address line 2'),
'adr_one_locality' => lang('city').' + '.lang('zip code'),
'sep3' => '----------------------------',
);
foreach($uicontacts->customfields as $name => $data)
{
$fields['#'.$name] = $data['label'];
}
$fields += array(
'sep4' => '----------------------------',
'note' => lang('message'),
'sep5' => '----------------------------',
'captcha' => lang('Verification'),
);
2011-01-28 17:00:10 +01:00
$register_for = registration_bo::register_apps_list();
// Only real (not sitemgr) admins can select account
if(!$GLOBALS['egw_info']['user']['apps']['admin'])
{
unset($register_for['admin']);
}
$this->arguments = array(
2011-01-28 17:00:10 +01:00
'register_for' => array(
'type' => 'select',
2011-01-28 17:00:10 +01:00
'label' => 'What are they registering for',
'options'=> $register_for
),
'pending_addressbook' => array(
'type' => 'select',
'label' => lang('Addressbook the contacts should be saved to before they are confirmed.').' ('.lang('The anonymous user needs add rights for it!').')',
'options' => array(
'' => lang('None'),
2011-01-28 17:00:10 +01:00
)+registration_bo::get_allowed_addressbooks(registration_bo::PENDING)
),
2011-01-28 17:00:10 +01:00
'confirmed_addressbook' => array(
'type' => 'select',
'label' => lang('Confirmed addressbook.').' ('.lang('The anonymous user needs add rights for it!').')',
'options' => array(
'' => lang('None'),
)+registration_bo::get_allowed_addressbooks(registration_bo::CONFIRMED)
2007-06-06 10:18:45 +02:00
),
2011-01-28 17:00:10 +01:00
'expiry' => array(
'type' => 'textfield',
2011-01-28 17:00:10 +01:00
'label' => lang('How long to confirm before registration expires? (hours)'),
'params' => array('size' => 5),
'default' => 2,
2007-06-06 10:18:45 +02:00
),
2011-01-28 17:00:10 +01:00
'fields' => array(
'type' => 'select',
'label' => lang('Contact fields to show'),
'multiple' => true,
'options' => $fields,
'default' => $default,
2007-06-06 11:04:36 +02:00
'params' => array('size' => 9),
),
2011-01-28 17:00:10 +01:00
'etemplate' => array(
'type' => 'textfield',
2007-06-06 10:18:45 +02:00
'label' => lang('Custom eTemplate for the contactform'),
'params' => array('size' => 40),
2011-01-28 17:00:10 +01:00
'default' => 'registration.registration_form',
),
);
return parent::get_user_interface();
}
2011-01-28 17:00:10 +01:00
function get_content(&$arguments, $properties) {
$arguments['link'] = $this->link();
$args['arg1'] = $this->block;
$args['arg2'] = $properties;
return parent::get_content($args, $properties);
}
}