Advertisement
DrupalCustom

submitt

Jan 31st, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.15 KB | None | 0 0
  1.  
  2. <?php
  3. function create_freeway_project_submit($form, &$form_state){
  4.  
  5.  
  6. $arrayForSendTranslation = array();
  7. $arrayForSendTranslation = credentialProvider();
  8. /*
  9. for($u=0;$u<count($arrayForSendTranslation);$u+=1){
  10. echo ($arrayForSendTranslation[$u]);
  11. echo "<br>";
  12. }
  13. */
  14. $finalFunctionUserName = $arrayForSendTranslation[0];
  15. $finalFunctionPassword = $arrayForSendTranslation[1];
  16.  
  17.  
  18.  
  19.  
  20.  
  21. //print_r('<pre>'. print_r($form_state['values']['title'], true) .'</pre>');
  22. $projDesc = ($form_state['values']['title']);
  23. $custRef = ($form_state['values']['custRef']);
  24. $poRef = ($form_state['values']['poRef']);
  25. $strtDate = ($form_state['values']['strtdate']);
  26. $endDate = ($form_state['values']['enddate']);
  27. $splInst = ($form_state['values']['splinst']);
  28. //print_r($strtDate);
  29.  
  30. //$startDateConv = date( 'Y-m-d', strtotime($strtDate));
  31. //$endDateConv = date( 'Y-m-d', strtotime($endDate));
  32. $startDateConv = date( 'Y-m-d', strtotime("now"));
  33. $endDateConv = date( 'Y-m-d', strtotime("+7 days"));
  34.  
  35.  
  36.  
  37.  $LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
  38.  $ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
  39.  
  40.             try
  41.             {
  42.                 $arrResponse = $LoginClient->Logon(array ('Username'=>$finalFunctionUserName,'Password'=>$finalFunctionPassword));
  43.                 $ticket = ($arrResponse->LogonResult);
  44.                 $createProj = $ServicesLink->CreateProject(array('Ticket'=>$ticket,'Description'=>$projDesc,'SpecialInstructions'=> $splInst, 'CustomReference'=> $custRef,'POReference'=> $poRef,'ExpectedStartingDate'=>$startDateConv,'ExpectedDeliveryDate'=>$endDateConv,'MetaData'=>null));
  45.                
  46.                 $projectIdObtained = $createProj->CreateProjectResult;
  47.                                    
  48.             }
  49.            
  50.             catch(SoapFault $exception)
  51.             {  
  52.             drupal_set_message("The following exception took place.".$exception."Kindly check Freeway mapping");
  53.             drupal_goto("user");
  54.            
  55.              //  return $exception;
  56.              
  57.             }
  58.  
  59.            
  60.             drupal_set_message("Your project with project ID ".$projectIdObtained." has been created ");
  61.             drupal_goto("user");
  62.             /*if (isset($form[$key]['name'])) {
  63.             }*/
  64.  
  65. }
  66.  
  67. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement