4.1.0 version.
This commit is contained in:
Binary file not shown.
22
README.txt
22
README.txt
@ -1,25 +1,25 @@
|
||||
MITEL
|
||||
December 2014
|
||||
July 2015
|
||||
|
||||
|
||||
-PA-001011-04-01-XML-API.pdf - Mitel IP Phone XML API document. For use with Mitel SIP Phones Release 4.0.0 SP1
|
||||
-PA-001011-04-02-XML-API.pdf - Mitel IP Phone XML API document. For use with Mitel SIP Phones Release 4.1.0
|
||||
|
||||
-XMLSchema 4.0.0.xsd - XML Schema which can be used to validate XML development.
|
||||
For use with Mitel SIP Phones Release 4.0.0 SP1
|
||||
-XMLSchema 4.1.0.xsd - XML Schema which can be used to validate XML development.
|
||||
For use with Mitel SIP Phones Release 4.1.0
|
||||
|
||||
-php_classes_4.0.0.zip - contains the directory php classes with all the XML classes.
|
||||
-php_classes_4.1.0.zip - contains the directory php classes with all the XML classes.
|
||||
The files are commented.
|
||||
|
||||
-xml-xampp_4.0.0.zip contains the source code of sample XML applications to be used with XAMPP as described in the XML API Document
|
||||
-xml-xampp_4.1.0.zip contains the source code of sample XML applications to be used with XAMPP as described in the XML API Document
|
||||
The files are commented
|
||||
|
||||
-csv_directory_4.0.0.zip contains the source code of a directory application using a csv file as the data source.
|
||||
-csv_directory_4.1.0.zip contains the source code of a directory application using a csv file as the data source.
|
||||
The files are commented
|
||||
|
||||
-ldap_directory_4.0.0.zip contains the source code of a directory application using LDAP.
|
||||
-ldap_directory_4.1.0.zip contains the source code of a directory application using LDAP.
|
||||
The files are commented
|
||||
|
||||
-pictureCallerID_4.0.0.zip contains the source code of an application providing formatted images for the 6739i for incoming and outgoing calls.
|
||||
-pictureCallerID_4.1.0.zip contains the source code of an application providing formatted images for the 6739i for incoming and outgoing calls.
|
||||
The files are commented
|
||||
|
||||
For XML documents related to IP Phone SIP Release 1.3.0, see file PA-001004-00-00.zip
|
||||
@ -46,4 +46,6 @@ For XML documents related to 6739i Release 3.2.1 see file PA-001011-02-01.zip
|
||||
For XML documents related to 6739i Release 3.2.2 see file PA-001011-02-04.zip
|
||||
For XML documents related to IP Phone SIP Release 3.3.0 see file PA-001011-03-00.zip
|
||||
For XML documents related to IP Phone SIP Release 3.3.1 SP4 see file PA-001011-03-04.zip
|
||||
For XML documents related to IP Phone SIP Release 4.0.0 see file PA-001011-04-00.zip
|
||||
For XML documents related to IP Phone SIP Release 4.0.0 see file PA-001011-04-00.zip
|
||||
For XML documents related to IP Phone SIP Release 4.0.0 SP1 see file PA-001011-04-01.zip
|
||||
For XML documents related to IP Phone SIP Release 4.0.0 SP2 see file PA-001011-04-02.zip
|
1010
XML-API.txt
1010
XML-API.txt
File diff suppressed because it is too large
Load Diff
@ -54,6 +54,7 @@
|
||||
# Returns the number of lines available for formatted text screen
|
||||
# Aastra_size_display_line()
|
||||
# Returns the number of characters per line on the display
|
||||
# Aastra_size_graphical_display(mode,header)
|
||||
# Aastra_get_custom_icon(icon_name)
|
||||
# Returns hex representation of icon matching the given name. If no icon found, empty icon is returned.
|
||||
# Aastra_push2phone(server,phone,data)
|
||||
@ -243,7 +244,7 @@ else
|
||||
$return=1;
|
||||
if($type==0)
|
||||
{
|
||||
echo "This XML application works better when using an Aastra SIP phone, not a Web browser.<p>See <a href=\"http://www.aastratelecom.com/cps/rde/xchg/SID-3D8CCB73-C78FC1E1/03/hs.xsl/23485.htm\">here</a> for instructions and information.<p>Copyright Aastra Telecom 2005-2011.";
|
||||
echo "This XML application works better when using a Mitel SIP phone, not a Web browser.<p>See <a href=\"http://www.mitel.com/node/35841\">here</a> for instructions and information.<p>Copyright Mitel Networks 2005-2014.";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -617,6 +618,79 @@ switch($header['model'])
|
||||
return($return);
|
||||
}
|
||||
|
||||
###################################################################################################
|
||||
# Aastra_is_dot_icons_supported(header)
|
||||
#
|
||||
# Parameters
|
||||
# header phone HTTP header (optional)
|
||||
#
|
||||
# Returns
|
||||
# Boolean
|
||||
###################################################################################################
|
||||
function Aastra_is_dot_icons_supported($header=NULL)
|
||||
{
|
||||
# False by default
|
||||
$return=False;
|
||||
|
||||
# Get header info if needed
|
||||
if(!$header) $header=Aastra_decode_HTTP_header();
|
||||
|
||||
# Test Model/version
|
||||
switch($header['model'])
|
||||
{
|
||||
case 'Aastra55i':
|
||||
case 'Aastra57i':
|
||||
case 'Aastra57iCT':
|
||||
case 'Aastra9480i':
|
||||
case 'Aastra9480iCT':
|
||||
if(Aastra_test_phone_version('2.0.2.',1,$header)==0) $return=True;
|
||||
break;
|
||||
case 'Aastra6735i':
|
||||
case 'Aastra6737i':
|
||||
$return=True;
|
||||
break;
|
||||
}
|
||||
|
||||
# Return result
|
||||
return($return);
|
||||
}
|
||||
|
||||
###################################################################################################
|
||||
# Aastra_is_graphic_icons_supported(header)
|
||||
#
|
||||
# Parameters
|
||||
# header phone HTTP header (optional)
|
||||
#
|
||||
# Returns
|
||||
# Boolean
|
||||
###################################################################################################
|
||||
function Aastra_is_graphic_icons_supported($header=NULL)
|
||||
{
|
||||
# False by default
|
||||
$return=False;
|
||||
|
||||
# Get header info if needed
|
||||
if(!$header) $header=Aastra_decode_HTTP_header();
|
||||
|
||||
# Test Model/version
|
||||
switch($header['model'])
|
||||
{
|
||||
case 'Aastra6867i':
|
||||
case 'Aastra6869i':
|
||||
$return=True;
|
||||
break;
|
||||
case 'Aastra6739i':
|
||||
if(Aastra_test_phone_version('3.2.0.',1,$header)==0) $return=True;
|
||||
break;
|
||||
case 'Aastra8000i':
|
||||
$return=True;
|
||||
break;
|
||||
}
|
||||
|
||||
# Return result
|
||||
return($return);
|
||||
}
|
||||
|
||||
###################################################################################################
|
||||
# Aastra_is_pixmap_graphics_supported(header)
|
||||
#
|
||||
@ -1626,6 +1700,58 @@ switch($header['model'])
|
||||
return($return);
|
||||
}
|
||||
|
||||
###################################################################################################
|
||||
# Aastra_size_graphical_display(mode)
|
||||
#
|
||||
# Returns the number of characters per line on the display
|
||||
#
|
||||
# Parameters
|
||||
# Mode ImageScreen/ImageMenu mode regular/extended/fullscreen
|
||||
#
|
||||
# Returns
|
||||
# Returns an array with width and height
|
||||
###################################################################################################
|
||||
function Aastra_size_graphical_display($mode='regular',$header=NULL)
|
||||
{
|
||||
$return=0;
|
||||
|
||||
# Get info header if needed
|
||||
if(!$header) $header=Aastra_decode_HTTP_header();
|
||||
|
||||
switch($header['model'])
|
||||
{
|
||||
case 'Aastra6867i':
|
||||
if($mode=='regular') {
|
||||
$array=array( 'width'=>'320','height'=>'184');
|
||||
} else if($mode=='extended') {
|
||||
$array=array( 'width'=>'320','height'=>'184');
|
||||
} else if($mode=='fullscreen') {
|
||||
$array=array( 'width'=>'320','height'=>'240');
|
||||
}
|
||||
break;
|
||||
case 'Aastra6869i':
|
||||
if($mode=='regular') {
|
||||
$array=array( 'width'=>'480','height'=>'204');
|
||||
} else if($mode=='extended') {
|
||||
$array=array( 'width'=>'480','height'=>'204');
|
||||
} else if($mode=='fullscreen') {
|
||||
$array=array( 'width'=>'480','height'=>'272');
|
||||
}
|
||||
break;
|
||||
case 'Aastra6739i':
|
||||
if($mode=='regular') {
|
||||
$array=array( 'width'=>'380','height'=>'340');
|
||||
} else if($mode=='extended') {
|
||||
$array=array( 'width'=>'640','height'=>'340');
|
||||
} else if($mode=='fullscreen') {
|
||||
$array=array( 'width'=>'640','height'=>'480');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return($array);
|
||||
}
|
||||
|
||||
###################################################################################################
|
||||
# Aastra_max_items_textmenu()
|
||||
#
|
||||
|
@ -91,22 +91,37 @@ class AastraIPPhoneGDImage
|
||||
var $_img;
|
||||
var $_white;
|
||||
var $_black;
|
||||
var $_blackNoAntiAliasing;
|
||||
var $_red;
|
||||
var $_green;
|
||||
var $_blue;
|
||||
var $_font;
|
||||
var $_fontpath;
|
||||
var $_color;
|
||||
|
||||
function AastraIPPhoneGDImage()
|
||||
function AastraIPPhoneGDImage($width=144,$height=40,$color=False)
|
||||
{
|
||||
# create the actual image
|
||||
$this->_img=imagecreate(144, 40);
|
||||
$this->_color=$color;
|
||||
if($color) {
|
||||
$this->_img=imagecreatetruecolor($width, $height);
|
||||
} else {
|
||||
$this->_img=imagecreate($width, $height);
|
||||
}
|
||||
|
||||
# define black and white
|
||||
$this->_white = imagecolorallocate($this->_img, 255, 255, 255);
|
||||
$this->_black = imagecolorallocate($this->_img, 0, 0, 0);
|
||||
if($color) {
|
||||
$this->_red = imagecolorallocate($this->_img, 255, 0, 0);
|
||||
$this->_green = imagecolorallocate($this->_img, 0, 255, 0);
|
||||
$this->_blue = imagecolorallocate($this->_img, 0, 0, 255);
|
||||
}
|
||||
|
||||
# Black and White only so disable anti-aliasing
|
||||
$this->_black = $this->_black * -1;
|
||||
$this->_white = $this->_white * -1;
|
||||
if(!$color) {
|
||||
$this->_black = $this->_black * -1;
|
||||
$this->_white = $this->_white * -1;
|
||||
}
|
||||
|
||||
# define a default font path
|
||||
$os = strtolower(PHP_OS);
|
||||
@ -121,11 +136,6 @@ function importFromPng($file,$x,$y)
|
||||
imagecopy($this->_img,$image,$x,$y,0,0,imagesx($image),imagesy($image));
|
||||
}
|
||||
|
||||
function exportToPng($file,$file)
|
||||
{
|
||||
imagepng($this->_img);
|
||||
}
|
||||
|
||||
function setFontPath($fontpath)
|
||||
{
|
||||
$this->_fontpath=$fontpath;
|
||||
@ -153,6 +163,11 @@ function getGDImage()
|
||||
return $this->_img;
|
||||
}
|
||||
|
||||
function savePNGImage($filename)
|
||||
{
|
||||
imagepng($this->_img,$filename);
|
||||
}
|
||||
|
||||
function rectangle($x1, $y1, $x2, $y2, $colorIndex, $filled=False)
|
||||
{
|
||||
if($filled) imagefilledrectangle($this->_img, $x1, $y1, $x2, $y2, $this->getColor($colorIndex));
|
||||
@ -178,7 +193,11 @@ function line($x1, $y1, $x2, $y2, $colorIndex, $dashed=False)
|
||||
|
||||
function getColor($index)
|
||||
{
|
||||
if ($index == 0) return $this->_white; else return $this->_black;
|
||||
if ($index == 0) return $this->_white;
|
||||
else if ($index == 1) return $this->_black;
|
||||
else if ($index == 2) return $this->_red;
|
||||
else if ($index == 3) return $this->_green;
|
||||
else if ($index == 4) return $this->_blue;
|
||||
}
|
||||
}
|
||||
?>
|
@ -2,13 +2,13 @@
|
||||
############################################################################
|
||||
# Biorythm
|
||||
#
|
||||
# Aastra SIP Phones 2.2.0 or better
|
||||
# Mitel SIP Phones 2.2.0 or better
|
||||
#
|
||||
# Copyright 2008 Aastra Telecom Ltd
|
||||
# Copyright 2008 Mitel Networks
|
||||
#
|
||||
# Based on Biorhythm by Till Gerken http://www.zend.com/zend/tut/dynamic.php
|
||||
#
|
||||
# Supported Aastra Phones
|
||||
# Supported Mitel Phones
|
||||
# All phones
|
||||
#
|
||||
# Usage
|
||||
@ -40,49 +40,53 @@ require_once('AastraIPPhoneFormattedTextScreen.class.php');
|
||||
#############################################################################
|
||||
# Private functions
|
||||
#############################################################################
|
||||
function drawRhythm($daysAlive, $period)
|
||||
function drawRhythm($daysAlive, $period, $color, $legend='')
|
||||
{
|
||||
global $daysToShow, $GDImage, $diagramWidth, $diagramHeight;
|
||||
global $daysToShow, $GDImage, $diagramWidth, $diagramHeight, $diagramTopBottomMargin, $diagramLeftRightMargin;
|
||||
|
||||
# get day on which to center
|
||||
$centerDay = $daysAlive - ($daysToShow / 2);
|
||||
# get day on which to center
|
||||
$centerDay = $daysAlive - ($daysToShow / 2);
|
||||
|
||||
# calculate diagram parameters
|
||||
$plotScale = ($diagramHeight - 2) / 2;
|
||||
$plotCenter = ($diagramHeight - 2) / 2;
|
||||
# calculate diagram parameters
|
||||
$plotScale = ($diagramHeight - 2) / 2;
|
||||
$plotCenter = ($diagramHeight - 2) / 2;
|
||||
|
||||
# draw the curve
|
||||
for ($x = 0; $x <= $daysToShow; $x++)
|
||||
{
|
||||
# calculate phase of curve at this day, then Y value within diagram
|
||||
$phase = (($centerDay + $x) % $period) / $period * 2 * pi();
|
||||
$y = 1 - sin($phase) * (float)$plotScale + (float)$plotCenter;
|
||||
# draw the curve
|
||||
for ($x = 0; $x <= $daysToShow; $x++) {
|
||||
# calculate phase of curve at this day, then Y value within diagram
|
||||
$phase = (($centerDay + $x) % $period) / $period * 2 * pi();
|
||||
$y = $diagramTopBottomMargin + 1 - sin($phase) * (float)$plotScale + (float)$plotCenter;
|
||||
|
||||
# draw line from last point to current point
|
||||
if ($x > 0) $GDImage->line($oldX, $oldY, $x * $diagramWidth / $daysToShow, $y,1);
|
||||
# draw line from last point to current point
|
||||
if($x>0) {
|
||||
$GDImage->line($oldX, $oldY, $diagramLeftRightMargin + $x * $diagramWidth / $daysToShow, $y, $color);
|
||||
} else {
|
||||
if(strlen($legend)!=0) {
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin + $x * $diagramWidth / $daysToShow - imagefontwidth(1)*(strlen($legend)+1),$y-imagefontheight(1)/2,$legend,$color);
|
||||
}
|
||||
}
|
||||
|
||||
# save current X/Y coordinates as start point for next line
|
||||
$oldX = $x * $diagramWidth / $daysToShow;
|
||||
$oldX = $diagramLeftRightMargin + $x * $diagramWidth / $daysToShow;
|
||||
$oldY = $y;
|
||||
}
|
||||
}
|
||||
|
||||
function getResults()
|
||||
{
|
||||
global $daysGone;
|
||||
global $daysGone;
|
||||
|
||||
$loop=array('I','E','P');
|
||||
$array['period']['I']=33;
|
||||
$array['period']['E']=28;
|
||||
$array['period']['P']=23;
|
||||
foreach($loop as $key)
|
||||
{
|
||||
$array['day'][$key]=sin(($daysGone *2 *pi()) / $array['period'][$key]);
|
||||
$next=sin((($daysGone+1) *2 *pi()) / $array['period'][$key]);
|
||||
if($next-$array['day'][$key]>0) $array['trend'][$key]='/';
|
||||
else $array['trend'][$key]='\\';
|
||||
$loop=array('I','E','P');
|
||||
$array['period']['I']=33;
|
||||
$array['period']['E']=28;
|
||||
$array['period']['P']=23;
|
||||
foreach($loop as $key) {
|
||||
$array['day'][$key]=sin(($daysGone *2 *pi()) / $array['period'][$key]);
|
||||
$next=sin((($daysGone+1) *2 *pi()) / $array['period'][$key]);
|
||||
if($next-$array['day'][$key]>0) $array['trend'][$key]='/';
|
||||
else $array['trend'][$key]='\\';
|
||||
}
|
||||
return($array);
|
||||
return($array);
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
@ -110,28 +114,25 @@ $language=Aastra_get_language();
|
||||
|
||||
# Check compatibility
|
||||
Aastra_test_phone_version('1.4.2.',0);
|
||||
if(Aastra_is_pixmap_graphics_supported()) Aastra_test_php_function('imagecreate',Aastra_get_label('PHP-GD extension not installed.',$language));
|
||||
Aastra_test_php_function('imagecreate',Aastra_get_label('PHP-GD extension not installed.',$language));
|
||||
|
||||
# Global compatibility
|
||||
$nb_softkeys=Aastra_number_physical_softkeys_supported();
|
||||
$is_toptitle_supported=Aastra_is_top_title_supported();
|
||||
|
||||
# Nothing entered
|
||||
if ($bdate=='')
|
||||
{
|
||||
if ($bdate=='') {
|
||||
$date=Aastra_get_user_context($user,'biorhytm');
|
||||
$object=new AastraIPPhoneInputScreen();
|
||||
if($is_toptitle_supported) $object->setTopTitle(Aastra_get_label('Biorhythms',$language));
|
||||
else $object->setTitle(Aastra_get_label('Biorhythms',$language));
|
||||
else $object->setTopTitle(Aastra_get_label('Biorhythms',$language));
|
||||
$object->setPrompt(Aastra_get_label('Birth Date (MM/DD/YYYY)',$language));
|
||||
$object->setParameter('bdate');
|
||||
$object->setType('dateUS');
|
||||
$object->setURL($XML_SERVER);
|
||||
$object->setDefault($date);
|
||||
$object->setDestroyOnExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
# Save user context
|
||||
Aastra_save_user_context($user,'biorhytm',$bdate);
|
||||
|
||||
@ -141,25 +142,21 @@ else
|
||||
$birthYear = substr($bdate,6,4);
|
||||
|
||||
# check date for validity, display error message if invalid
|
||||
if (!@checkDate($birthMonth,$birthDay,$birthYear))
|
||||
{
|
||||
if (!@checkDate($birthMonth,$birthDay,$birthYear)) {
|
||||
# Display error message
|
||||
$object = new AastraIPPhoneTextScreen();
|
||||
if($is_toptitle_supported) $object->setTopTitle(Aastra_get_label('Invalid Birth Date',$language),'red');
|
||||
if($is_toptitle_supported) $object->setTopTitle(Aastra_get_label('Invalid Birth Date',$language));
|
||||
else $object->setTitle(Aastra_get_label('Invalid Birth Date',$language));
|
||||
$object->setText(Aastra_get_label('Please enter a valid Birth Date.',$language));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
# calculate the number of days this person is alive
|
||||
$daysGone = abs(gregorianToJD($birthMonth, $birthDay, $birthYear) - gregorianToJD(date("m"), date("d"), date("Y")));
|
||||
|
||||
# Get the results
|
||||
$array=getResults();
|
||||
|
||||
# Test if pixmap graphics are supported
|
||||
if(Aastra_is_pixmap_graphics_supported())
|
||||
{
|
||||
# Test if graphics are supported
|
||||
if(Aastra_is_pixmap_graphics_supported()) {
|
||||
# create image and object
|
||||
$object=new AastraIPPhoneImageScreen();
|
||||
$GDImage=new AastraIPPhoneGDImage();
|
||||
@ -172,13 +169,12 @@ else
|
||||
# calculate start date for diagram and start drawing
|
||||
$nrSecondsPerDay = 60 * 60 * 24;
|
||||
$diagramDate = time() - ($daysToShow / 2 * $nrSecondsPerDay) + $nrSecondsPerDay;
|
||||
for ($i = 1; $i < $daysToShow; $i++)
|
||||
{
|
||||
for ($i = 1; $i < $daysToShow; $i++) {
|
||||
$thisDate = getDate($diagramDate);
|
||||
$xCoord = ($diagramWidth / $daysToShow) * $i;
|
||||
$GDImage->line($xCoord, $diagramHeight - 2, $xCoord, $diagramHeight, 1);
|
||||
$diagramDate += $nrSecondsPerDay;
|
||||
}
|
||||
}
|
||||
|
||||
# draw rectangle around diagram (marks its boundaries)
|
||||
$GDImage->rectangle(0,0,$diagramWidth-1, $diagramHeight,1,False);
|
||||
@ -188,17 +184,15 @@ else
|
||||
$GDImage->line($diagramWidth / 2, 0, $diagramWidth / 2, $diagramHeight,1);
|
||||
|
||||
# now draw each curve with its appropriate parameters
|
||||
if($P==1) drawRhythm($daysGone,23);
|
||||
if($E==1) drawRhythm($daysGone,28);
|
||||
if($I==1) drawRhythm($daysGone,33);
|
||||
if($P==1) drawRhythm($daysGone,23,1);
|
||||
if($E==1) drawRhythm($daysGone,28,1);
|
||||
if($I==1) drawRhythm($daysGone,33,1);
|
||||
|
||||
# print values
|
||||
if($I==1) $GDImage->drawtext(1,0,33,sprintf(Aastra_get_label('I=%+.3f',$language),$array['day']['I']), 1);
|
||||
if($E==1) $GDImage->drawtext(1,51,33,sprintf(Aastra_get_label('E=%+.3f',$language),$array['day']['E']), 1);
|
||||
if($P==1) $GDImage->drawtext(1,104,33,sprintf(Aastra_get_label('P=%+.3f',$language),$array['day']['P']), 1);
|
||||
|
||||
$GDImage->exportToPng("/tmp/crado.png");
|
||||
|
||||
# Attach GD image
|
||||
$object->setGDImage($GDImage);
|
||||
|
||||
@ -212,48 +206,121 @@ else
|
||||
if($P==1) $new=0;
|
||||
else $new=1;
|
||||
$object->addSoftkey('3',Aastra_get_label('Physical',$language),$XML_SERVER.'&bdate='.$bdate.'&I='.$I.'&E='.$E.'&P='.$new);
|
||||
} else if(Aastra_is_png_graphics_supported()) {
|
||||
# create image and object
|
||||
$object=new AastraIPPhoneImageScreen();
|
||||
if($is_toptitle_supported) $object->setTopTitle(Aastra_get_label('Biorhythms',$language));
|
||||
else $object->setTitle(Aastra_get_label('Biorhythms',$language));
|
||||
$screen=Aastra_size_graphical_display('regular');
|
||||
$GDImage=new AastraIPPhoneGDImage($screen['width'],$screen['height'],True);
|
||||
|
||||
# specify diagram parameters (these are global)
|
||||
$diagramTopBottomMargin=20;
|
||||
$diagramLeftRightMargin=40;
|
||||
$diagramWidth=$screen['width']-2*$diagramLeftRightMargin;
|
||||
$diagramHeight=$screen['height']-2*$diagramTopBottomMargin;
|
||||
$verticalOffset=($diagramTopBottomMargin-imagefontheight(1))/2;
|
||||
$daysToShow=28;
|
||||
|
||||
# draw rectangle around diagram (marks its boundaries)
|
||||
$GDImage->rectangle($diagramLeftRightMargin, $diagramTopBottomMargin, $diagramLeftRightMargin+$diagramWidth, $diagramTopBottomMargin+$diagramHeight,0,False);
|
||||
|
||||
# draw middle cross
|
||||
$GDImage->line($diagramLeftRightMargin, $diagramTopBottomMargin+($diagramHeight / 2), $diagramLeftRightMargin+$diagramWidth, $diagramTopBottomMargin+($diagramHeight/2),0);
|
||||
$GDImage->line($diagramLeftRightMargin+($diagramWidth/2), $diagramTopBottomMargin, $diagramLeftRightMargin+($diagramWidth/2), $diagramTopBottomMargin+$diagramHeight,0);
|
||||
|
||||
# draw legend
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth+imagefontwidth(1),$diagramTopBottomMargin+($diagramHeight / 2)-imagefontheight(1)/2,"0%",0);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth+imagefontwidth(1),$diagramTopBottomMargin-imagefontheight(1)/2,"+100%",0);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth+imagefontwidth(1),$diagramTopBottomMargin+$diagramHeight-imagefontheight(1)/2,"-100%",0);
|
||||
$label=date('m/d/Y');
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+($diagramWidth-strlen($label)*imagefontwidth(1))/2,$verticalOffset,$label,0);
|
||||
$label=(-1)*($daysToShow/2);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin-(strlen($label)*imagefontwidth(1))/2,$verticalOffset,$label,0);
|
||||
$label=(-1)*($daysToShow/4);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth/4-(strlen($label)*imagefontwidth(1))/2,$verticalOffset,$label,0);
|
||||
$label='+'.($daysToShow/4);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth/2+$diagramWidth/4-(strlen($label)*imagefontwidth(1))/2,$verticalOffset,$label,0);
|
||||
$label='+'.($daysToShow/2);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth-(strlen($label)*imagefontwidth(1))/2,$verticalOffset,$label,0);
|
||||
|
||||
# now draw each curve with its appropriate parameters
|
||||
if($P==1) {
|
||||
drawRhythm($daysGone,23,2,'Phy');
|
||||
}
|
||||
else
|
||||
{
|
||||
if($E==1) {
|
||||
drawRhythm($daysGone,28,3,'Emo');
|
||||
}
|
||||
if($I==1) {
|
||||
drawRhythm($daysGone,33,4,'Int');
|
||||
}
|
||||
|
||||
# print values
|
||||
if($I==1) {
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin,$diagramTopBottomMargin+$diagramHeight+$verticalOffset,sprintf(Aastra_get_label('Int=%+.2f%%',$language),$array['day']['I']*100), 4);
|
||||
}
|
||||
if($E==1) {
|
||||
$label=sprintf(Aastra_get_label('Emo=%+.2f%%',$language),$array['day']['E']*100);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth/2-((strlen($label)*imagefontwidth(1))/2),$diagramTopBottomMargin+$diagramHeight+$verticalOffset,$label,3);
|
||||
}
|
||||
if($P==1) {
|
||||
$label=sprintf(Aastra_get_label('Phy=%+.2f%%',$language),$array['day']['P']*100);
|
||||
$GDImage->drawtext(1,$diagramLeftRightMargin+$diagramWidth-imagefontwidth(1)*strlen($label),$diagramTopBottomMargin+$diagramHeight+$verticalOffset,$label,2);
|
||||
}
|
||||
|
||||
$header= Aastra_decode_HTTP_header();
|
||||
$GDImage->SavePNGImage('../images/bio'.$header['mac'].'.png');
|
||||
|
||||
# Attach GD image
|
||||
$object->setImage($XML_HTTP.$AA_XML_SERVER.'/'.$AA_XMLDIRECTORY.'/images/bio'.$header['mac'].'.png');
|
||||
|
||||
# Create Softkeys
|
||||
if($I==1) $new=0;
|
||||
else $new=1;
|
||||
$object->addSoftkey('1',Aastra_get_label('Intellect',$language),$XML_SERVER.'&bdate='.$bdate.'&I='.$new.'&E='.$E.'&P='.$P);
|
||||
if($E==1) $new=0;
|
||||
else $new=1;
|
||||
$object->addSoftkey('2',Aastra_get_label('Emotional',$language),$XML_SERVER.'&bdate='.$bdate.'&I='.$I.'&E='.$new.'&P='.$P);
|
||||
if($P==1) $new=0;
|
||||
else $new=1;
|
||||
$object->addSoftkey('3',Aastra_get_label('Physical',$language),$XML_SERVER.'&bdate='.$bdate.'&I='.$I.'&E='.$E.'&P='.$new);
|
||||
} else {
|
||||
# Display results
|
||||
if(Aastra_is_formattedtextscreen_supported())
|
||||
{
|
||||
if(Aastra_is_formattedtextscreen_supported()) {
|
||||
# create object
|
||||
$object = new AastraIPPhoneFormattedTextScreen();
|
||||
if($is_toptitle_supported) $object->setTopTitle(Aastra_get_label('Biorhythms',$language));
|
||||
if(Aastra_size_formattedtextscreen()>3)
|
||||
{
|
||||
if(!$is_toptitle_supported) $object->addLine(Aastra_get_label('Biorhythms',$language));
|
||||
if(Aastra_size_formattedtextscreen()>3) {
|
||||
if($is_toptitle_supported) $object->setTopTitle(Aastra_get_label('Biorhythms',$language));
|
||||
else $object->addLine(Aastra_get_label('BIORHYTHMS',$language));
|
||||
if(Aastra_size_formattedtextscreen()>4) $object->addLine('');
|
||||
$object->addLine(sprintf(Aastra_get_label('I=%+.3f %s',$language),$array['day']['I'],$array['trend']['I']));
|
||||
$object->addLine(sprintf(Aastra_get_label('E=%+.3f %s',$language),$array['day']['E'],$array['trend']['E']));
|
||||
$object->addLine(sprintf(Aastra_get_label('P=%+.3f %s',$language),$array['day']['P'],$array['trend']['P']));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$object->setScrollStart('2');
|
||||
$object->addLine(sprintf(Aastra_get_label('I=%+.3f %s',$language),$array['day']['I'],$array['trend']['I']));
|
||||
$object->addLine(sprintf(Aastra_get_label('E=%+.3f %s',$language),$array['day']['E'],$array['trend']['E']));
|
||||
$object->addLine(sprintf(Aastra_get_label('P=%+.3f %s',$language),$array['day']['P'],$array['trend']['P']));
|
||||
$object->setScrollEnd();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
# create object
|
||||
$object = new AastraIPPhoneTextScreen();
|
||||
$object->setTitle(Aastra_get_language('Biorhythms',$language));
|
||||
$object->setTitle(Aastra_get_language('BIORHYTHMS',$language));
|
||||
$object->setText(sprintf(Aastra_get_label('I=%+.3f, E=%+.3f, P=%+.3f',$language),$array['day']['I'],$array['day']['E'],$array['day']['P']));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Common parameters
|
||||
$object->setDestroyOnExit();
|
||||
|
||||
# Softkeys
|
||||
$object->addSoftkey($nb_softkeys-1,Aastra_get_label('Back',$language),$XML_SERVER);
|
||||
$object->addSoftkey($nb_softkeys,Aastra_get_label('Exit',$language),'SoftKey:Exit');
|
||||
if($nb_softkeys>=5) {
|
||||
$object->addSoftkey($nb_softkeys-1,Aastra_get_label('Back',$language),$XML_SERVER);
|
||||
$object->addSoftkey($nb_softkeys,Aastra_get_label('Exit',$language),'SoftKey:Exit');
|
||||
} else {
|
||||
$object->addSoftkey('5',Aastra_get_label('Back',$language),$XML_SERVER);
|
||||
$object->addSoftkey('6',Aastra_get_label('Exit',$language),'SoftKey:Exit');
|
||||
}
|
||||
}
|
||||
|
||||
# Display object
|
||||
|
Reference in New Issue
Block a user