/** * creates list of contacts, or a no entries found page * @return string html-content */ function innerCreate() { $cont = '<div class="options">'; $cont .= $this->nav->create(); $box = '<div class="options-title">Import</div>'; $box .= '<form action="import.php" method="post">'; $box .= '<div><label for="mails">Paste text data:</label></div>'; $box .= '<div><textarea name="text" id="text" cols="60" rows="20"></textarea></div>'; $box .= '<br><div>'; //<fieldset><legend>Format</legend>'; $box .= HTMLHelper::createRadioButton('format', 'vCard(s)', 'vCard', true, null, false); //$box .= HTMLHelper::createRadioButton('format','vCard(s)','csv',true,null,false); $box .= '</div>'; $box .= '<br><div>'; //<fieldset><legend>Next</legend>'; $box .= HTMLHelper::createRadioButton('continue', 'More input', 'interface', true, null, false); $box .= HTMLHelper::createRadioButton('continue', 'Review last card', 'card', false, null, false); $box .= '</div>'; $box .= '<br><div><input type="submit"/></div>'; $box .= '</form>'; return $cont . HTMLHelper::createNestedDivBoxModel('options-content', $box) . '</div>'; }
/** * create the fieldset that allows user to the addresses of the contact * @global array list of country names and acronyms * @global Options used to determine the country default * @return string html-content */ function createAddressFieldset() { global $country, $options; $cont = '<fieldset class="edit-address">'; $cont .= '<legend>Addresses</legend>'; $cont .= '<div class="context-help" id="editHelp' . $this->htmlId . '"><a href="#" onclick="Element.hide(\'editHelp' . $this->htmlId . '\'); Effect.Appear(\'editHint' . $this->htmlId . '\',{duration:1.2}); return false;">?</a></div><div class="context-help" id="editHint' . $this->htmlId++ . '" style="display: none;">All fields are optional. An address will be saved if either of the following are provided: type, address lines, city, state, zip code, or a phone number. If Primary Address is selected, the address will be displayed in the contact list. To obtain more than 2 additional blank address sections, save this entry and edit it again.</div>'; $addr = $this->contact->getValueGroup('addresses'); $n = max(count($addr), 1); // initially 3 blank adresses // write out all existing addresses plus 2 blank address for ($i = 0; $i < $n + 2; $i++) { $a = array_key_exists($i, $addr) ? $addr[$i] : null; // generate additional blank entries if ($i >= $n) { // hide the blank addresses by default $cont .= '<div class="edit-single-address" id="anotherAddress' . $i . '" style="display: none;"><br>'; } else { $cont .= '<div class="edit-single-address">'; } if (!$this->add) { $cont .= '<input type="hidden" name="address[' . $i . '][refid]" value="' . $a['refid'] . '" />'; } $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][type]", 'Type', $a['type'], 'edit-input'); $cont .= HTMLHelper::createRadioButton("address_primary", 'Set as primary address', $i, isset($this->contact->contact['primaryAddress']) && $a['refid'] == $this->contact->contact['primaryAddress'], 'edit-input-radio'); if (!$i >= $n) { $cont .= '<div class="edit-input-link"><a href="javascript:deleteAddress(' . $i . ');">Delete this address</a></div>'; } $cont .= '</div>'; $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][line1]", 'Address (Line 1)', $a['line1'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][line2]", 'Address (Line 2)', $a['line2'], 'edit-input'); $cont .= '</div>'; $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][city]", 'City', $a['city'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][state]", 'State', $a['state'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][zip]", 'Zip-code', $a['zip'], 'edit-input'); $cont .= '</div>'; $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][phone1]", 'Phone 1', $a['phone1'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][phone2]", 'Phone 2', $a['phone2'], 'edit-input'); $cont .= HTMLHelper::createDropdown("address[{$i}][country]", 'Country', $country, $a === null ? $options->getOption('countryDefault') : $a['country'], 'edit-input'); $cont .= '</div>'; if ($i >= $n - 1 && $i != $n + 1) { // include the add more link in the previous div $cont .= "\n" . '<div id="addAddressLink' . ($i + 1) . '"><a href="#" onclick="Element.hide(\'addAddressLink' . ($i + 1) . '\'); Effect.SlideDown(\'anotherAddress' . ($i + 1) . '\',{duration:1.2}); return false;">add address</a></div>'; } $cont .= '</div>'; } $cont .= '</fieldset>'; return $cont; }
/** * create the fieldset that allows user to the addresses of the contact * @global array list of country names and acronyms * @global Options used to determine the country default * @return string html-content * @TODO If a contact gets bounced (missing mandatory value) 2 additional unhidden blank addresses show. This is because in the previous step 3 blank addresses were created and by reediting the same contact without storing it the blank addresses are not removed. */ function createAddressFieldset() { global $country, $options; $cont = '<fieldset class="edit-address">'; $cont .= '<legend>Addresses</legend>'; $cont .= $this->contextHelp('address'); $addr = $this->contact->getValueGroup('addresses'); $n = max(count($addr), 1); // initially 3 blank adresses // write out all existing addresses plus 2 blank address for ($i = 0; $i < $n + 2; $i++) { $a = array_key_exists($i, $addr) ? $addr[$i] : null; // generate additional blank entries if (!isset($a['refid'])) { // if someone leaves the lastname blank we reedit the same contact - would cause tons of warnings $a = null; } if ($a !== null) { $this->valueGroups['phone'][$a['refid']] = $this->contact->getValueGroup('phone', $a['refid']); $this->valueGroups['email'][$a['refid']] = $this->contact->getValueGroup('email', $a['refid']); $this->valueGroups['chat'][$a['refid']] = $this->contact->getValueGroup('chat', $a['refid']); $this->valueGroups['www'][$a['refid']] = $this->contact->getValueGroup('www', $a['refid']); $this->valueGroups['other'][$a['refid']] = $this->contact->getValueGroup('other', $a['refid']); } if ($i >= $n) { // hide the blank addresses by default $cont .= '<div class="edit-single-address" id="anotherAddress' . $i . '" style="display: none;"><br>'; } else { $cont .= '<div class="edit-single-address">'; } if (!$this->add) { $cont .= '<input type="hidden" name="address[' . $i . '][refid]" value="' . $a['refid'] . '" />'; } $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][type]", 'Address type', $a['type'], 'edit-input'); $cont .= HTMLHelper::createRadioButton("address_primary", 'Set as primary address', $i, isset($this->contact->contact['primaryAddress']) && $a['refid'] == $this->contact->contact['primaryAddress'], 'edit-input-radio'); if ($i < $n) { $cont .= '<div class="edit-input-link"><a href="javascript:deleteAddress(' . $i . ');">Delete this address</a></div>'; } $cont .= '</div>'; $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][line1]", 'Address (Line 1)', $a['line1'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][line2]", 'Address (Line 2)', $a['line2'], 'edit-input'); $cont .= '</div>'; $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][city]", 'City', $a['city'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][state]", 'State', $a['state'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][zip]", 'Zip-code', $a['zip'], 'edit-input'); $cont .= '</div>'; $cont .= '<div class="edit-line">'; // $cont .= HTMLHelper::createTextField("address[$i][phone1]",'Phone 1',$a['phone1'],'edit-input'); // $cont .= HTMLHelper::createTextField("address[$i][phone2]",'Phone 2',$a['phone2'],'edit-input'); $cont .= HTMLHelper::createDropdown("address[{$i}][country]", 'Country', $country, $a === null ? $options->getOption('countryDefault') : $a['country'], 'edit-input'); $cont .= '</div>'; if ($a !== null) { $cont .= '<div><label>Communications</label>'; $opt = array('email' => 'email', 'phone' => 'phone', 'chat' => 'chat', 'other' => 'other', 'www' => 'url', ' ' => 'delete'); $cont .= $this->createNormalProperties($opt, 'email', $a['refid']); $cont .= $this->createNormalProperties($opt, 'phone', $a['refid']); $cont .= $this->createNormalProperties($opt, 'chat', $a['refid']); $cont .= $this->createNormalProperties($opt, 'www', $a['refid']); $cont .= $this->createNormalProperties($opt, 'other', $a['refid']); $cont .= '</div>'; } if ($i >= $n - 1 && $i != $n + 1) { // include the add more link in the previous div $cont .= "\n" . '<div id="addAddressLink' . ($i + 1) . '"><a href="#" onclick="Element.hide(\'addAddressLink' . ($i + 1) . '\'); Effect.SlideDown(\'anotherAddress' . ($i + 1) . '\',{duration:1.2}); return false;">add address</a></div>'; } $cont .= '</div>'; } $cont .= '</fieldset>'; return $cont; }