gtd-php
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 08, 2010, 10:05:28 PM

Login with username, password and session length
Search:     Advanced search
1756 Posts in 305 Topics by 422 Members
Latest Member: jong21
* Home Help Search Calendar Login Register
+  gtd-php
|-+  gtd-php
| |-+  gtd-php users
| | |-+  Achievements monitoring
« previous next »
Pages: [1] Print
Author Topic: Achievements monitoring  (Read 238 times)
mouflon
Jr. Member
**
Posts: 7


View Profile
« on: April 21, 2010, 09:58:20 AM »

Good evening,

Here is an idea: I have replaced "dateCompleted" by "DateCreated" in the achievement add-on. What I get now is stats regarding any item created.
The discrepancy between those stats and the previous ones represents for each line like a yield or a return (created - completed) ...

Is anyone able to display this discrepancy for every line with the same principle as the achievements monitoring? Thanks.

 
Logged
mouflon
Jr. Member
**
Posts: 7


View Profile
« Reply #1 on: April 23, 2010, 03:52:49 AM »

Below is what I have developped.

2 problems outstanding: your help would me very much appreciated.
-refering to the config file for sql connections (I removed my codes from the script Wink)...
-developing a setup.inc.php file to be dislayed in the menu (I do not know how to do that).

2files requiring jpgraph:
-analysis.php
-form1.php

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ANALYSIS.PHP

<?php

$vue=$_GET['view'];
$granu=$_GET['granu'];
include ('form1.php');
include ('../jpgraph/src/jpgraph.php');
include ('../jpgraph/src/jpgraph_bar.php');
if ($granu == "week") {$echelle=7;  $detail='l d/m'; $earliestdate=date('Y-m-d',strtotime('-1 week'));}
if ($granu == "month") {$echelle=31; $detail='d'; $earliestdate=date('Y-m-d',strtotime('-31 days'));}



$db = mysql_connect('sql.gtd.com', 'username', 'pass');
mysql_select_db('databasename',$db);

$i=$echelle;
while ($i>=1) {

$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$coco=date($detail, $seuil);
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(dateCompleted) FROM `itemstatus` AS `its` WHERE its.`dateCompleted` = '$seuil' AND its.type='a'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datao1[$i]=$j[0];
$datao2[$i]=$coco;}

$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(dateCompleted) FROM `itemstatus` AS `its` WHERE its.`dateCompleted` = '$seuil' AND its.type='p'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datao3[$i]=$j[0];}

$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(dateCompleted) FROM `itemstatus` AS `its` WHERE its.`dateCompleted` = '$seuil' AND its.type='w'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datao4[$i]=$j[0];}


$graph=new graph(800,700);
$graph->title-> Set("COMPLETION: Rolling ".$echelle." days");   
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($datao2);

$barg = new BarPlot($datao1);
$barg->SetFillGradient("#9D9E9A","#F2F5EC",GRAD_RIGHT_REFLECTION);
$barg->SetColor("navy");
$barg->SetWidth(0.4);
$barg->SetShadow();
$barg->SetLegend("Actions");

$barh = new BarPlot($datao3);
$barh->SetFillGradient("#F36B08","#F8BD08",GRAD_RIGHT_REFLECTION);
$barh->SetColor("red");
$barh->SetWidth(0.5);
$barh->SetShadow();
$barh->SetLegend("Projects");

$bari = new BarPlot($datao4);
$bari->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$bari->SetColor("red");$bari->SetWidth(0.2);
$bari->SetShadow();
$bari->SetLegend("Waiting-ons");


$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetAbsPos(10,80,'right','bottom');
$graph->Add($barg);
$graph->Add($barh);
$graph->Add($bari);
$graph->img->SetImgFormat('jpeg');
$graph->Stroke('completion.jpeg');


$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$coco=date($detail, $seuil);
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(Datecreated) FROM `itemstatus` AS `its` WHERE its.`dateCreated` = '$seuil' AND its.type='a'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datar1[$i]=$j[0];
$datar2[$i]=$coco;}

$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);$sql="SELECT count(Datecreated) FROM `itemstatus` AS `its` WHERE its.`dateCreated` = '$seuil' AND its.type='p'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datar3[$i]=$j[0];}

$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(Datecreated) FROM `itemstatus` AS `its` WHERE its.`dateCreated` = '$seuil' AND its.type='w'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datar4[$i]=$j[0];}


$graph=new graph(800,700);
$graph->title-> Set("CREATION: Rolling ".$echelle." days");
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($datar2);

