Esempio n. 1
0
/**
 * $Id$
 *  
 * @category Astreintes
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$user_id = CValue::get("user_id");
$muser = new CMediusers();
$muser->load($user_id);
$user = $muser->loadRefUser();
$muser->loadRefFunction()->loadRefGroup();
$phones = array();
addPhone("CUser-user_astreinte", $user->user_astreinte, $phones);
addPhone("CUser-user_mobile", $user->user_mobile, $phones);
addPhone("CUser-user_phone", $user->user_phone, $phones);
addPhone("CFunctions-tel", $muser->_ref_function->tel, $phones);
function addPhone($field_str, $field, &$phones)
{
    if ($field && !in_array($field, $phones)) {
        $phones[$field_str] = $field;
    }
}
//smarty
$smarty = new CSmartyDP();
$smarty->assign("phones", $phones);
$smarty->display("inc_list_phones.tpl");
Esempio n. 2
0
function showOneEntry($r, $only_phone = false)
{
    global $db, $table, $table_grp_adr, $table_groups, $print, $is_fix_group, $mail_as_image, $page_ext_qry;
    $view = "";
    $view .= add("<b>" . $r['firstname'] . (!empty($r['middlename']) ? " " . $r['middlename'] : "") . " " . $r['lastname'] . "</b>");
    $view .= add($r['nickname']);
    $b64 = explode(";", $r['photo']);
    if (count($b64) >= 3 && !$only_phone) {
        $b64 = $b64[2];
        $b64 = explode(":", $b64);
        if (count($b64) >= 2) {
            $b64 = str_replace(" ", "", $b64[1]);
            $view .= $r['photo'] != "" ? '<img alt="Embedded Image" width=75 src="data:image/jpg;base64,' . $b64 . '"/><br>' : "";
        }
    }
    if (!$only_phone) {
        $view .= ($r['title'] != "" ? "<i>" : "") . add($r['title']) . ($r['title'] != "" ? "</i>" : "");
        $view .= add($r['company']);
        //     $view .= addGroup($r, array('address'));
        $view .= add(str_replace("\n", "<br />", trim($r["address"])));
        $view .= addGroup($r, array('home', 'mobile', 'work', 'fax'));
    }
    $view .= addPhone($r['home'], ucfmsg('H:'));
    $view .= addPhone($r['mobile'], ucfmsg('M:'));
    $view .= addPhone($r['work'], ucfmsg('W:'));
    $view .= addPhone($r['fax'], ucfmsg('F:'));
    if (!$only_phone) {
        $view .= addGroup($r, array('email', 'email2', 'email3', 'homepage'));
        if ($mail_as_image) {
            // B64IMG: Thanks to NelloD
            $view .= $r['email'] != "" ? "<img src=\"b64img.php?text=" . base64_encode($r['email']) . "\"><br/>" : "";
            $view .= $r['email2'] != "" ? "<img src=\"b64img.php?text=" . base64_encode($r['email2']) . "\"><br/>" : "";
            $view .= $r['email3'] != "" ? "<img src=\"b64img.php?text=" . base64_encode($r['email3']) . "\"><br/>" : "";
        } else {
            $view .= addEmail($r['email']);
            $view .= addEmail($r['email2']);
            $view .= addEmail($r['email3']);
        }
        $view .= addHomepage($r['homepage']);
        $view .= addGroup($r, array('bday', 'bmonth', 'byear'));
        $view .= addBirthday($r['bday'], $r['bmonth'], $r['byear'], ucfmsg('BIRTHDAY'));
        $view .= addBirthday($r['aday'], $r['amonth'], $r['ayear'], ucfmsg('ANNIVERSARY'));
        $view .= addGroup($r, array('address2', 'phone2'));
        $view .= add(str_replace("\n", "<br />", trim($r['address2'])));
        $view .= addGroup($r, array('phone2'));
    }
    $view .= add($r['phone2'], ucfmsg('P:'));
    if (!$only_phone) {
        // Detect URLs (http://*, www.*) and show as link.
        //
        // $text = "Hello, http://www.google.com";
        // $new = preg_replace("/(http:\/\/[^\s]+)/", "<a href=\"$1\">$1</a>", $test);
        //
        $view .= $r['notes'] != "" ? "<br />" . str_replace("\n", "<br />", trim($r['notes'])) . "<br /><br />" : "";
    }
    echo $view . "\n";
    if (!isset($print) and !$is_fix_group) {
        $sql = "SELECT DISTINCT {$table_groups}.group_id, group_name\n\t             FROM {$table_grp_adr}, {$table_groups}, {$table}\n\t            WHERE {$table}.id = {$table_grp_adr}.id\n\t              AND {$table}.id = " . $r['id'] . "\n\t              AND {$table_grp_adr}.group_id  = {$table_groups}.group_id";
        $result = mysql_query($sql, $db);
        $first = true;
        while ($result && ($g = mysql_fetch_array($result))) {
            if ($first) {
                echo "<br /><i>" . ucfmsg('MEMBER_OF') . ": ";
            } else {
                echo ", ";
            }
            echo "<a href='./index{$page_ext_qry}group=" . urlencode($g['group_name']) . "'>" . $g['group_name'] . "</a>";
            $first = false;
        }
        if ($first != true) {
            echo "</i>";
        }
        /*
        echo "<br/><br/>";
        echo ucfmsg('MODIFIED') . ": ".$r['modified'];
        echo "<i>(".ucfmsg('CREATED')  . ": ".$r['created'].")</i><br/>";
        */
    }
}
    <body>
        <?php 
// put your code here
require_once './functions/dbconnect.php';
require_once './functions/until.php';
$phone = filter_input(INPUT_POST, 'phone');
$phoneType = filter_input(INPUT_POST, 'phonetype');
$phones = getAllPhone();
if (isPostRequest()) {
    if (empty($phone)) {
        $message = 'Sorry Phone is Empty';
    } else {
        if (empty($phoneType)) {
            $message = 'Sorry Phone Type is Empty';
        } else {
            if (addPhone($phone, $phoneType)) {
                $message = 'Phone Added';
                $phone = '';
                $phoneType = '';
            }
        }
    }
}
include './templates/messages.html.php';
include './templates/phone-form.html.php';
include './templates/view-phones.html.php';
?>
        
        
        
    </body>