/** * create the content of the options page * @return string html-content * @global ErrorHandler used for error handling * @uses createPasswordForm() * @uses createEmailForm() * @uses createOptionsForm() */ function innerCreate() { global $errorHandler; $cont = '<div class="options">'; $cont .= $this->nav->create(); $box = ''; $rightsManager = RightsManager::getSingleton(); if (!$rightsManager->isSelf($this->user)) { $box .= '<div class="options-title">Edit the options of ' . $this->user->contact['lastname'] . ', ' . $this->user->contact['firstname'] . '</div>'; } else { $box .= '<div class="options-title">Edit your options</div>'; } $box .= '<div class="options-box">'; if ($rightsManager->currentUserIsAllowedTo('edit-options-password', $this->user)) { $box .= $this->createPasswordForm(); } if ($rightsManager->currentUserIsAllowedTo('edit-options-regemail', $this->user)) { $box .= $this->createEmailForm(); } if ($rightsManager->currentUserIsAllowedTo('edit-options-useroptions', $this->user)) { $box .= $this->createOptionsForm(); } $box .= '</div>'; return $cont . HTMLHelper::createNestedDivBoxModel('options-content', $box) . '</div>'; }
/** * create the content of upcoming dates * @return string html-content * @global Options determine how many days before event should contact be shown? */ function innerCreate() { global $options, $CONFIG_DATELIST_NAME_SPEC; $contacts = $this->contactList->getContacts(); $dates = $this->contactList->getDates(); $data = array(); $time = getdate(); if (!isset($CONFIG_DATELIST_NAME_SPEC)) { $spec = null; } else { $spec = $CONFIG_DATELIST_NAME_SPEC; } foreach ($contacts as $k => $c) { $data[] = array('display_name' => $c->generateFullName('html', $spec), 'type' => $dates[$k]['type'], 'time' => date('M j', strtotime('1975-' . $dates[$k]['month'] . '-' . $dates[$k]['day'])) . ($dates[$k]['year'] != '0000' ? ', ' . $dates[$k]['year'] : ''), 'age' => intval($time['year'] - $dates[$k]['year']) . 'y', 'daysAway' => $dates[$k]['daysAway'] > 0 ? $dates[$k]['daysAway'] . 'd' : 'today'); } $tGen = new TableGenerator('changed-list'); $cont = '<table class="changed-list">'; $cont .= '<caption>Upcoming dates (Next ' . $options->getOption('bdayInterval') . ' days)</caption>'; if (count($data) > 0) { $cont .= $tGen->generateBody($data, array('display_name', 'type', 'time', 'age', 'daysAway')); } else { $cont .= '<tr class="noentry"><td>Nothing upcoming</td></tr>'; } $cont .= '</table>'; return HTMLHelper::createNestedDivBoxModel('changed-list', $cont); }
static function recurse($id, $indent, $list, &$children, $maxlevel = 9999, $level = 0, $type = 1, $compact = false) { if (@$children[$id] && $level <= $maxlevel) { foreach ($children[$id] as $v) { $id = $v->id; if ($type) { $pre = ''; if ($level) { $pre = '<sup>|_</sup> '; } $spacer = str_repeat(' ', 6); } else { $pre = '- '; $spacer = ' '; } if ($v->parent == 0) { $txt = $v->text; } else { $txt = $pre . $v->text; } $list[$id] = $v; if (!$compact) { $list[$id]->text = "{$indent}{$txt}"; $list[$id]->level = $level; $list[$id]->children = count(@$children[$id]); } $list = HTMLHelper::_('tree.recurse', $id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type, $compact); } } return $list; }
/** * create the content of the backup database panel * @return string html-content */ function createBackupDatabaseForm() { $cont = '<fieldset class="options-options">'; $cont .= '<legend>Backup Database</legend>'; $cont .= '<form action="backup.php" method="get">'; $cont .= '<div>Page-ContextHelp-admin-db</div>'; $cont .= HTMLHelper::createButton('Backup Database'); $cont .= '</form>'; $cont .= '</fieldset>'; return $cont; }
public static function var_dump_html($var, $return = false) { ob_start(); var_dump($var); $contents = ob_get_clean(); $contents = "<pre style='text-align:left; font-size: 9pt; background: #EFEFEF; padding: 10px; border: solid 1px #000; margin: 0px 0px 0px; font-family: monospace'>" . HTMLHelper::escape($contents) . "</pre>"; if ($return) { return $contents; } else { echo $contents; } }
function editContactInterface(&$contact, $location) { global $CONFIG_ADMINRP_OPTIONS; if ($location != 'ownFieldset') { return ""; } if (!$_SESSION['user']->isAtLeast('manager')) { return ""; } $content = '<fieldset class="edit-names">'; $content .= '<legend>Administrative Requests</legend>'; foreach ($CONFIG_ADMINRP_OPTIONS as $k => $v) { $content .= HTMLHelper::createCheckbox($k, $v[0] . " (" . $v[1] . ")"); } return $content . '</fieldset>'; }
/** * 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>'; }
function tinymce($name, $value = '', $required = false, $rows = 10, $cols = 50, $params = null) { $app =& Factory::getApplication(); $config =& Factory::getConfig(); // set script source path $baseURL = $config->baseURL; $baseURL = str_replace(@$config->admin_path, '', $baseURL); $app->set('js', $baseURL . 'assets/editors/tinymce/tiny_mce.js'); $show_format_1 = isset($params['buttons1_format']) && $params['buttons1_format'] ? true : false; $show_buttons_2 = isset($params['buttons2']) && $params['buttons2'] ? true : false; ob_start(); ?> <script> tinyMCE.init({ // General options mode : "exact", elements : "<?php echo $name; ?> ", theme : "advanced", skin : "o2k7", skin_variant : "silver", relative_urls : false, remove_script_host : false, invalid_elements: "script", plugins : "safari,table,style,advimage,paste,advlink,inlinepopups,media,directionality", // Theme options content_css : "<?php echo $baseURL; ?> templates/<?php echo $config->__raw->template; ?> /assets/css/editor.css", theme_advanced_buttons1 : "<?php echo $show_format_1 ? 'formatselect,' : ''; ?> bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|undo,redo,|,pastetext,pasteword,|,link,unlink,image,|,code", theme_advanced_buttons2 : "<?php echo $show_buttons_2 ? 'tablecontrols,|,hr,removeformat' : ''; ?> ", theme_advanced_buttons3 : "<?php echo $show_buttons_2 ? 'formatselect,fontselect,fontsizeselect' : ''; ?> ", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "none" <?php if (isset($params['width'])) { ?> ,width: <?php echo $params['width']; ?> <?php } ?> <?php if (isset($params['height'])) { ?> ,height: <?php echo $params['height']; ?> <?php } ?> // File manager (MFM) ,file_browser_callback : _loadMFM }); function _loadMFM(field_name, url, type, win) { tinyMCE.activeEditor.windowManager.open({ <?php // build params for this plugin $fm_params = array('base_path' => BASE_PATH, 'root_path' => $baseURL, 'editor_path' => $baseURL . 'assets/editors/tinymce', 'file_root' => 'uploads'); $fm_params = base64_encode(serialize($fm_params)); ?> file : "<?php echo $baseURL; ?> assets/editors/editor_plugins/mfm.php?field=" + field_name + "&url=" + url + "¶ms=<?php echo $fm_params; ?> ", title : 'File Manager', width : 640, height : 450, resizable : "no", inline : "yes", close_previous : "no" }, { window : win, input : field_name }); return false; } </script> <?php $js_script = ob_get_clean(); $app->set('js', $js_script, false, true); $attributes = array('mce_editable="true"'); // attach script tag if (isset($params['attach_script']) && $params['attach_script']) { $script_tag = str_replace(array('<script>', '</script>'), array('', ''), $js_script); $attributes[] = '_script_tag="' . base64_encode($script_tag) . '"'; } // load generic return HTMLHelper::_('editor.generic', $name, $value, $required, $rows, $cols, implode(' ', $attributes)); }
function editContactInterface(&$contact, $location) { if ($location != 'ownFieldset') { return ""; } //if(!$_SESSION['user']->isAtLeast('manager')) // return ""; global $CONFIG_DB_PREFIX; $db = DB::getSingleton(); // fetch dropdown $dropdown = $this->getDropdown($db, $contact->contact['id']); $db->query("SELECT partnerId,ouder1,ouder2,thuiswonend FROM " . $CONFIG_DB_PREFIX . "contact WHERE id = '" . $contact->contact['id'] . "'"); $r = $db->next(); $thuiswonend = false; if ($r['thuiswonend'] == 1) { $thuiswonend = true; } $content = '<fieldset class="edit-names">'; $content .= '<legend>Relatives</legend>'; $content .= '<div class="edit-line">'; $content .= HTMLHelper::createDropdown("partner", 'Getrouwd met', $dropdown, $r['partnerId'], 'edit-input'); $content .= HTMLHelper::createCheckbox("delpartner", 'Verwijder relatie', false, 'edit-input-checkbox'); $content .= '</div>'; $content .= '<hr />'; $content .= '<div class="edit-line">'; $content .= HTMLHelper::createDropdown("ouder1", 'Ouder 1', $dropdown, $r['ouder1'], 'edit-input'); $content .= HTMLHelper::createCheckbox("thuiswonend", 'Thuiswonend', $thuiswonend, 'edit-input-checkbox'); $content .= '</div>'; $content .= '<div class="edit-line">'; $content .= HTMLHelper::createDropdown("ouder2", 'Ouder 2', $dropdown, $r['ouder2'], 'edit-input'); $content .= HTMLHelper::createCheckbox("delouders", 'Verwijder ouderrelaties', false, 'edit-input-checkbox'); $content .= '</div>'; return $content . '</fieldset>'; }
public function check_dealers($dealer_infos, $did, $i, $dealer_list, $ld) { foreach ($dealer_infos[$did] as $aa) { $class_name = isset($dealer_infos[$aa]) ? 'foldbtn' : 'foldbtnnone'; $did = $aa; $aa = $dealer_list[$aa]; if ($aa['Dealer']['status'] == 1) { $img = parent::image('yes.gif', array('style' => 'cursor:pointer;', 'onclick' => 'listTable.toggle(this, "travel_hotels/toggle_on_status", ' . $aa['Dealer']['id'] . ')')); } elseif ($aa['Dealer']['status'] == 0) { $path = Configure::read('themes_host') . '/themed/admin/img/no.gif'; $img = parent::image($path, array('style' => 'cursor:pointer;', 'onclick' => 'listTable.toggle(this, "travel_hotels/toggle_on_status", ' . $aa['Dealer']['id'] . ')')); } $edit = parent::link($ld['edit'], "/dealers/view/{$aa['Dealer']['id']}"); $del = parent::link($ld['delete'], 'javascript:;', array('onclick' => "if(confirm('确认删除该经销商吗?')){list_delete_submit('/admin/dealers/remove/" . $aa['Dealer']['id'] . "');}")); $px = 20 * $i; echo "<tr class ='dr" . $i . "' style='display: none'><td style='padding-left:" . $px . "px'><span class=" . $class_name . ' id=' . $aa['Dealer']['id'] . '></span>' . $aa['Dealer']['name'] . '</td><td>' . $aa['Dealer']['contact_name'] . '</td><td>' . $aa['Dealer']['contact_email'] . '</td><td>' . $aa['Dealer']['contact_tele'] . '</td><td>' . $aa['Dealer']['discount'] . '</td><td>' . $img . '</td>'; if ($this->operator_privilege('dealer_edit') && $this->operator_privilege('dealer_remove') == false) { echo '<td>' . $edit . '</td>'; } elseif ($this->operator_privilege('dealer_remove') && $this->operator_privilege('dealer_edit') == false) { echo '<td>' . $del . '</td>'; } elseif ($this->operator_privilege('dealer_remove') && $this->operator_privilege('dealer_edit')) { echo '<td>' . $edit . $del . '</td>'; } echo '</tr>'; if (isset($dealer_infos[$did])) { $j = $i + 1; $this->check_dealers($dealer_infos, $did, $j, $dealer_list, $ld); } } return true; }
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Edit Template</title> <script src="/WebBuilder/js/tinymce/tinymce.min.js" ></script> <script src="/WebBuilder/js/jquery-2.1.1.min.js" ></script> </head> <?php session_start(); if (!isset($_SESSION['isLogged']) || !$_SESSION['isLogged']) { header('Location: ./../user_manager/login.php'); } else { include './manager/user_Manager/HtmlHelper.php'; $helper = new HTMLHelper(); $html = $helper->readHtmlFromDB($_SESSION['id']); //echo sizeof($html); // print_r($html); } ?> <div style="border: 1px solid gray;"> <h2 style="text-align: center;" >My Tempaltes</h2> <?php for ($i = 0; $i < sizeof($html); $i++) { ?> <form action="/WebBuilder/manager/content_manager/template_editor.php" method="post" id="f_<?php echo $i; ?>
public static function require_http_basic_auth_users(array $users, $text = 'Login') { header('WWW-Authenticate: Basic realm="' . HTMLHelper::escape($text) . '"'); if (isset($_SERVER['PHP_AUTH_USER'])) { $user = $_SERVER['PHP_AUTH_USER']; if (isset($_SERVER['PHP_AUTH_PW'])) { $pass = $_SERVER['PHP_AUTH_PW']; } else { $pass = null; } foreach ((array) $users as $user_data) { if (is_array($user_data) && isset($user_data['user'])) { if ($user_data['user'] == $user && $user_data['password'] == $pass) { header('HTTP/1.0 200 OK'); return true; } } } } if (!isset($_SERVER['PHP_AUTH_USER'])) { header('HTTP/1.0 401 Unauthorized'); header('Status: 401 Unauthorized'); die; } }
<div class="col s1 m1 l1"> <img src="<?php echo $comment['user']['image']['href']; ?> " alt="" class="circle responsive-img" style="width: 100%"> </div> <div class="col s11 m11 l11"> <h6 class="teal-text" style="font-size: 22px"> <?php echo ucfirst($comment['user']['first_name']); ?> <?php echo ucfirst($comment['user']['last_name']); ?> <span class="grey-text" style="font-size: 12px; float: right;"><?php echo HTMLHelper::TimeElapsedString($comment['created']); ?> </span> </h6> <p style="margin-bottom: 40px;"><?php echo $comment['content']; ?> </p> <hr> </div> </div> <?php } ?> <?php } else {
function select_yesno($name, $value = '', $attr = '', $required = false) { $options = array(); $options[] = HTMLHelper::_('htmlinput.option', 'No', 0); $options[] = HTMLHelper::_('htmlinput.option', 'Yes', 1); return self::select($options, $name, $value, $attr, $required); }
public static function javascript_include_tag($js, $options = array()) { $options['src'] = self::javascript_path($js); $options += array('type' => 'text/javascript'); return HTMLHelper::tag('script', '', $options); }
function editContactInterface(&$contact, $location) { global $CONFIG_CA_OU_CHOICES, $CONF_CERT_REQUEST_TEXT; if ($location != 'otherInfo' || false == $_SESSION['user']->isAtLeast('manager')) { return ""; } if (!isset($contact->contact['organizationalUnit'])) { // add new entry menu ... prepare default $contact->contact['organizationalUnit'] = $CONFIG_CA_OU_CHOICES[0]; } if (in_array($contact->contact['organizationalUnit'], $CONFIG_CA_OU_CHOICES)) { $cont = HTMLHelper::createDropdownValuesAreKeys('contact[organizationalUnit]', 'Organizational Unit', $CONFIG_CA_OU_CHOICES, $contact->contact['organizationalUnit'], 'edit-input'); } else { $cont = HTMLHelper::createDropdownValuesAreKeys('contact[organizationalUnit]', 'Organizational Unit', array_merge($CONFIG_CA_OU_CHOICES, array($contact->contact['organizationalUnit'])), $contact->contact['organizationalUnit'], 'edit-input'); } $cont .= HTMLHelper::createCheckbox('AdminCertificateAuthority_new_cert_request', empty($CONF_CERT_REQUEST_TEXT) ? "<span style='color: red;'>REQUEST SSL CERTIFICATE WHEN SAVING</span>" : $CONF_CERT_REQUEST_TEXT, false, 'edit-input-checkbox'); return $cont; }
/** * create the content of recently changed * @return string html-content * @param boolean $compact whether list should be displayed with imported link and user who changed contact * @global Options determine how many days after change the contact should still be shown * @global CONFIG_LIST_NAME_SPEC */ function innerCreate() { global $options, $CONFIG_CHANGEDLIST_NAME_SPEC; $contacts = $this->contactList->getContacts(); $data = array(); foreach ($contacts as $c) { $who = new User(intval($c->contact['whoModified'])); if (!isset($CONFIG_CHANGEDLIST_NAME_SPEC)) { $spec = null; } else { $spec = $CONFIG_CHANGEDLIST_NAME_SPEC; } $data[] = array('display_name' => $c->generateFullName('html', $spec), 'chdate' => date('F j', strtotime($c->contact['lastUpdate'])), 'change' => $c->contact['lastModification'], 'reset' => '<a href="../admin/saveadmin.php?id=' . $c->contact['id'] . '&mode=imported">imported</a>', 'who' => isset($who->contact['id']) ? '<a href="../contact/contact.php?id=' . $who->contact['id'] . '">' . $who->contact['lastname'] . (!empty($who->contact['firstname']) ? ', ' . $who->contact['firstname'] : '') . '</a>' : 'null'); } $tGen = new TableGenerator('changed-list'); $cont = '<table class="changed-list">'; $cont .= '<caption>Recently changed (past ' . $options->getOption('bdayInterval') . ' days)'; if (!$this->expanded) { $cont .= ' <a href="../contact/changedlist.php">expand</a>'; } $cont .= '</caption>'; if (count($data) > 0) { if ($_SESSION['user']->isAtLeast('admin') && $this->expanded) { $cont .= $tGen->generateBody($data, array('display_name', 'chdate', 'change', 'reset', 'who')); } else { $cont .= $tGen->generateBody($data, array('display_name', 'chdate', 'change')); } } else { $cont .= '<tr class="noentry"><td>Nothing changed</td></tr>'; } $cont .= '</table>'; if ($this->expanded) { $cont .= '<div><a href="' . Navigation::previousPageUrl() . '">return</a></div><br>'; } return HTMLHelper::createNestedDivBoxModel('changed-list', $cont); }
public static function get_language_html($language, $text, $arg1 = null, $arg2 = null) { $args = func_get_args(); $text = call_user_func_array(array('ZPHP\\String', 'get_language'), $args); return HTMLHelper::escape($text); }
/** * creates html from currently saved links * * creates a navigation based on nested <ul>'s. Formatting has to be done with css * @param string $class css class for the top-level <ul> * @return string html for the navigation */ function create() { if (empty($this->content) || count($this->content) <= 0) { return ''; } $classhtml = $this->cssclass ? ' class="' . $this->cssclass . '"' : ''; $cont = "<ul {$classhtml}>\n"; foreach ($this->content as $id => $v) { $cont .= '<li' . ($this->opening ? ' onmouseover="einblenden(this);" onmouseout="ausblenden(this);"' : '') . '><a id="' . $id . '" href="' . $v['href'] . '" ' . $v['extraAttributes'] . '>' . $v['caption'] . "</a>\n"; if (isset($v[0])) { $cont .= "<ul>\n"; $i = 0; while (isset($v[$i])) { $cont .= '<li><a href="' . $v[$i]['href'] . '" ' . $v[$i]['extraAttributes'] . '>' . $v[$i]['caption'] . "</a></li>\n"; $i++; } $cont .= "</ul>\n"; } $cont .= "</li>\n"; } $cont .= "</ul>\n"; return HTMLHelper::createNestedDivBoxModel($this->cssclass, $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'); //$cont .= '</div>'; $cont .= '<div class="edit-line">'; $cont .= HTMLHelper::createTextField("address[{$i}][line1]", 'Address (Line 1)', $a['line1'], 'edit-input'); 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}][line2]", 'Address (Line 2)', $a['line2'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][zip]", 'Zip-code', $a['zip'], 'edit-input'); $cont .= HTMLHelper::createTextField("address[{$i}][city]", 'City', $a['city'], '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::createTextField("address[{$i}][state]", 'State', $a['state'], '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; }
/** * Appends a 'relationships' section to the output XML that contains an XHTML table with loglines * @return string XML content */ function xmlExport(&$contact) { //global $errorHandler; global $CONFIG_DB_PREFIX, $CONFIG_REL_XML_OTHER_PROPERTIES, $CONFIG_REL_XML_DATE_PROPERTIES, $CONFIG_RELT_XML_OTHER_PROPERTIES, $CONFIG_RELT_XML_DATE_PROPERTIES; $db = DB::getSingleton(); $content = "<relationships>\n"; // fetch dropdown $dropdown = $this->getDropdown($db); $content .= '<ddJSON>' . HTMLHelper::arrayToJSON($dropdown) . '</ddJSON>'; // list outgoing relationships $id = $contact->contact['id']; $db->query("SELECT r.* FROM `{$CONFIG_DB_PREFIX}Relationships` as r, `{$CONFIG_DB_PREFIX}contact` as c WHERE r.ownerId={$id} AND c.id=r.ownerId AND c.hidden=0", 'Relationships'); $i = 0; while ($r = $db->next('Relationships')) { $to = htmlspecialchars($r['relatedToId'], ENT_NOQUOTES, 'UTF-8'); $desc = htmlspecialchars($r['relationship'], ENT_NOQUOTES, 'UTF-8'); $content .= "<relationship>\n<ownerId>{$id}</ownerId>\n<relatedToId>{$to}</relatedToId>\n<relatedTo>"; $relatedTo = new Contact($r['relatedToId']); $content .= $relatedTo->generateFullName() . "</relatedTo>\n"; foreach ($CONFIG_REL_XML_OTHER_PROPERTIES as $tag => $prop) { $p = $relatedTo->getProperty('other', $prop); $content .= "<{$tag}>" . ($p !== FALSE ? $p : '') . "</{$tag}>"; } foreach ($CONFIG_REL_XML_DATE_PROPERTIES as $tag => $prop) { $p = $relatedTo->getDate($prop); $content .= "<{$tag}><from>" . ($p !== FALSE ? $p[0] : '') . "</from><to>" . ($p !== FALSE ? $p[1] : '') . "</to></{$tag}>"; } $content .= "<description>{$desc}</description>\n</relationship>\n"; } // list incoming relationships $id = $contact->contact['id']; $db->query("SELECT r.* FROM `{$CONFIG_DB_PREFIX}Relationships` as r, `{$CONFIG_DB_PREFIX}contact` as c WHERE r.relatedToId={$id} AND c.id=r.relatedToId AND c.hidden=0", 'Relationships'); $i = 0; while ($r = $db->next('Relationships')) { $id = $r['ownerId']; $to = htmlspecialchars($r['relatedToId'], ENT_NOQUOTES, 'UTF-8'); $desc = htmlspecialchars($r['relationship'], ENT_NOQUOTES, 'UTF-8'); $content .= "<relationshipTarget>\n<ownerId>{$id}</ownerId>\n<relatedToId>{$to}</relatedToId>\n<relatedTo>"; $relatedTo = new Contact($id); $content .= $relatedTo->generateFullName() . "</relatedTo>\n"; foreach ($CONFIG_RELT_XML_OTHER_PROPERTIES as $tag => $prop) { $p = $relatedTo->getProperty('other', $prop); $content .= "<{$tag}>" . ($p !== FALSE ? $p : '') . "</{$tag}>"; } foreach ($CONFIG_RELT_XML_DATE_PROPERTIES as $tag => $prop) { $p = $relatedTo->getDate($prop); $content .= "<{$tag}><from>" . ($p !== FALSE ? $p[0] : '') . "</from><to>" . ($p !== FALSE ? $p[1] : '') . "</to></{$tag}>"; } $content .= "<description>{$desc}</description>\n</relationshipTarget>\n"; } $content .= "</relationships>\n"; return $content; }
public function redirect_to($obj_or_url) { $link = HTMLHelper::link_from_obj_or_string($obj_or_url); /* prevent any content from getting to the user */ while (($l = ob_get_level()) && $l >= $this->start_ob_level) { ob_end_clean(); } if (Config::log_level_at_least("full")) { Log::info("Redirected to " . $link); } $this->redirected_to = $link; /* end session first so it can write the cookie */ session_write_close(); Request::send_status_header(302); header("Location: " . $link); }
/** * STATIC method that creates a dropdown list from an array of options * * @param string $name which name is to be used for the dropdown * @param string $label label of the dropdown (null if none) * @param array $options normal array with displayed option text == option value (must be unique!) * @param string $selected option value of the item that should be pre-selected * @param boolean $insideDiv Is the box within its own div? default=true * @param array $extraAttributes = Javascript functions or style='...' could be placed here - placed in the <select ...> tag * @return string html-content * @static */ function createDropdownValuesAreKeys($name, $label, $options, $selected, $cssClass = null, $insideDiv = true, $extraAttributes = '') { $newOpt = array(); foreach ($options as $k => $s) { // automatically delete duplicates $newOpt[$s] = $s; } return HTMLHelper::createDropdown($name, $label, $newOpt, $selected, $cssClass, $insideDiv, $extraAttributes); }
/** * creates the traditional output of TAB */ function createNormalContact() { global $pluginManager, $CONFIG_CONTACT_NAME_SPEC; if (!isset($CONFIG_CONTACT_NAME_SPEC)) { $CONFIG_CONTACT_NAME_SPEC = array(array('namePrefix', ' '), array('firstname', ' '), array('middlename', ' '), 'lastname', array(', ', 'nameSuffix')); } $title = HTMLHelper::createNestedDivBoxModel('card-title', $this->contact->groups() . $this->contact->generateFullName('html', $CONFIG_CONTACT_NAME_SPEC)); $top = '<div class="card-top">'; $top .= $this->image->html('card-picture'); $top .= $this->contact->addresses(); // Output emphomess $top .= '<div class="card-emphomess">'; $top .= $this->contact->emails(NULL, NULL); // return not address associated emails $top .= $this->contact->phones(NULL, NULL); $top .= $this->contact->messaging(NULL, NULL); $top .= '</div></div>'; $bot = '<div class="card-bottom">'; $bot .= $this->contact->additionals(NULL, NULL); $bot .= $this->contact->dates(NULL, NULL); $bot .= $this->contact->webs(NULL, NULL); $bot .= $pluginManager->contactOutput($this->contact, 'beforeNotes'); $bot .= $this->createUserInfo(); $bot .= $this->contact->notes(); $bot .= '</div>'; $box = $title . HTMLHelper::createNestedDivBoxModel('card-box', $top . $bot); $link = ''; if (isset($this->contact->contact['whoModified'])) { $who = new User(intval($this->contact->contact['whoModified'])); if (isset($who->contact['id'])) { $link = ' by <a class="update" href="' . $_SERVER['PHP_SELF'] . '?id=' . $who->contact['id'] . '">' . $who->contact['lastname'] . ', ' . $who->contact['firstname'] . '</a>'; } else { $errorHandler->clear('argVal'); } } $footer = '<div class="update"><span>This entry was last updated on</span> ' . $this->contact->contact['lastUpdate'] . $link . '</div></div>'; return '<div class="vcard">' . $box . '</div>' . $footer; }
/** * create the table containing the contacts * * @uses Contact * @return string html-content * @global GroupNormalizer used to modify the contact names, in order to get them correctly grouped * @uses TableGenerator */ function createTable() { global $groupNormalizer; // create big table $contacts = $this->contactList->getContacts(); $data = array(); foreach ($contacts as $c) { if ($this->expand) { $p = Page::newPage('PageContact', $c); $data[] = array('cont' => $p->innerCreate(), 'css_class' => 'list-expanded-card', 'group_n' => $groupNormalizer->normalize(mb_substr($c->contact['lastname'], 0, 1))); continue; } $data[] = $c->generateListRowArray(); } $tGen = new TableGenerator('contact-list'); $cont = '<table class="contact-list">'; $cont .= '<caption>' . $this->contactList->getGroupCaption() . '</caption>'; if (count($data) > 0) { if ($this->expand) { $cont .= $tGen->generateBody($data, array('cont'), 'css_class', 'group_n'); } else { $cont .= $tGen->generateBody($data, range(0, count($data[0]) - 3), 'css_class', 'group_n'); } } else { $cont .= '<tr class="noentry"><td>No Entries.</td></tr>'; } $cont .= '</table>'; return HTMLHelper::createNestedDivBoxModel('contact-list', $cont); }
/** * Creates the part of the fieldset for touch conditions * @return string html for part */ function createConditionsPart($cid) { $db = DB::getSingleton(); $cont = '<h2>conditions</h2>'; $ownid = $_SESSION['user']->contact['id']; if ($cid) { $db->query("SELECT * FROM " . INTOUCH_TABLE_CONDS . " AS conds WHERE ownerID = {$ownid} AND touchedID = {$cid}"); } for ($i = 0; $i < ($cid ? $db->rowsAffected() : 0) + 2; $i++) { if (!($val = $db->next())) { $val = array('initiative' => 'active', 'distance' => 'remote', 'type' => '%', 'days' => ''); } $cont .= '<div>'; $cont .= HTMLHelper::createDropdownValuesAreKeys("inTouch[conds][{$i}][initiative]", null, array('active', 'passive'), $val['initiative'], null, false); $cont .= HTMLHelper::createDropdownValuesAreKeys("inTouch[conds][{$i}][distance]", null, array('remote', 'local'), $val['distance'], null, false); $cont .= HTMLHelper::createTextField("inTouch[conds][{$i}][type]", null, $val['type'], null, false); $cont .= HTMLHelper::createTextField("inTouch[conds][{$i}][days]", null, $val['days'], 'edit-property-label', false); $cont .= '</div>'; } return $cont; }
function editContactInterface(&$contact, $location) { global $CONFIG_ADMIN_REQUEST_INTERFACE; if ($location != 'ownFieldset') { return ""; } if (!$_SESSION['user']->isAtLeast('manager')) { return ""; } $content = '<fieldset class="edit-names">'; $content .= '<legend>Administrative Requests</legend>'; foreach ($CONFIG_ADMIN_REQUEST_INTERFACE as $k => $v) { switch ($v['interface']) { case 'textfield': $content .= HTMLHelper::createTextField('AdminRequest[' . $k . ']', $v['label'], $v['default'], 'edit-input'); break; case 'checkbox': $content .= HTMLHelper::createCheckbox('AdminRequest[' . $k . ']', $v['label'], $v['default'], 'edit-input-checkbox'); break; case 'html': $content .= $v['html']; break; } } return $content . '</fieldset>'; }
/** * create a textarea for an arbitrary value group * * the values of the group are separated by |'s * @param string $type which value group of the contact is to be shown * @param integer $cols how many columns should the textarea have * @return string html-content */ function createValueGroupTextarea($type, $cols) { $v = ''; $vals = $this->contact->getValueGroup($type); foreach ($vals as $m) { $v .= "{$m['value']}|{$m['label']}" . ($m['visibility'] == 'hidden' ? '|h' : '') . ($m['visibility'] == 'admin-hidden' ? '|a' : '') . "\n"; } $cont .= HTMLHelper::createTextarea($type, $v, count($vals) + 2, $cols, null, false); return $cont; }
/** * create the goto text-box * @return string html-content * @global array custom searchtypes defined in config.php */ function createSearchInterface() { global $CONFIG_SEARCH_CUSTOM; $this->addHeaderSection('<style type="text/css"> label { display: block; } table { width:100%; } td { vertical-align: top; } </style>'); $cont = '<br/><form method="post" action="../contact/searchlist.php">'; $cont .= "\n<table><tr><td>"; $projPos = array('', 'Project Manager', 'UTC Project Specialist', 'IUTC Project Specialist', 'PT Project Specialist', 'Parking Project Specialist', 'Technical Engineer', 'Civil Engineer', 'Traffic Signal Specialist', 'UTC System Specialist'); $projCat = array('', 'Urban Traffic', 'Interurban Traffic', 'Public / Freight', 'Transport', 'Tunnel', 'Infomobility', 'Service / Maintenance'); $projCon = array('', 'Prime Contractor', 'Subcontractor', 'Managing Contractor', 'Partner in a joint venture'); // Projects $cont .= "\n<br/><h3>Project Reference Search</h3>"; $cont .= HTMLHelper::createDropdownValuesAreKeys('p-category', 'Project Category', $projCat, isset($_POST['p-category']) ? $_POST['p-category'] : ''); $cont .= HTMLHelper::createDropdownValuesAreKeys('p-role', 'Contract Role', $projCon, isset($_POST['p-role']) ? $_POST['p-role'] : ''); $cont .= HTMLHelper::createTextField('p-company', 'Lead Company', isset($_POST['p-company']) ? $_POST['p-company'] : ''); $cont .= HTMLHelper::createTextField('p-value', 'Value of SWARCO part more than (EUR)', isset($_POST['p-value']) ? $_POST['p-value'] : ''); $cont .= HTMLHelper::createTextField('p-after', 'Projects completed after', isset($_POST['p-after']) ? $_POST['p-after'] : ''); // Project Ops $cont .= "</td><td>\n<br/><h3>Project Opportunity Search</h3>"; $cont .= HTMLHelper::createDropdownValuesAreKeys('o-category', 'Project Category', $projCat, isset($_POST['o-category']) ? $_POST['o-category'] : ''); $projCon = array('', 'Prime Contractor', 'Subcontractor', 'Managing Contractor', 'Partner in a joint venture'); $cont .= HTMLHelper::createDropdownValuesAreKeys('o-role', 'Contract Role', $projCon, isset($_POST['o-role']) ? $_POST['o-role'] : ''); $cont .= HTMLHelper::createTextField('o-company', 'Lead Company', isset($_POST['o-company']) ? $_POST['o-company'] : ''); $cont .= HTMLHelper::createTextField('o-value', 'Value of SWARCO part more than (EUR)', isset($_POST['o-value']) ? $_POST['o-value'] : ''); // Candidates $cont .= "</td><td>\n<br/><h3>Project Candidate Search</h3>"; $cont .= HTMLHelper::createDropdownValuesAreKeys('c-position', 'Project Position', $projPos, isset($_POST['c-position']) ? $_POST['c-position'] : ''); $cont .= HTMLHelper::createTextField('c-experience', 'Experience with the Project Position since', isset($_POST['c-experience']) ? $_POST['c-experience'] : ''); //$cont .= HTMLHelper::createDropdownValuesAreKeys('c-category','SWARCO Project Category',$projCat,''); //$cont .= HTMLHelper::createTextField('c-value','Value of SWARCO part more than (EUR)'); //$cont .= HTMLHelper::createTextField('c-after','Projects completed after'); $cont .= '</td></tr><tr><td colspan="2" style="text-align: right;">' . HTMLHelper::createButton('clear', 'button', 'onclick="window.location=\'' . $_SERVER['PHP_SELF'] . '\';"') . '</td><td style="text-align: right;">' . HTMLHelper::createButton('search') . '</td><td style="text-align: right;">' . HTMLHelper::createButton('export', 'submit', 'name="export"') . '</td></tr>'; $cont .= '</table><br>'; // make some space ... $cont .= '</form>'; return $cont; }