Advertisement
DrupalCustom

CreateProject

Jan 23rd, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.79 KB | None | 0 0
  1. function create_freeway_project (){
  2.   $node = node_load(arg(1));
  3.   $form = array();
  4.   date_popup_load();
  5.  
  6.   $arrayForSendTranslation = array();
  7. $arrayForSendTranslation = credentialProvider();
  8. $finalFunctionUserName = $arrayForSendTranslation[0];
  9. $finalFunctionPassword = $arrayForSendTranslation[1];
  10.  
  11.  
  12. $LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
  13. $ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
  14.  
  15.             try
  16.             {
  17. $arrResponse = $LoginClient->Logon(array ('Username'=>$finalFunctionUserName,'Password'=>$finalFunctionPassword));
  18. $ticket = ($arrResponse->LogonResult);
  19.  
  20. $custAnalysis = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket'=>$ticket,'AnalysisCodeLabel'=>''));
  21.  
  22.  
  23. $analysisNames = array();
  24.                
  25. foreach($custAnalysis->GetCustomerAnalysisCodesResult->AnalysisCodeGroup as $acode)
  26.     {
  27.         $analysisNames[] = $acode->Name;   
  28.     }  
  29.         for($i=0;$i<count($analysisNames); $i+=1)
  30.             {
  31.  
  32.     $custAnalysisInner = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket'=>$ticket,'AnalysisCodeLabel'=>$analysisNames[$i]));
  33.                
  34. foreach($custAnalysisInner->GetCustomerAnalysisCodesResult->AnalysisCodeGroup->AnalysisCodes as $acodes)
  35.                 {
  36.                 $test = $acodes->Name;
  37.                 echo('Values '.$test);
  38.                 echo ('<br>');
  39.                
  40.                 }
  41.  
  42.                        
  43.             }      
  44.  
  45.             }
  46.            
  47.             catch(SoapFault $exception)
  48.             {  
  49.             drupal_set_message("The following exception took place.".$exception."Kindly check Freeway mapping");
  50.             drupal_goto("user");
  51.            
  52.            
  53.              
  54.             }
  55.  
  56.  
  57.  
  58.  
  59.   $defaultRef ='My Reference';
  60.  
  61.   $form['title'] = array(
  62.   '#type' => 'textfield',
  63.   '#title' => t('Project Description'),
  64.   '#size' => 60,
  65.   '#maxlength' => 128,
  66.   '#required' => TRUE,
  67. );
  68.  
  69.   $form['custRef'] = array(
  70.   '#type' => 'textfield',
  71.   '#title' => t('Customer Reference'),
  72.   '#default_value' => $defaultRef,
  73.   '#size' => 60,
  74.   '#maxlength' => 128,
  75.   '#required' => TRUE,
  76. );
  77.  
  78.   $form['poRef'] = array(
  79.   '#type' => 'textfield',
  80.   '#title' => t('PO Reference'),
  81.   '#size' => 60,
  82.   '#maxlength' => 128,
  83.   '#required' => TRUE,
  84. );
  85.  
  86.  
  87.   $form['splinst'] = array(
  88.   '#type' => 'textarea',
  89.   '#title' => t('Special Instructions'),
  90.   '#size' => 60,
  91.   '#maxlength' => 128,
  92.   '#required' => TRUE,
  93. );
  94.  
  95. /*
  96.   $form['strtdate'] = array(
  97.   '#type' => 'date_popup',
  98.   '#title' => t('Delivery Date'),
  99.   '#size' => 60,
  100.   '#maxlength' => 128,
  101.   '#required' => TRUE,
  102. );
  103.  
  104.  
  105.   $form['enddate'] = array(
  106.   '#type' => 'date_popup',
  107.   '#title' => t('End Date'),
  108.   '#size' => 60,
  109.   '#maxlength' => 128,
  110.   '#required' => TRUE,
  111. );
  112. */  
  113.  
  114.    $form['create_project_btn'] = array(
  115.     '#type' => 'submit',
  116.     '#value' => 'Create Freeway Project',
  117.   );
  118.  
  119.  
  120.    return $form;
  121.  
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement