/**
  * @return Form
  */
 public function InviteForm()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js');
     Requirements::javascript('eventmanagement/javascript/EventInvitationField_invite.js');
     if ($times = $this->form->getRecord()->DateTimes()) {
         $times = $times->map('ID', 'Summary');
     } else {
         $times = array();
     }
     // Get past date times attached to the parent calendar, so we can get
     // all registered members from them.
     $past = DataObject::get('RegisterableDateTime', sprintf('"CalendarID" = %d AND "StartDate" < \'%s\'', $this->form->getRecord()->CalendarID, date('Y-m-d')));
     if ($past) {
         $pastTimes = array();
         foreach ($past->groupBy('EventID') as $value) {
             $pastTimes[$value->First()->EventTitle()] = $value->map('ID', 'Summary');
         }
     } else {
         $pastTimes = array();
     }
     $fields = new Tab('Main', new HeaderField('Select A Date/Time To Invite To'), new DropdownField('TimeID', '', $times, null, null, true), new HeaderField('AddPeopleHeader', 'Add People To Invite From'), new SelectionGroup('AddPeople', array('From a member group' => $group = new DropdownField('GroupID', '', DataObject::get('Group')->map(), null, null, true), 'From a past event' => $time = new GroupedDropdownField('PastTimeID', '', $pastTimes, null, null, true))), new HeaderField('EmailsToSendHeader', 'People To Send Invite To'), $emails = new TableField('Emails', 'EventInvitation', array('Name' => 'Name', 'Email' => 'Email Address'), array('Name' => 'TextField', 'Email' => 'TextField')));
     $group->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromgroup')));
     $time->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromtime')));
     $emails->setCustomSourceItems(new DataObjectSet());
     $fields = new FieldSet(new TabSet('Root', $fields));
     $validator = new RequiredFields('TimeID');
     return new Form($this, 'InviteForm', $fields, new FieldSet(new FormAction('doInvite', 'Invite')), $validator);
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fieldList = array("Country" => "Country", "State" => "State", "City" => "City", "PostalCode" => "PostCode", "WeightMin" => "WeightMin", "WeightMax" => "WeightMax", "VolumeMin" => "VolumeMin", "VolumeMax" => "VolumeMax", "ValueMin" => "ValueMin", "ValueMax" => "ValueMax", "QuantityMin" => "QuantityMin", "QuantityMax" => "QuantityMax", "Rate" => "Rate");
     $fieldTypes = array_merge(RegionRestriction::get_table_field_types(), array("WeightMin" => "TextField", "WeightMax" => "TextField", "VolumeMin" => "TextField", "VolumeMax" => "TextField", "ValueMin" => "TextField", "ValueMax" => "TextField", "QuantityMin" => "TextField", "QuantityMax" => "TextField", "Rate" => "TextField"));
     $fields->fieldByName('Root')->removeByName("Rates");
     if ($this->isInDB()) {
         $tablefield = new TableField("Rates", "TableShippingRate", $fieldList, $fieldTypes);
         $tablefield->setCustomSourceItems($this->Rates());
         $fields->addFieldToTab("Root.Main", $tablefield);
     }
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fieldList = array("ZoneID" => "Zone", "WeightMin" => "WeightMin", "WeightMax" => "WeightMax", "VolumeMin" => "VolumeMin", "VolumeMax" => "VolumeMax", "ValueMin" => "ValueMin", "ValueMax" => "ValueMax", "QuantityMin" => "QuantityMin", "QuantityMax" => "QuantityMax", "Rate" => "Rate");
     $fieldTypes = array("ZoneID" => "ZoneSelectField", "WeightMin" => "TextField", "WeightMax" => "TextField", "VolumeMin" => "TextField", "VolumeMax" => "TextField", "ValueMin" => "TextField", "ValueMax" => "TextField", "QuantityMin" => "TextField", "QuantityMax" => "TextField", "Rate" => "TextField");
     $fields->fieldByName('Root')->removeByName("Rates");
     if ($this->isInDB()) {
         $tablefield = new TableField("Rates", "ZonedShippingRate", $fieldList, $fieldTypes);
         $tablefield->setCustomSourceItems($this->Rates());
         $fields->addFieldToTab("Root.Main", $tablefield);
     }
     return $fields;
 }