$barg = new BarPlot($datar1);
$barg->SetFillGradient("#9D9E9A","#F2F5EC",GRAD_RIGHT_REFLECTION);
$barg->SetColor("navy");
$barg->SetWidth(0.4);
$barg->SetShadow();
$barg->SetLegend("Actions");

$barh = new BarPlot($datar3);
$barh->SetFillGradient("#F36B08","#F8BD08",GRAD_RIGHT_REFLECTION);
$barh->SetColor("red");
$barh->SetWidth(0.5);
$barh->SetShadow();
$barh->SetLegend("Projects");

$bari = new BarPlot($datar4);
$bari->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$bari->SetColor("red");
$bari->SetWidth(0.2);
$bari->SetShadow();
$bari->SetLegend("Waiting-ons");

$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetAbsPos(10,80,'right','bottom');
$graph->Add($barg);
$graph->Add($barh);
$graph->Add($bari);
$graph->img->SetImgFormat('jpeg');
$graph->Stroke('creation.jpeg');

$p=0;
$echelle2=$echelle-1;
while ($p<=$echelle2) {
$datab1[$p]=$datar1[$p]-$datao1[$p];
$datab3[$p]=$datar3[$p]-$datao3[$p];
$datab4[$p]=$datar4[$p]-$datao4[$p];
$p=$p+1;}

$graph=new graph(800,700);
$graph->title-> Set("EFFICIENCY: Rolling ".$echelle." days yield");   
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($datar2);

$barg = new BarPlot($datab1);
$barg->SetFillGradient("#9D9E9A","#F2F5EC",GRAD_RIGHT_REFLECTION);
$barg->SetColor("navy");
$barg->SetWidth(0.4);
$barg->SetShadow();
$barg->SetLegend("Actions");

$barh = new BarPlot($datab3);
$barh->SetFillGradient("#F36B08","#F8BD08",GRAD_RIGHT_REFLECTION);
$barh->SetColor("red");$barh->SetWidth(0.5);$barh->SetShadow();
$barh->SetLegend("Projects");$bari = new BarPlot($datab4);
$bari->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$bari->SetColor("red");$bari->SetWidth(0.2);$bari->SetShadow();
$bari->SetLegend("Waiting-ons");//$bplot2->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);


$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetAbsPos(10,80,'right','bottom');
$graph->Add($barg);
$graph->Add($barh);
$graph->Add($bari);
$graph->img->SetImgFormat('jpeg');
$graph->Stroke('rdt.jpeg');

if ($vue != "all") {
print("<img src=\" ".$vue.".jpeg\" border=\"0\">"); }

if ($vue == "all") {
print("<img src=\"creation.jpeg\" border=\"0\">");
print("<img src=\"completion.jpeg\" border=\"0\">");
print("<img src=\"rdt.jpeg\" border=\"0\">");}

?>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FORM1.PHP

<div class='form' id="filter">
    <form action="analysis.php" method="get">
     
       
        <div class="formbuttons">

<label for="view" class='left first' title="View">Analysis for:</label>
<select name="view" id="view" title="View">
 <option  value="creation">Creation</option>
<option  value="completion">Completion</option>
<option  value="rdt">Yield</option>
<option  value="all">All criteria</option>
</select>

<br>

<label for="Granularit?" class='left first' title="granu">Level of details:</label>
<select name="granu" id="granu" title="granu">
 <option  value="week">Week</option>
<option  value="month">Month</option>
</select>




           <input type="submit" id="filtersubmit" class="button" value="Filter"
                name="submit" onclick="javascript:GTD.filtertoggle('all');"
                title="Filter <?php echo $typename ?>s by selected criteria" />
        </div>
    </form>
</div>

Logged
jhr
Full Member
***
Posts: 30


View Profile
« Reply #2 on: April 24, 2010, 12:06:09 PM »

1)
I think it is:
include_once 'headerDB.inc.php';

2)
Try something like:

Code:
---------------------------------
setup.inc.php

<?php
$events
[_GTD_ON_MENU]['*']=array(
    
'link'   => "form1.php",
    
'title'  => 'Search for actions completed on a specific date',
    
'label'  => 'Search by Date',
    
'where'  => 'listItems.php?quickfind',
    
'when'   => 'after',
    
'options'=> array()
);

// php closing tag has been omitted deliberately, to avoid unwanted blank lines being sent to the browser



Logged
mouflon
Jr. Member
**
Posts: 7


View Profile
« Reply #3 on: April 26, 2010, 01:01:18 AM »

Thanks: it works.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!