<?php require_once '../lib/flip.php'; session_start(); check_valid_user(); if (!isset($_GET['org_id'])) { display_warning('Wybierz organizacjê!'); exit; } display_html_header(); display_document_header(); display_menu(); echo '<table width="90%">' . "\n"; echo '<tr><td align="center" class="naglowek">Dane organizacji <i>' . htmlspecialchars(stripslashes(get_org_name($_GET['org_id']))) . '</i>'; if (is_responsible($_SESSION['valid_user_id'], $_GET['org_id']) || is_admin()) { echo ' [<a href="../add/add_org_info_form.php?org_id=' . $_GET['org_id'] . '" class="menu">Edytuj</a>]'; } echo "<hr></td></tr>\n"; $org_info = get_org_info($_GET['org_id']); echo '<tr><td>'; if (!$org_info) { echo 'Brak danych o organizacji.</td></tr>'; } else { echo '<table align="center">'; $content = array('Adres' => htmlspecialchars($org_info['city'] . ', ' . $org_info['street']), 'Telefon' => htmlspecialchars(parse_phone_number($org_info['phone'])), 'Fax' => htmlspecialchars(parse_phone_number($org_info['fax'])), 'WWW' => strpos($org_info['www'], '.') === false ? '-' : '<a href="' . htmlspecialchars($org_info['www']) . '" target="_blank" class="menu">' . htmlspecialchars($org_info['www']) . '</a>', 'Profil dzia³alno¶ci' => htmlspecialchars($org_info['profile']), 'Data ostatniej aktualizacji' => $org_info['date']); $contact_person = get_contact_person($_GET['org_id']); if ($contact_person !== false && !empty($contact_person)) { $content['Osoba kontaktowa'] = htmlspecialchars($contact_person); } foreach ($content as $label => $value) { echo '<tr><td width="50%" align="right"><b>' . $label . ':</b></td><td width="50%" align="left">';
exit; } display_html_header(); display_document_header(); display_menu(); echo '<table width="90%">' . "\n"; echo '<tr><td align="center" class="naglowek">Uzupe³nij dane o organizacji <i>' . htmlspecialchars(get_org_name($_GET['org_id'])) . "</i><hr></td></tr>\n"; echo '<tr><td><table align="center">'; echo '<form method="POST" action="add_org_info.php">' . "\n"; echo '<input type="hidden" name="org_id" value="' . $_GET['org_id'] . '">' . "\n"; if (isset($_GET['project_id'])) { echo '<input type="hidden" name="project_id" value="' . $_GET['project_id'] . '">' . "\n"; } $org_info = get_org_info($_GET['org_id']); $defaults = array(); $defaults['name'] = get_org_name($_GET['org_id']); if ($org_info === false) { $defaults['street'] = 'ul. '; $defaults['city'] = '£ód¼'; $defaults['phone'] = '+4842 '; $defaults['fax'] = '+4842 '; $defaults['www'] = 'http://'; $defaults['profile'] = 'Tu wpisz krótko, czym zajmuje siê organizacja'; } else { $org_info['phone'] = parse_phone_number($org_info['phone']); $org_info['fax'] = parse_phone_number($org_info['fax']); $defaults = array_merge($defaults, $org_info); } $fields = array(); if (is_admin()) { $fields['Nazwa'] = array('name', 100, 30);
function display_link_to_search_org($org_id) { ?> <a href="http://www.pf.pl/portal/YP1?keyword=<?php echo urlencode(get_org_name($org_id)); ?> &city=%C5%81%C3%B3dzkie&kw=f" target="_blank"><img src="<?php echo get_www_root(); ?> img/magnify.jpg" border="0" height="18" width="18" alt="Szukaj w Internecie"></a> <?php }
} } if (isset($_POST['name'])) { if (empty($_POST['name'])) { display_warning('Uzupe³nij poprawnie formularz!'); exit; } if (!is_admin()) { display_document_header(); display_html_header(); display_menu(); display_no_auth(); display_document_footer(); exit; } else { if (get_org_name($_POST['org_id']) !== stripslashes($_POST['name']) && org_exists($_POST['name'])) { display_warning('Organizacja o nazwie ' . htmlspecialchars(stripslashes($_POST['name'])) . ' ju¿ istnieje!'); exit; } } } foreach (array('phone', 'fax') as $type) { $_POST[$type] = str_replace(array(' ', '-'), '', $_POST[$type]); } if (update_org($_POST)) { $warning = 'Operacja zakoñczona sukcesem!'; if (isset($_POST['project_id'])) { $types = array('telefon', 'spotkanie'); foreach ($types as $type) { $warning .= '</p><p class="naglowek_maly">Kliknij <a href="add_contact_form.php?org_id=' . $_POST['org_id'] . '&project_id=' . $_POST['project_id'] . '&type=' . $type . '" class="org_nowa">tu</a>, aby dodaæ ' . $type . '.'; }
echo "<body>\n"; echo 'FLIP - wydruk organizacji u¿ytkownika ' . htmlspecialchars(get_user_login($_SESSION['valid_user_id'])) . ' wygenerowany dnia ' . date('Y-m-d') . "<br><br>\n"; $fields = array('name' => 'Nazwa', 'city' => 'Miejscowo¶æ', 'street' => 'Ulica', 'phone' => 'Telefon', 'fax' => 'Fax', 'www' => 'WWW', 'profile' => 'Profil dzia³alno¶ci', 'date' => 'Data aktualizacji danych', 'updater_id' => 'Osoba aktualizuj±ca dane'); echo '<table border="1" cellspacing="0" cellpadding="2"><tr><th>Nazwa</th>'; $num_info = 0; $info_fields = array(); foreach (array_keys($_POST) as $key) { if ('orgs' !== $key && 'comments' !== $key) { echo '<th>' . $fields[$key] . '</th>'; ++$num_info; $info_fields[] = $key; } } echo "</tr>\n"; foreach (array_keys($_POST['orgs']) as $org_id) { echo '<tr><td>' . htmlspecialchars(get_org_name($org_id)) . '</td>'; $org_info = get_org_info($org_id); if (false === $org_info) { for ($i = 0; $i < $num_info; ++$i) { echo '<td>-</td>'; } } else { reset($info_fields); for ($i = 0; $i < $num_info; ++$i) { $field = each($info_fields); $field = $field[1]; if ($field == 'updater_id') { $content = htmlspecialchars(get_user_login($org_info[$field])); } else { if ($field == 'phone' || $field == 'fax') { $content = parse_phone_number($org_info[$field]);