Author: snoopckuu
Date: 2010-05-06 16:02:17 +0200 (Thu, 06 May 2010)
New Revision: 29377
Added:
plugins/sfJiraPlugin/JiraException.class.php
plugins/sfJiraPlugin/JiraWorkLog.class.php
plugins/sfJiraPlugin/sfJiraPlugin.class.php
plugins/sfJiraPlugin/usage.php
Log:
Import
Added: plugins/sfJiraPlugin/JiraException.class.php
===================================================================
--- plugins/sfJiraPlugin/JiraException.class.php
(rev 0)
+++ plugins/sfJiraPlugin/JiraException.class.php 2010-05-06 14:02:17 UTC
(rev 29377)
@@ -0,0 +1,3 @@
+<?php
+
+class JiraException extends Exception { }
\ No newline at end of file
Added: plugins/sfJiraPlugin/JiraWorkLog.class.php
===================================================================
--- plugins/sfJiraPlugin/JiraWorkLog.class.php (rev 0)
+++ plugins/sfJiraPlugin/JiraWorkLog.class.php 2010-05-06 14:02:17 UTC (rev
29377)
@@ -0,0 +1,14 @@
+<?php
+
+class JiraWorkLog {
+
+ static public function create( $sTime ){
+ $date = date('Y-m-d H:i:s');
+ $now = strtotime($date);
+ $sTime =
str_replace(array('w','d','h','m'),array('week','day','hour','minute'), $sTime
);
+ $timespent = $now - strtotime($date.' - '. $sTime );
+ return array( 'timeSpentInSeconds' => $timespent,
+ 'timeLogged' => $sTime, 'startDate'
=> date('Y-m-dTH:i:s.000Z', time()-$timespent ) );
+ }
+
+}
\ No newline at end of file
Added: plugins/sfJiraPlugin/sfJiraPlugin.class.php
===================================================================
--- plugins/sfJiraPlugin/sfJiraPlugin.class.php (rev 0)
+++ plugins/sfJiraPlugin/sfJiraPlugin.class.php 2010-05-06 14:02:17 UTC (rev
29377)
@@ -0,0 +1,82 @@
+<?php
+
+class sfJiraPlugin {
+
+ CONST URL = 'http://your_address/rpc/soap/jirasoapservice-v2?wsdl'; //
CHANGE ADDRESS HERE
+ private $sAuthToken = null;
+ private $oSoapInstance = null;
+
+ public $bTransform2Array = false;
+
+ public function __construct( $username, $password ){
+
+ try {
+ $this->oSoapInstance = new SoapCLient(self::URL);
+ $this->sAuthToken =
$this->oSoapInstance->login($username, $password );
+
+ } catch( Exception $e){
+
+ return $e;
+
+ }
+
+ }
+
+ public function getAvailableMethods(){
+
+ return $this->Soap()->__getFunctions();
+
+ }
+
+ private function Soap(){
+
+ if( !is_object( $this->oSoapInstance ) )
+ throw new JiraException('No soap instnace.');
+ else
+ return $this->oSoapInstance;
+
+ }
+
+
+ public function createRequest( $sName, $aParams = array() ){
+
+ return $this->Soap()->$sName($this->sAuthToken);
+
+ }
+
+ public function getProjects( ){
+
+ return $this->createRequest('getProjectsNoSchemes');
+
+ }
+
+ public function getIssue( $sKey ){
+
+ $oIssue = self::Soap()->getIssue($this->sAuthToken, $sKey);
+ if( !$oIssue )
+ throw JiraException( $sKey .' issue does not exist.');
+ else
+ return $oIssue;
+
+ }
+
+ public function getProject( $sProjectKey ){
+
+ return self::Soap()->getProjectByKey( $this->sAuthToken,
$sProjectKey );
+
+ }
+
+
+ public function getIssuesForProject( $sProjectKey ){
+
+ return $this->Soap()->getIssuesFromTextSearchWithProject(
$this->sAuthToken, $sProjectKey, 'test', 10 );
+
+ }
+
+ public function workLog( $sIssueKey, $sTime ){
+ return $this->Soap()->addWorklogAndAutoAdjustRemainingEstimate(
$this->sAuthToken, $sIssueKey, JiraWorkLog::create( $sTime ) );
+
+ }
+
+
+}
\ No newline at end of file
Added: plugins/sfJiraPlugin/usage.php
===================================================================
--- plugins/sfJiraPlugin/usage.php (rev 0)
+++ plugins/sfJiraPlugin/usage.php 2010-05-06 14:02:17 UTC (rev 29377)
@@ -0,0 +1,14 @@
+<?php
+
+$jira = new Jira('username','password');
+
+$jira->getAvailableMethods(); // Get all available soap methods
+
+
+// list ALL ISSUES
+
+ foreach( $projects as $project ){
+
+ var_dump( $jira->getIssuesForProject( $project->key ) );
+
+ }
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.