Example #1
0
        echo "<td class='center'><a href='vcard{$page_ext_qry}id={$id}'><img src='{$url_images}icons/vcard.png' title='vCard' alt='vCard'/></a></td>";
        if (substr($phone, 0, 1) == "0" || substr($phone, 0, 3) == "+41") {
            $country = "Switzerland";
        } else {
            $country = "";
        }
        if ($map_guess) {
            if ($myrow["address"] != "") {
                echo "<td class='center'><a href='http://maps.google.com/maps?q=" . urlencode(trim(str_replace("\r\n", ", ", $myrow["address"])) . ", {$country}") . "&amp;t=h'>\n                              <img src='{$url_images}icons/car.png' title='Google Maps' alt='vCard' /></a></td>";
            } else {
                echo "<td/>";
            }
        }
        if ($homepage != "") {
            $homepage = strcasecmp(substr($homepage, 0, strlen("http")), "http") == 0 ? $homepage : "http://" . $homepage;
            echo "<td class='center'><a href='{$homepage}'><img src='{$url_images}icons/house.png' title='{$homepage}' alt='{$homepage}'/></a></td>";
        } elseif (($homepage = guessHomepage($email, $email2)) != "") {
            echo "<td class='center'><a href='http://{$homepage}'><img src='{$url_images}icons/house.png' title='" . ucfmsg("GUESSED_HOMEPAGE") . " ({$homepage})' alt='" . ucfmsg("GUESSED_HOMEPAGE") . " ({$homepage})'/></a></td>";
        } else {
            echo "<td/>";
        }
        echo "</tr>\n";
        $tablespace++;
    }
}
if ($use_ics) {
    echo "END:VCALENDAR\r\n";
} else {
    echo "</table>";
    include "include/footer.inc.php";
}
Example #2
0
function addRow($row)
{
    global $addr, $page_ext_qry, $url_images, $read_only, $map_guess, $full_phone, $homepage_guess;
    $myrow = $addr->getData();
    foreach ($myrow as $mycol => $mycolval) {
        ${$mycol} = $mycolval;
    }
    $email = $addr->firstEMail();
    if ($email != "" && $email != $myrow['email2']) {
        $email2 = $myrow['email2'];
    } else {
        $email2 = "";
    }
    // Special value for short phone
    $row = $row == "telephone" ? "phone" : $row;
    if ($row == "phone") {
        if ($full_phone) {
            $phone = $addr->firstPhone();
        } else {
            $phone = $addr->shortPhone();
        }
    }
    switch ($row) {
        case "select":
            $emails = implode(getMailerDelim(), $addr->getEMails());
            echo "<td class='center'><input type='checkbox' id='{$id}' name='selected[]' value='{$id}' title='Select ({$firstname} {$lastname})' alt='Select ({$firstname} {$lastname})' accept='{$emails}' /></td>";
            break;
        case "first_last":
            echo "<td>{$firstname} " . (!empty($middlename) ? $middlename . " " : "") . "{$lastname}</td>";
            break;
        case "last_first":
            echo "<td>" . (!empty($middlename) ? $middlename . " " : "") . "{$lastname} {$firstname}</td>";
            break;
        case "photo":
            //        echo "<td>".embeddedImg($photo)."</td>";
            /*
                    if($photo != "") {
                      echo "<td><img width=75 src='photo.php?id=".$id."'></td>";
                    } else {
                      echo "<td></td>";
                    }
            //*/
            echo "<td>";
            echo $addr->getPhoto();
            echo "</td>";
            break;
        case "email":
        case "email2":
            echo "<td><a href='" . getMailer() . "{${$row}}'>{${$row}}</a></td>";
            break;
        case "all_phones":
            $phones = $addr->shortPhones();
            echo "<td>" . implode("<br>", $phones) . "</td>";
            break;
        case "all_emails":
            $emails = $addr->getEMails();
            $amails = array();
            foreach ($emails as $amail) {
                $amails[] = "<a href='" . getMailer() . "{$amail}'>{$amail}</a>";
            }
            echo "<td>" . implode("<br>", $amails) . "</td>";
            break;
        case "address":
            echo "<td>" . str_replace("\n", "<br>", $address) . "</td>";
            break;
        case "edit":
            echo "<td class='center'><a href='view{$page_ext_qry}id={$id}'><img src='{$url_images}icons/status_online.png' title='" . ucfmsg('DETAILS') . "' alt='" . ucfmsg('DETAILS') . "' /></a></td>";
            if (!$read_only) {
                echo "<td class='center'><a href='edit{$page_ext_qry}id={$id}'><img src='{$url_images}icons/pencil.png' title='" . ucfmsg('EDIT') . "' alt='" . ucfmsg('EDIT') . "'/></a></td>";
            }
            break;
        case "vcard":
            echo "<td class='center'><a href='vcard{$page_ext_qry}id={$id}'><img src='{$url_images}icons/vcard.png' title='vCard' alt='vCard'/></a></td>";
            break;
        case "map":
            if ($map_guess) {
                if ($myrow["address"] != "") {
                    echo "<td class='center'><a href='http://maps.google.com/maps?q=" . urlencode(trim(str_replace("\r\n", ", ", trim($myrow["address"])))) . "&amp;t=h' target='_blank'>\n                                <img src='{$url_images}icons/car.png' title='Google Maps' alt='vCard'/></a></td>";
                } else {
                    echo "<td/>";
                }
            }
            break;
        case "homepage":
            if ($homepage != "") {
                $homepage = strcasecmp(substr($homepage, 0, strlen("http")), "http") == 0 ? $homepage : "http://" . $homepage;
                echo "<td class='center'><a href='{$homepage}'><img src='{$url_images}icons/house.png' title='{$homepage}' alt='{$homepage}'/></a></td>";
            } elseif ($homepage_guess && ($homepage = guessHomepage($email, $email2)) != "") {
                echo "<td class='center'><a href='http://{$homepage}'><img src='{$url_images}icons/house.png' title='" . ucfmsg("GUESSED_HOMEPAGE") . " ({$homepage})' alt='" . ucfmsg("GUESSED_HOMEPAGE") . " ({$homepage})'/></a></td>";
            } else {
                echo "<td/>";
            }
            break;
        case "details":
            echo "<td class='center'><a href='vcard{$page_ext_qry}id={$id}'><img src='{$url_images}icons/vcard.png' title='vCard' alt='vCard'/></a></td>";
            if ($map_guess) {
                if ($myrow["address"] != "") {
                    echo "<td class='center'><a href='http://maps.google.com/maps?q=" . urlencode(trim(str_replace("\r\n", ", ", trim($myrow["address"])))) . "&amp;t=h' target='_blank'>\n                                <img src='{$url_images}icons/car.png' title='Google Maps' alt='vCard'/></a></td>";
                } else {
                    echo "<td/>";
                }
            }
            if ($homepage != "") {
                $homepage = strcasecmp(substr($homepage, 0, strlen("http")), "http") == 0 ? $homepage : "http://" . $homepage;
                echo "<td class='center'><a href='{$homepage}'><img src='{$url_images}icons/house.png' title='{$homepage}' alt='{$homepage}'/></a></td>";
            } elseif ($homepage_guess && ($homepage = guessHomepage($email, $email2)) != "") {
                echo "<td class='center'><a href='http://{$homepage}'><img src='{$url_images}icons/house.png' title='" . ucfmsg("GUESSED_HOMEPAGE") . " ({$homepage})' alt='" . ucfmsg("GUESSED_HOMEPAGE") . " ({$homepage})'/></a></td>";
            } else {
                echo "<td/>";
            }
            break;
        default:
            // firstname, lastname, home, mobile, work, fax, phone2
            echo "<td>{${$row}}</td>";
    }
}