diff options
-rw-r--r-- | .zfproject.xml | 7 | ||||
-rw-r--r-- | application/controllers/IndexController.php | 9 | ||||
-rw-r--r-- | application/controllers/StatsController.php | 28 | ||||
-rw-r--r-- | application/modules/user/views/scripts/index/index.phtml | 2 | ||||
-rw-r--r-- | library/Pbs/Graph.php | 2 | ||||
-rw-r--r-- | send-post.html | 8 | ||||
-rw-r--r-- | tests/application/controllers/StatsControllerTest.php | 20 |
7 files changed, 63 insertions, 13 deletions
diff --git a/.zfproject.xml b/.zfproject.xml index eda876f..70ccd1c 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -15,6 +15,9 @@ <controllerFile controllerName="Auth"> <actionMethod actionName="index"/> </controllerFile> + <controllerFile controllerName="Stats"> + <actionMethod actionName="index"/> + </controllerFile> </controllersDirectory> <formsDirectory enabled="false"/> <layoutsDirectory enabled="false"/> @@ -689,6 +692,9 @@ <viewControllerScriptsDirectory forControllerName="Auth"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Stats"> + <viewScriptFile forActionName="index"/> + </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewScriptsDirectory/> <viewHelpersDirectory/> @@ -753,6 +759,7 @@ <testApplicationControllerFile filesystemName="PrebootControllerTest.php"/> <testApplicationControllerFile filesystemName="AuthControllerTest.php"/> <testApplicationControllerFile filesystemName="AuthControllerTest.php"/> + <testApplicationControllerFile filesystemName="StatsControllerTest.php"/> </testApplicationControllerDirectory> </testApplicationDirectory> <testLibraryDirectory> diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 2c53550..cf6673c 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -14,12 +14,11 @@ class IndexController extends Zend_Controller_Action $_SESSION['postdata'] = $_POST; $this->_redirect('/fbgui/index/index'); } - - echo 'tesT'; + // action body - $n = new Pbs_Graph(); - print_a($n->graph(2)); - } + + + } } diff --git a/application/controllers/StatsController.php b/application/controllers/StatsController.php new file mode 100644 index 0000000..024eacd --- /dev/null +++ b/application/controllers/StatsController.php @@ -0,0 +1,28 @@ +<?php + +class StatsController extends Zend_Controller_Action +{ + + public function init() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + } + + public function graphgroupAction(){ + + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + + if($userIDsNamespace['groupID'] !=''){ + header("Content-Type: image/png"); + + $n = new Pbs_Graph(); + $str = 'echo "'; + $str .= $n->graph($userIDsNamespace['groupID']); + $str .= '" | dot -Tpng '; + + passthru($str); + } + } +} + diff --git a/application/modules/user/views/scripts/index/index.phtml b/application/modules/user/views/scripts/index/index.phtml index a6e84a7..0f1fab5 100644 --- a/application/modules/user/views/scripts/index/index.phtml +++ b/application/modules/user/views/scripts/index/index.phtml @@ -13,6 +13,6 @@ <?php endforeach ?> </ul> - +<img src='/stats/graphgroup/' /> <?php endif ?> diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php index 13bbe3a..7711dce 100644 --- a/library/Pbs/Graph.php +++ b/library/Pbs/Graph.php @@ -14,7 +14,7 @@ class Pbs_Graph{ $this->graphstring = 'digraph groups { - size="6,6";'; + size="5,5";'; $this->getParentGroups($groupID); $this->getChildGroups($groupID); $this->graphstring .= '}'; diff --git a/send-post.html b/send-post.html index 6e04b1f..6cad8c8 100644 --- a/send-post.html +++ b/send-post.html @@ -9,8 +9,6 @@ <fieldset> <legend>http://132.230.4.27/</legend> <form action='http://132.230.4.27/' method='post'> - <label>BootisoID</label> - <input type='text' name='bootisoID' value='1'></br> <label>serialnumber</label> <input type='text' name='serialnumber' value='10-20-30-40-50'></br> <label>Mac</label> @@ -23,8 +21,6 @@ <fieldset> <legend>http://pbs2.local/</legend> <form action='http://pbs2.local/' method='post'> - <!--<label>BootisoID</label> - <input type='text' name='bootisoID' value='1'></br> --> <label>serialnumber</label> <input type='text' name='serialnumber' value='10-20-30-40-50'></br> <label>Mac</label> @@ -37,8 +33,8 @@ <fieldset> <legend>http://localhost:81/</legend> <form action='http://localhost:81/' method='post'> - <label>BootisoID</label> - <input type='text' name='bootisoID' value='1'></br> + <label>serialnumber</label> + <input type='text' name='serialnumber' value='10-20-30-40-50'></br> <label>Mac</label> <input type='text' name='mac' value='00:0c:29:01:63:88'></br> <label>Hardwarehash</label> diff --git a/tests/application/controllers/StatsControllerTest.php b/tests/application/controllers/StatsControllerTest.php new file mode 100644 index 0000000..d130e2e --- /dev/null +++ b/tests/application/controllers/StatsControllerTest.php @@ -0,0 +1,20 @@ +<?php + +require_once 'PHPUnit/Framework/TestCase.php'; + +class StatsControllerTest extends PHPUnit_Framework_TestCase +{ + + public function setUp() + { + /* Setup Routine */ + } + + public function tearDown() + { + /* Tear Down Routine */ + } + + +} + |