Current File : /home/pacjaorg/public_html/km/components/com_djclassifieds/models/registration.php |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined ('_JEXEC') or die('Restricted access');
class DjclassifiedsModelRegistration extends DJClassifiedsModel
{
function getCustomContactFields(){ // view backward compatibility
$db = JFactory::getDBO();
$query = "SELECT f.* FROM #__djcf_fields f "
."WHERE f.published=1 AND f.source=2 AND f.in_registration=1 AND f.group_id=0 ORDER BY f.ordering";
$db->setQuery($query);
$fields_list =$db->loadObjectList();
return $fields_list;
}
function getForm($reg_data = array())
{
$par = JComponentHelper::getParams('com_djclassifieds');
$form_path = JPATH_ROOT.'/components/com_djclassifieds/forms/registration.xml';
if(file_exists(JPATH_ROOT.'/components/com_djclassifieds/themes/'.$par->get('theme','default').'/forms/registration.xml')){
$form_path = JPATH_ROOT.'/components/com_djclassifieds/themes/'.$par->get('theme','default').'/forms/registration.xml';
}
$form = JForm::getInstance('registration', $form_path, array('control' => 'jform'));
$form->setValue('name', null, (!empty($reg_data['name']) ? $reg_data['name'] : ''));
$form->setValue('username', null, (!empty($reg_data['username']) ? $reg_data['username'] : ''));
$form->setValue('password1', null, (!empty($reg_data['password1']) ? $reg_data['password1'] : ''));
$form->setValue('password2', null, (!empty($reg_data['password2']) ? $reg_data['password2'] : ''));
$form->setValue('email1', null, (!empty($reg_data['email1']) ? $reg_data['email1'] : ''));
return $form;
}
}