Example #4
0
 function testHasItemsWhenSetAsArray()
 {
     $tf = new TableField('TestTableField', 'TableFieldTest_HasManyRelation', array('Value' => 'Value'), array('Value' => 'TextField'));
     $tf->setValue(array('new' => array('Value' => array('One', 'Two'))));
     $items = $tf->Items();
     $itemsArr = $items->toArray();
     // includes the two values and an "add" row
     $this->assertEquals($items->Count(), 3);
     // first row
     $this->assertEquals($itemsArr[0]->Fields()->fieldByName('TestTableField[new][Value][]')->Value(), 'One');
     // second row
     $this->assertEquals($itemsArr[1]->Fields()->fieldByName('TestTableField[new][Value][]')->Value(), 'Two');
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fieldList = array_merge(RegionRestriction::$field_labels, array('Rate' => 'Rate', 'Name' => 'Name'));
     $fieldTypes = array_merge(RegionRestriction::get_table_field_types(), array('Rate' => 'TextField', 'Name' => 'TextField'));
     $fields->fieldByName("Root")->removeByName('TaxRates');
     //remove tax rates tab
     if ($this->isInDB()) {
         $tablefield = new TableField("TaxRates", "TaxRate", $fieldList, $fieldTypes);
         $tablefield->setCustomSourceItems($this->TaxRates());
         $fields->addFieldsToTab("Root.Main", array(new LabelField("TaxRatesHelp", "Enter tax class rates for specific regions. Rates should be entered in decimal form, for example 0.05 = 5%."), $tablefield));
     }
     return $fields;
 }
 public function initialize()
 {
     if (!$this->isInitialized() && !$this->initializing) {
         $this->initializing = true;
         $this->dao->setCache($this->owner);
         $table = $this->field->getTable();
         $id = $table->getPropertyValue($this->owner, $table->getPrimaryKeyField());
         $this->collection = array();
         ProxyUtils::swap($this->owner, $this->collection, $this->field, $this->dao);
         $this->dao->__refreshByFK($this->collection, $id, $this->field->getForeignKeyConstraint());
         $cacheCopy = $this->getArrayCopy();
         ProxyUtils::swap($this->owner->{Dao::CACHE}, $cacheCopy, $this->field, $this->dao);
         $this->initialized = true;
         $this->initializing = false;
     }
 }
