Some sample code that uses the CeloxisAPI class

  1. <?php
  2. require_once('CeloxisAPI.php');
  3.  
  4. $api new CeloxisAPI("http://localhost:8888/psa/api.do");
  5. try
  6. {
  7.     //
  8.     // login
  9.     //
  10.     $api->login('mark''xxxxxxx''12193391');
  11.  
  12.     //
  13.     // Get all projects where percent complete is > 0 and manager_id is 29863
  14.     //
  15.     $rows $api->query(array('table'=>'db_project''db_project.percent_complete.>' => 0'manager_id' => 29863));
  16.     foreach ($rows as $row)
  17.     {
  18.         echo 'id=' $row['id'];
  19.         echo 'summary=' $row['summary'];
  20.         echo '<br/>';
  21.     }
  22.  
  23.     //
  24.     // Perform a custom query: get count of all projects by phases
  25.     // ONLY FOR INSTALLABLE CUSTOMERS
  26.     //
  27.     $api->query(array('table'=>'generic''sql'=>'select db_project_phase.name, count(*) from db_project,db_project_phase where db_project.phase_id=db_project_phase.id group by db_project_phase.name'));
  28.  
  29.  
  30.     //
  31.     // create a couple of users
  32.     //
  33.     $api->create("users"array(
  34.             array('first_name'=>'api fn 1''last_name'=>'api ln 1')
  35.             array('first_name'=>'api fn 2''last_name'=>'api ln 2')
  36.             )
  37.     );
  38.  
  39.     //
  40.     // create a project
  41.     //
  42.     $api->create("projects"array(
  43.             array('project_category_id'=> 7864
  44.                   'summary'=>'create by api 2',
  45.                   'plan_start' => $api->encodeDate(200961),
  46.                   'deadline' => $api->encodeDate(20091231),
  47.                   'manager_id' => 29863,
  48.                   'client_id' => 29862)
  49.             )
  50.     );
  51. }
  52. catch (CeloxisException $e)
  53. {
  54.     $api->debugLastRequest();
  55. }
  56. ?>

Documentation generated on Tue, 28 Jul 2009 06:00:04 +0000 by phpDocumentor 1.4.1