echo '<td>'; display_exclamation('Masz nowe organizacje'); echo '</td>'; } } echo "</tr></table></td></tr>\n"; echo "<tr><td><table>\n"; if (empty($filter_orgs)) { echo '<tr><td>Brak organizacji.</td></tr>' . "\n"; } else { echo '<tr><td colspan="4" align="right" class="naglowek_maly">[Dodaj kontakt]</td></tr>' . "\n"; $num_org = 1; foreach ($filter_orgs as $org) { echo '<tr><td>' . $num_org . '. </td><td width="500">'; ++$num_org; if (empty_org($org)) { echo '<table><tr><td>'; display_link_to_search_org($org); echo '</td><td>'; display_link_to_org($org, true, $project_id); echo "</td></tr></table>\n"; } else { display_link_to_org($org, true, $project_id); } echo '</td><td>'; display_add_contact($org, $project_id, 'telefon'); echo '</td><td>'; display_add_contact($org, $project_id, 'spotkanie'); echo "</td></tr>\n"; } }
function display_link_to_org($org_id, $add = false, $project_id = false) { $class = 'org_otwarta'; $href = get_www_root() . 'show/show_org.php?org_id=' . $org_id; $org_info = get_org_info($org_id); $title = 'Adres: ' . (empty($org_info['street']) || empty($org_info['city']) ? '-' : htmlspecialchars($org_info['city'] . ', ' . $org_info['street'])) . "\nTelefon: " . htmlspecialchars(parse_phone_number($org_info['phone'])) . "\nOsoba kontaktowana: " . htmlspecialchars(get_contact_person($org_id)); if ($add) { if (empty_org($org_id)) { $class = 'org_nowa'; $href = get_www_root() . 'add/add_org_info_form.php?org_id=' . $org_id . '&project_id=' . $project_id; $title = 'Uzupe³nij dane o organizacji'; } elseif (!org_is_contacted($org_id, $_SESSION['valid_user_id'], $project_id)) { $class = 'org_nowa'; } } ?> <a href="<?php echo $href; ?> " class="<?php echo $class; ?> " title="<?php echo $title; ?> "><?php echo htmlspecialchars(stripslashes(get_org_name($org_id))); ?> </a><?php }
} if (!isset($_GET['project_id'])) { display_warning('Musisz wybraæ projekt!'); exit; } if (!isset($_GET['type']) || $_GET['type'] != 'telefon' && $_GET['type'] != 'spotkanie') { display_warning('Wybierz poprawnie typ kontaktu!'); exit; } // cannot add contacts to this organisation if (!is_responsible($_SESSION['valid_user_id'], $_GET['org_id']) && !is_admin()) { display_warning('Nie mo¿esz dodawaæ zdarzeñ dla tej organizacji!'); exit; } // if organisation data is not set, redirect to add_org_info_form.php if (empty_org($_GET['org_id'])) { header('location: add_org_info_form.php?org_id=' . $_GET['org_id'] . '&project_id=' . $_GET['project_id']); } // the $data array holds all the information about the contact $data['organisation_id'] = $_GET['org_id']; $data['project_id'] = $_GET['project_id']; $today = getdate(); // default date of contact is today $data['year'] = $today['year']; $data['month'] = $today['mon']; $data['day'] = $today['mday']; $data['type'] = $_GET['type']; // for easier use, last contact person is copied $org_contacts = get_contacts('organisation_id', $data['organisation_id']); $last_contact = get_contact_details($org_contacts[0]); $data['contact_person'] = $last_contact['contact_person'];
function get_org_info($org_id) { if (empty_org($org_id)) { return false; } $q = 'select street, city, phone, fax, www, profile, date, updater_id from organisations where organisation_id=' . $org_id; db_connect(); $r = mysql_query($q); if ($r === false) { return false; } return mysql_fetch_array($r, MYSQL_ASSOC); }