Example #7
0
 function testTableFieldSaving()
 {
     $group = $this->objFromFixture('Group', 'a');
     $tableField = new TableField("Permissions", "Permission", array("Code" => _t('SecurityAdmin.CODE', 'Code'), "Arg" => _t('SecurityAdmin.OPTIONALID', 'Optional ID')), array("Code" => "PermissionDropdownField", "Arg" => "TextField"), "GroupID", $group->ID);
     $form = new Form(new TableFieldTest_Controller(), "Form", new FieldSet($tableField), new FieldSet());
     /* The field starts emppty.  Save some new data.  We have replicated the array structure that the specific layout of the form generates. */
     $tableField->setValue(array('new' => array('Code' => array('CMS_ACCESS_CMSMain', 'CMS_ACCESS_AssetAdmin'), 'Arg' => array('1', '2'))));
     $tableField->saveInto($group);
     /* Let's check that the 2 permissions entries have been saved */
     $permissions = $group->Permissions()->toDropdownMap('Arg', 'Code');
     $this->assertEquals(array(1 => 'CMS_ACCESS_CMSMain', 2 => 'CMS_ACCESS_AssetAdmin'), $permissions);
     /* Now let's perform an update query */
     $value = array();
     foreach ($group->Permissions() as $permission) {
         $value[$permission->ID] = array("Code" => $permission->Code, "Arg" => $permission->Arg);
     }
     $value['new'] = array('Code' => array('CMS_ACCESS_NewsletterAdmin'), 'Arg' => array('3'));
     $tableField->setValue($value);
     $tableField->saveInto($group);
     /* Let's check that the 2 existing permissions entries, and the 1 new one, have been saved */
     $permissions = $group->Permissions()->toDropdownMap('Arg', 'Code');
     $this->assertEquals(array(1 => 'CMS_ACCESS_CMSMain', 2 => 'CMS_ACCESS_AssetAdmin', 3 => 'CMS_ACCESS_NewsletterAdmin'), $permissions);
 }
 private function getExceptionsTable()
 {
     $table = new TableField('Exceptions', 'RecurringException', array('ExceptionDate' => _t('CalendarEvent.DATE', 'Date')), array('ExceptionDate' => 'DatePickerField'), null, "CalendarEventID = {$this->ID}");
     $table->setExtraData(array('CalendarEventID' => $this->ID));
     return $table;
 }
 protected function createTableListField()
 {
     $table = new TableField($name = "SimplestSpamFieldQuestion", $sourceClass = "SimplestSpamFieldQuestion", $fieldList = array("Question" => "Question", "Answer" => "Answer"), $fieldTypes = array("Question" => "TextField", "Answer" => "TextField"), $sourceFilter = null, $sourceSort = null, $sourceJoin = null);
     $table->setPermissions(array("show", "add", "delete", "edit"));
     return $table;
 }
 public function __construct($title, $field, $linkMaker)
 {
     parent::__construct($title, $field);
     $this->linkMaker = $linkMaker;
 }
 function gwt_igniter($option)
 {
     if (!isset($option)) {
         echo "Please add your option jso or ci_model";
         return;
     }
     // Configuration
     $host = 'localhost:3306';
     $user = '******';
     $pass = '******';
     $database = 'demo';
     // Connect to the MySQL database
     $conn = mysql_connect($host, $user, $pass) or die("Could not connect to database\n");
     mysql_select_db($database, $conn) or die("Could not connect to {$database}\n");
     // Query to get list of tables
     $result = mysql_query("SHOW TABLES FROM {$database}", $conn);
     if ($result) {
         $output = array();
         while ($row = mysql_fetch_array($result)) {
             $tableName = $row[0];
             if ($tableName == "metadata" || $tableName == "xe") {
                 echo $tableName . " <b>Skipped</b><br>";
                 continue;
             } else {
                 if (!$this->isInMetadata($tableName) && $option == "create") {
                     $this->metadata->tablename = $tableName;
                     $this->metadata->use_scaffolding = 0;
                     $this->metadata->save();
                 } else {
                     if (!$this->use_scaffolding($tableName)) {
                         echo $tableName . " <b>Skipped</b><br>";
                         continue;
                     }
                 }
             }
             $table_object = new Table($tableName);
             //create table object
             if ($this->lang->line($tableName)) {
                 $table_object->table_fullname = $this->lang->line($tableName);
             } else {
                 $table_object->table_fullname = $tableName;
             }
             echo "<h1>" . $table_object->table_fullname . "</h1>";
             // Get meta data
             $cols = mysql_query("SHOW COLUMNS FROM {$tableName}", $conn);
             if ($cols) {
                 while ($col = mysql_fetch_assoc($cols)) {
                     // Add this table to our associative array
                     if (!array_key_exists($tableName, $output)) {
                         $output[$tableName] = array();
                     }
                     // Add the column definition to our associative array
                     $output[$tableName][$col['Field']] = $col['Type'];
                     // add field for table object
                     $field_object = new TableField();
                     $field_object->name = $col['Field'];
                     $lan_key = $tableName . "." . $col['Field'];
                     if ($this->lang->line($lan_key)) {
                         $field_object->fullname = $this->lang->line($lan_key);
                     } else {
                         $field_object->fullname = $col['Field'];
                     }
                     $field_object->type = DBUtils::MySQLTypeMapping2Java($col['Type']);
                     $field_object->isNumber = DBUtils::isNumber($col['Type']);
                     $field_object->isDate = DBUtils::isDate($col['Type']);
                     $field_object->isString = DBUtils::isString($col['Type']);
                     if ($col["Key"] == "PRI") {
                         $field_object->setIsKey(true);
                     } else {
                         if ($col['Key'] == "MUL") {
                             $field_object->setIsForeignKey(true);
                         } else {
                             if ($col['Key'] == "UNI") {
                                 $field_object->setIsUnique(true);
                             }
                         }
                     }
                     if ($col['Extra'] == "auto_increment") {
                         $field_object->isAutoIncrement = true;
                     }
                     if ($col['Null'] == "NO") {
                         $field_object->isRequire = true;
                     }
                     if ($col['Default']) {
                         $field_object->default = $col['Default'];
                     }
                     //add max length
                     $l = DBUtils::StringLength($col['Type']);
                     if ($l > 0) {
                         $field_object->maxLength = $l;
                     }
                     $table_object->addField1($field_object);
                 }
                 mysql_free_result($cols);
                 //   $this->createJSO($table_object);
                 $this->createCIModel($table_object);
                 $this->createCIController($table_object);
                 $this->createCIView($table_object);
                 // $this->createCI_Language($table_object);
                 //                    $this->createMenu($table_object);
                 echo "<hr/>";
             }
         }
         // Output results
         foreach ($output as $table => $cols) {
             echo "===== {$table} =====<br/>";
             foreach ($cols as $field => $type) {
                 echo "{$field} : {$type}<br/>";
             }
         }
     }
     // Free result
     if ($result) {
         mysql_free_result($result);
     }
     // Close connection
     if ($conn) {
         mysql_close($conn);
     }
 }
