コード例 #1
0
 /**
  * Lists drafts associated with an issue.
  * 
  * @access  public
  * @param   resource $rpc_conn The connection resource
  * @param   array $auth Array of authentication information (email, password)
  * @param   integer $issue_id The issue ID
  */
 function listDrafts($rpc_conn, $auth, $issue_id)
 {
     Command_Line::checkIssuePermissions(&$rpc_conn, $auth, $issue_id);
     $msg = new XML_RPC_Message("getDraftListing", array(new XML_RPC_Value($auth[0], 'string'), new XML_RPC_Value($auth[1], 'string'), new XML_RPC_Value($issue_id, "int")));
     $result = $rpc_conn->send($msg);
     if ($result->faultCode()) {
         Command_Line::quit($result->faultString());
     }
     $drafts = XML_RPC_decode($result->value());
     // since xml-rpc has issues, we have to base64 decode everything
     for ($i = 0; $i < count($drafts); $i++) {
         foreach ($drafts[$i] as $key => $val) {
             $drafts[$i][$key] = base64_decode($val);
         }
         $drafts[$i]["id"] = $i + 1;
     }
     if (count($drafts) < 1) {
         echo "No drafts for this issue";
         exit;
     }
     $format = array("id" => array("width" => 3, "title" => "ID"), "from" => array("width" => 24, "title" => "From"), "to" => array("width" => 24, "title" => "To"), "emd_subject" => array("width" => 30, "title" => "Title"), "emd_updated_date" => array("width" => 30, "title" => "Date"));
     Command_Line::printTable($format, $drafts);
 }