Example #1
0
{
    return "(" . $t[0] . $t[1] . $t[2] . ") " . $t[3] . $t[4] . $t[5] . "-" . $t[6] . $t[7] . $t[8] . $t[9];
}
function create_button($id, $text, $class, $onclick)
{
    $return = "<div id='{$id}' style='border: 2;background: url(images/{$class}.png);background-position:right top;height: 28px; align: center; width: 70px;float: left;' onMouseOver='document.getElementById(\"{$id}\").style.background=\"url(images/{$class}-mo.png)\"' onMouseOut='document.getElementById(\"{$id}\").style.background=\"url(images/{$class}.png)\"' onMouseOver='document.getElementById(\"{$id}\").style.background=\"url(images/{$class}-mo.png)\"'  onMouseup='document.getElementById(\"{$id}\").style.background=\"url(images/{$class}.png)\"' onClick='document.getElementById(\"{$id}\").style.background=\"url(images/{$class}-press.png)\";{$onclick}'><a style='font-weight: bold;padding: 10px;position: relative; top: 5px;color: white;' >{$text}</a></div>";
    return $return;
}
$array = array();
foreach ($calls as $call) {
    if (key_exists("contact_id", $call)) {
        $rand = rand(0, 10000000);
        $project_id = $call["cid"] . "project{$rand}";
        $project_click = "alert(\"Project Button Pressed {$project_id}\");";
        $task_id = $call["cid"] . "task{$rand}";
        $task_click = "add_newtab( \"contact_profile.php?contact_id=" . $call["contact_id"] . "&open_task=yes\" , \"" . $call["name"] . "\" )";
        $contact_id = $call["cid"] . "contact{$rand}";
        $contact_click = "add_newtab( \"contact_profile.php?contact_id=" . $call["contact_id"] . "\" , \"" . $call["name"] . "\" )";
        $html = "\n            <div>\n                <div style='width:250px;align: center;text-align: center;'>\n                    <span style='font-size: 24px;font-weight: bold;width: 100%;text-align: center;' >" . $call["name"] . "</span>\n                    <div>\n                       <span style='font-size: 12px;font-weight: bold;'>" . display_number($call["cid"]) . "</span>\n                   </div>\n                </div>\n            <span><div style='width: 10px;float: left;'></div><div id='{$project_id}'\n             style='margin-left: 1px;margin-right: 1px;margin-bottom: 5px;float: left;border: 2;background: url(images/bluebar3.png);background-position:right top;height: 28px; align: center; width: 70px;'\n             onMouseOver='document.getElementById(\"{$project_id}\").style.background=\"url(images/bluebar3-mo.png)\"'\n             onMouseOut='document.getElementById(\"{$project_id}\").style.background=\"url(images/bluebar3.png)\"'\n             onMouseup='document.getElementById(\"{$project_id}\").style.background=\"url(images/bluebar3.png)\"'\n             onClick='document.getElementById(\"{$project_id}\").style.background=\"url(images/bluebar3-press.png)\";{$project_click}'>\n             <a style='font-weight: bold;padding: 10px;position: relative; top: 5px;color: white;'  >Project</a>\n           </div></span><span style='margin: 10px;' >\n            <div id='{$task_id}'\n                style='margin-left: 1px;margin-right: 1px;float: left;border: 2;background: url(images/bluebar3.png);background-position:right top;height: 28px; align: center; width: 70px;'\n                onMouseOver='document.getElementById(\"{$task_id}\").style.background=\"url(images/bluebar3-mo.png)\"'\n                onMouseOut='document.getElementById(\"{$task_id}\").style.background=\"url(images/bluebar3.png)\"'\n                onMouseup='document.getElementById(\"{$task_id}\").style.background=\"url(images/bluebar3.png)\"'\n                onClick='document.getElementById(\"{$task_id}\").style.background=\"url(images/bluebar3-press.png)\";{$task_click}'>\n             <a style='font-weight: bold;padding: 18px;position: relative; top: 5px;color: white;' >Task</a></div>\n        </span><span>\n                    <div id='{$contact_id}'\n                style='margin-left: 1px;margin-right: 1px;float: left;border: 2;background: url(images/bluebar3.png);background-position:right top;height: 28px; align: center; width: 78px;'\n                onMouseOver='document.getElementById(\"{$contact_id}\").style.background=\"url(images/bluebar3-mo.png)\"'\n                onMouseOut='document.getElementById(\"{$contact_id}\").style.background=\"url(images/bluebar3.png)\"'\n                onMouseup='document.getElementById(\"{$contact_id}\").style.background=\"url(images/bluebar3.png)\"'\n                onClick='document.getElementById(\"{$contact_id}\").style.background=\"url(images/bluebar3-press.png)\";{$contact_click}'>\n             <a style='font-weight: bold;position: relative; top: 5px;color: white;width: 100%; text-align: center;padding: 12px;' >Contact</a></div>\n        </span></div>";
    } else {
        $rand = rand(0, 1.0E+19);
        $newnum_id = $rand . "NewContact";
        $newnum_click = "add_newtab( \"contact_addperson.php?phone=" . $call["cid"] . "\" , \"Add Person\" )";
        $html = "\n            <div>\n                <div style='width:250px;align: center;text-align: center;'>\n                    <span style='font-size: 24px;font-weight: bold;width: 100%;text-align: center;' >" . display_number($call["cid"]) . "</span>\n\n                </div>\n            <span><div style='width: 10px;float: left;'></div><div id='{$newnum_id}'\n             style='margin-left: 1px;margin-right: 1px;margin-bottom: 5px;float: left;border: 2;background: url(images/bluebar3.png);background-position:right top;height: 28px; align: center; width: 110px;'\n             onMouseOver='document.getElementById(\"{$newnum_id}\").style.background=\"url(images/bluebar3-mo.png)\"'\n             onMouseOut='document.getElementById(\"{$newnum_id}\").style.background=\"url(images/bluebar3.png)\"'\n             onMouseup='document.getElementById(\"{$newnum_id}\").style.background=\"url(images/bluebar3.png)\"'\n             onClick='document.getElementById(\"{$newnum_id}\").style.background=\"url(images/bluebar3-press.png)\";{$newnum_click}'>\n             <a style='font-weight: bold;padding: 10px;position: relative; top: 5px;color: white;'  >Add Contact</a>\n           </div></span></div>";
    }
    $array[] = array("call" => $yui->string_to_xml($html));
}
//    array("call" => $yui->string_to_xml( $printr ) . "&lt;br/&gt;&lt;a href='http://www.google.com' &gt;Test&lt;/a&gt;" ),
//$array[] = array("call" => "Count: " . count( $calls) . " User:  $user_id Time: " . date("H:i:s") );
echo $yui->array_to_yuixml($array);