2007-06-06 01:22:24 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2011-01-28 17:00:10 +01:00
|
|
|
* Registration - Sitemgr registration form
|
2007-06-06 01:22:24 +02:00
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
2011-01-28 17:00:10 +01:00
|
|
|
* @author Nathan Gray
|
|
|
|
* @package registration
|
|
|
|
* @copyright (c) 2010 Nathan Gray
|
2007-06-06 01:22:24 +02:00
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
2008-05-10 14:02:49 +02:00
|
|
|
* @version $Id$
|
2007-06-06 01:22:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2011-01-28 17:00:10 +01:00
|
|
|
* SiteMgr registration form
|
2007-06-06 01:22:24 +02:00
|
|
|
*/
|
2011-01-28 17:00:10 +01:00
|
|
|
class module_registration_form extends sitemgr_module
|
2007-06-06 01:22:24 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
*/
|
2008-05-10 14:02:49 +02:00
|
|
|
function __construct()
|
2007-06-06 01:22:24 +02:00
|
|
|
{
|
2011-01-28 17:00:10 +01:00
|
|
|
$this->i18n = true;
|
2007-06-06 01:22:24 +02:00
|
|
|
$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.');
|
2008-05-10 14:02:49 +02:00
|
|
|
|
2011-01-28 17:00:10 +01:00
|
|
|
$this->etemplate_method = 'registration.registration_sitemgr.display';
|
2007-06-06 01:22:24 +02:00
|
|
|
}
|
2008-05-10 14:02:49 +02:00
|
|
|
|
2007-06-06 01:22:24 +02:00
|
|
|
/**
|
2011-01-28 17:00:10 +01:00
|
|
|
* Reimplemented to add the registration translations
|
2007-06-06 01:22:24 +02:00
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function get_user_interface()
|
|
|
|
{
|
2011-01-28 17:00:10 +01:00
|
|
|
$GLOBALS['egw']->translation->add_app('registration');
|
2007-06-06 01:22:24 +02:00
|
|
|
|
2008-05-10 14:02:49 +02:00
|
|
|
$uicontacts = new addressbook_ui();
|
2007-06-06 01:22:24 +02:00
|
|
|
|
|
|
|
$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
|
2007-06-06 01:22:24 +02:00
|
|
|
'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' => '----------------------------',
|
2008-05-10 14:02:49 +02:00
|
|
|
'captcha' => lang('Verification'),
|
2007-06-06 01:22:24 +02:00
|
|
|
);
|
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']);
|
|
|
|
}
|
2007-06-06 01:22:24 +02:00
|
|
|
$this->arguments = array(
|
2011-01-28 17:00:10 +01:00
|
|
|
'register_for' => array(
|
2008-05-10 14:02:49 +02:00
|
|
|
'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!').')',
|
2007-06-06 01:22:24 +02:00
|
|
|
'options' => array(
|
|
|
|
'' => lang('None'),
|
2011-01-28 17:00:10 +01:00
|
|
|
)+registration_bo::get_allowed_addressbooks(registration_bo::PENDING)
|
2007-06-06 01:22:24 +02:00
|
|
|
),
|
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(
|
2008-05-10 14:02:49 +02:00
|
|
|
'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(
|
2008-05-10 14:02:49 +02:00
|
|
|
'type' => 'select',
|
2007-06-06 01:22:24 +02:00
|
|
|
'label' => lang('Contact fields to show'),
|
|
|
|
'multiple' => true,
|
|
|
|
'options' => $fields,
|
|
|
|
'default' => $default,
|
2007-06-06 11:04:36 +02:00
|
|
|
'params' => array('size' => 9),
|
2007-06-06 01:22:24 +02:00
|
|
|
),
|
2011-01-28 17:00:10 +01:00
|
|
|
'etemplate' => array(
|
2008-05-10 14:02:49 +02:00
|
|
|
'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',
|
2009-09-28 21:22:45 +02:00
|
|
|
),
|
2008-05-10 14:02:49 +02:00
|
|
|
);
|
2007-06-06 01:22:24 +02:00
|
|
|
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);
|
|
|
|
}
|
2007-06-06 01:22:24 +02:00
|
|
|
}
|