Example #12
0
 function __construct()
 {
     parent::__construct();
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $config = EmailTemplate::config();
     if (!$this->Theme) {
         $this->Theme = MandrillEmail::config()->default_theme;
     }
     if (!$this->Template) {
         $this->Template = MandrillEmail::config()->default_template;
     }
     if ($config->allow_configure_template || Permission::check('ADMIN')) {
         $templates = MandrillEmail::getAvailablesTemplates();
         $fields->replaceField('Template', $templateDropdown = new DropdownField('Template', 'Template', $templates));
     } else {
         $fields->removeByName('Template');
     }
     if ($config->allow_configure_theme || Permission::check('ADMIN')) {
         $themes = MandrillEmail::getAvailableThemes();
         $fields->replaceField('Theme', $themeDropdown = new DropdownField('Theme', 'Theme', array_combine($themes, $themes)));
     } else {
         $fields->removeByName('Theme');
     }
     $objectsSource = array();
     $dataobjects = ClassInfo::subclassesFor('DataObject');
     foreach ($dataobjects as $dataobject) {
         if ($dataobject == 'DataObject') {
             continue;
         }
         $objectsSource[$dataobject] = $dataobject;
     }
     asort($objectsSource);
     // form-extras integration
     if (class_exists('TableField')) {
         $fields->replaceField('ExtraModels', $extraModels = new TableField('ExtraModels', 'Extra Models'));
         $extraModels->addColumn('Name');
         $extraModels->addColumn('Model', null, TableField::TYPE_SELECT, null, array('ctrlOptions' => $objectsSource));
     } else {
         if (class_exists('CodeEditorField')) {
             $fields->replaceField('ExtraModels', $extraModelsCode = new CodeEditorField('ExtraModels', 'Extra Models'));
             $extraModelsCode->setMode('json');
         }
     }
     // form-extras integration
     if (class_exists('ComboField')) {
         $categories = EmailTemplate::get()->column('Category');
         $fields->replaceField('Category', new ComboField('Category', 'Category', array_combine($categories, $categories)));
     }
     $fields->dataFieldByName('Callout')->setRows(5);
     $codeField = $fields->dataFieldByName('Code');
     $codeField->setAttribute('placeholder', _t('EmailTemplate.CODEPLACEHOLDER', 'A unique code that will be used in code to retrieve the template, e.g.: my-email'));
     if ($this->Code) {
         $codeField->setReadonly(true);
     }
     // Merge fields helper
     $fields->addFieldToTab('Root.Main', new HeaderField('MergeFieldsHelperTitle', _t('EmailTemplate.AVAILABLEMERGEFIELDSTITLE', 'Available merge fields')));
     $content = '';
     $baseFields = array('To', 'Cc', 'Bcc', 'From', 'Subject', 'Body', 'BaseURL', 'Controller');
     foreach ($baseFields as $baseField) {
         $content .= $baseField . ', ';
     }
     $content = trim($content, ', ') . '<br/><br/>';
     $models = $this->getAvailableModels();
     $modelsByClass = array();
     $classes = array();
     foreach ($models as $name => $model) {
         $classes[] = $model;
         if (!isset($modelsByClass[$model])) {
             $modelsByClass[$model] = array();
         }
         $modelsByClass[$model][] = $name;
     }
     $classes = array_unique($classes);
     foreach ($classes as $model) {
         if (!class_exists($model)) {
             continue;
         }
         $props = Config::inst()->get($model, 'db');
         $o = singleton($model);
         $methods = array_diff($o->allMethodNames(true), $o->allMethodNames());
         $content .= '<strong>' . $model . ' (' . implode(',', $modelsByClass[$model]) . ') :</strong><br/>';
         foreach ($props as $fieldName => $fieldType) {
             $content .= $fieldName . ', ';
         }
         foreach ($methods as $method) {
             if (strpos($method, 'get') === 0) {
                 $content .= $method . ', ';
             }
         }
         $content = trim($content, ', ') . '<br/>';
     }
     $content .= "<div class='message info'>" . _t('EmailTemplate.ENCLOSEFIELD', 'To escape a field from surrounding text, you can enclose it between brackets, eg: {$CurrentMember.FirstName}.') . '</div>';
     $fields->addFieldToTab('Root.Main', new LiteralField('MergeFieldsHelper', $content));
     if ($this->ID) {
         $fields->addFieldToTab('Root.Preview', $this->previewTab());
     }
     return $fields;
 }
 function __construct($title, $field, $formatter)
 {
     parent::__construct($title, $field);
     $this->formatter = $formatter;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->replaceField('URLSegment', new ReadonlyField('URLSegment', _t('Product.URLSEGMENT', 'URL segment for product')));
     $fields->removeByName('Categories');
     $fields->addFieldToTab('Root.Main', new TreeMultiselectField('Categories', _t('Product.CATEGORIES', 'Categories this product belongs to'), 'ProductCategoryPage'), 'Content');
     $fields->removeByName('Variations');
     if ($this->ID) {
         $summaryFields = ProductVariation::$summary_fields;
         $fieldTypes = ProductVariation::$field_types;
         $variationsTable = new TableField('Variations', 'ProductVariation', $summaryFields, $fieldTypes, 'ProductID', $this->ID);
         $variationsTable->setExtraData(array('ProductID' => $this->ID));
         $fields->addFieldToTab('Root.Main', new HeaderField(_t('Product.PRODVARIATIONS', 'Product variations'), 3), 'Content');
         $fields->addFieldToTab('Root.Main', $variationsTable, 'Content');
     }
     return $fields;
 }
Example #16
0
 public function getDateTimeTable($eventID)
 {
     $this->extendTable();
     $name = 'DateTimes';
     $titles = $this->getTableTitles();
     $filter = "`CalendarDateTime`.EventID = {$eventID}";
     if ($this->isComplex()) {
         $fields = $this->getPopupFields();
         $fields->push(new HiddenField('EventID', '', $eventID));
         $fields->push(new HiddenField('is_announcement', '', '0'));
         $obj = class_exists("DataObjectManager") ? "DataObjectManager" : "ComplexTableField";
         $table = Object::create($obj, $this->getEventObject(), $name, get_class($this), $titles, $fields, $filter);
         $table->setAddTitle(_t("CalendarDateTime.ADATE", "a Date"));
     } else {
         $fields = $this->getTableFields();
         $table = new TableField($name, get_class($this), $titles, $fields, null, $filter);
         $table->setExtraData(array('EventID' => $eventID));
         //$table->showAddRow = false;
     }
     return $table;
 }
Example #17
0
    function billingform()
    {
        ob_start();
        $paymentMethod = DT_Session::get('register.payment.method');
        ?>

		        <tr><td colspan="2" ><strong><?php 
        echo JText::_('DT_PAYMENT_INFORMATION');
        ?>
</strong></td></tr>

                <tr><td colspan="2" >&nbsp;
                	<input type="hidden" name="paymentmethod" value="<?php 
        echo $paymentMethod;
        ?>
" />
                </td></tr>

			<?php 
        if (count(DT_Session::get('register.User')) == 1) {
            ?>
             <tr>
                	<td><?php 
            echo JText::_('DT_SAME_BILLING_INFO');
            ?>
</td>
                	<td><input type="checkbox" class="inputbox" name="same" id="same" value="1" /></td>
             </tr>
            <?php 
        }
        ?>

		        <tr>

                	<td width="31%"><?php 
        echo JText::_('DT_CARD_HOLDER_FIRSTNAME');
        ?>
:<span class="dtrequired">  *  </span></td>

                    <td width="69%" align="left" > <input id="billingFirstname"  class="inputbox required" type="text" name="billing[firstname]" value="<?php 
        echo isset($this->firstname) ? $this->firstname : '';
        ?>
" /> </td>

                 </tr>

                   <tr>

                	<td width="31%"  ><?php 
        echo JText::_('DT_CARD_HOLDER_LASTNAME');
        ?>
:<span class="dtrequired">  *  </span></td>

                    <td width="69%" align="left" > <input id="billingLastname" class="inputbox required" type="text" name="billing[lastname]" value="<?php 
        echo isset($this->lastname) ? $this->lastname : '';
        ?>
" /> </td>

                 </tr>

                   <tr>

                	<td width="31%"  ><?php 
        echo JText::_('DT_BILLING_ADDRESS');
        ?>
:<span class="dtrequired">  *  </span></td>

                    <td width="69%" align="left" > <input id="billingAddress" class="inputbox required" type="text" name="billing[address]" value="<?php 
        echo isset($this->address) ? $this->address : '';
        ?>
" /> </td>

                 </tr>

                   <tr>

                	<td width="31%"  ><?php 
        echo JText::_('DT_CITY');
        ?>
:<span class="dtrequired">  *  </span></td>

                    <td width="69%" align="left" ><input id="billingCity" class="inputbox required" type="text" name="billing[city]" value="<?php 
        echo isset($this->city) ? $this->city : '';
        ?>
" />  </td>

                 </tr>

                   <tr>

                	<td width="31%"  ><?php 
        echo JText::_('DT_STATE');
        ?>
:<span class="dtrequired">  *  </span></td>

                    <td width="69%" align="left" > <input  id="billingState" class="inputbox required" type="text" name="billing[state]" value="<?php 
        echo isset($this->state) ? $this->state : '';
        ?>
" /> </td>

                 </tr>
<?php 
        $countylist = new TableField();
        $field = $countylist->fingbyName('country');
        // pr($field->id);
        $paymentmethod = DtrModel::getInstance('paymentmethod', 'DtregisterModel');
        global $paypal_pro_country;
        if (get_class($this) == 'paypal_pro') {
            $value = isset($this->country) ? $this->country : $paypal_pro_country;
            $dropDownDatas = $paymentmethod->paypal_country_codes();
            $countrydropdown = JHTML::_('select.genericlist', DtHtml::options($dropDownDatas, JText::_("DT_SELECT_COUNTRY")), 'billing[country]', $value, 'value', 'text', array($value));
            // pr($value); pr($countrydropdown); exit;
        } else {
            if ($field) {
                $dropDownDatas = explode("|", $field->values);
                $value = isset($this->country) ? $this->country : $field->selected;
                $countrydropdown = JHTML::_('select.genericlist', DtHtml::options($dropDownDatas, JText::_("DT_SELECT_COUNTRY")), 'billing[country]', ' ', 'value', 'text', $value);
            }
        }
        ?>
        <tr>
			   <td>
				 <?php 
        echo JText::_('DT_COUNTRY');
        ?>
			   </td>
			   <td>
				 <?php 
        echo $countrydropdown;
        ?>
			   </td>
		</tr>
       
                 <tr>
                	<td width="31%"><?php 
        echo JText::_('DT_ZIPCODE');
        ?>
:<span class="dtrequired">  *  </span></td>
                    <td width="69%" align="left"> <input id="billingZipcode" class="inputbox required" type="text" name="billing[zipcode]" value="<?php 
        echo isset($this->zipcode) ? $this->zipcode : '';
        ?>
" /> </td>
                 </tr>
  
                 <tr>
                	<td width="31%"><?php 
        echo JText::_('DT_PHONE');
        ?>
:<span class="dtrequired">  *  </span></td>
                    <td width="69%" align="left"> <input id="billingPhone" class="inputbox required" type="text" name="billing[phone]" value="<?php 
        echo isset($this->phone) ? $this->phone : '';
        ?>
" /> </td>
                 </tr>
  <?php 
        if (get_class($this) != 'offline_payment') {
            ?>
                 <tr>
                	<td width="31%"><?php 
            echo JText::_('DT_EMAIL');
            ?>
:<span class="dtrequired">  *  </span></td>
                    <td width="69%" align="left"> <input id="billingEmail" class="inputbox required" type="text" name="billing[email]" value="<?php 
            echo isset($this->email) ? $this->email : '';
            ?>
" /> </td>
                 </tr>
   <?php 
        }
        ?>
                 <?php 
        foreach (DT_Session::get('register.User') as $key => $user) {
            if (!intval($key)) {
                continue;
            }
            break;
        }
        ?>

				<script language="javascript" type="text/javascript">

                    //<![CDATA[
							<?php 
        $field = $countylist->fingbyName('firstname');
        ?>
							var billing_firstname = "<?php 
        echo $field ? $user['fields'][$field->id] : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('lastname');
        ?>
							var billing_lastname = "<?php 
        echo $field ? $user['fields'][$field->id] : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('address');
        ?>
							var billing_address = "<?php 
        echo $field ? $user['fields'][$field->id] : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('city');
        ?>
							var billing_city = "<?php 
        echo $field ? $user['fields'][$field->id] : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('state');
        ?>
							var billing_state = "<?php 
        echo isset($this->state) ? $this->state : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('zip');
        ?>
							var billing_zipcode = "<?php 
        echo $field && isset($user['fields'][$field->id]) ? $user['fields'][$field->id] : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('email');
        ?>
							var billing_email = "<?php 
        echo $field ? $user['fields'][$field->id] : '';
        ?>
";
							<?php 
        $field = $countylist->fingbyName('country');
        ?>
							var billing_country = "<?php 
        echo $field ? $user['fields'][$field->id] : '';
        ?>
";
		
							DTjQuery(function(){
								DTjQuery("#same").click(function(){
									
									if(this.checked) {
										DTjQuery("#billingFirstname").val(billing_firstname);
										DTjQuery("#billingLastname").val(billing_lastname);
										DTjQuery("#billingAddress").val(billing_address);
										DTjQuery("#billingCity").val(billing_city);
										DTjQuery("#billingState").val(billing_state);
										DTjQuery("#billingZipcode").val(billing_zipcode);
										DTjQuery("#billingEmail").val(billing_email);
										DTjQuery("#billingcountry").val(billing_country);
									} else {
										DTjQuery("#billingFirstname").val('');
										DTjQuery("#billingLastname").val('');
										DTjQuery("#billingAddress").val('');
										DTjQuery("#billingCity").val('');
										DTjQuery("#billingState").val('');
										DTjQuery("#billingZipcode").val('');
										DTjQuery("#billingEmail").val('');
										DTjQuery("#billingcountry").val('');
									}
		
								});
							});
                    
							//]]>

                   </script>

                <?php 
        $data = ob_get_clean();
        return $data;
    }
 public function __construct($title = '')
 {
     parent::__construct($title, null);
 }