Advertisement
DrupalCustom

cr

Jan 31st, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.64 KB | None | 0 0
  1. <?php
  2. function create_freeway_project (){
  3. drupal_add_js(drupal_get_path('module', 'freeway') .'/js/dashboardscript.js');
  4.   $node = node_load(arg(1));
  5.   $form = array();
  6.   date_popup_load();
  7.  
  8.   $arrayForSendTranslation = array();
  9. $arrayForSendTranslation = credentialProvider();
  10. $finalFunctionUserName = $arrayForSendTranslation[0];
  11. $finalFunctionPassword = $arrayForSendTranslation[1];
  12.  
  13.  
  14. $LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
  15. $ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
  16.  
  17.             try
  18.             {
  19. $arrResponse = $LoginClient->Logon(array ('Username'=>$finalFunctionUserName,'Password'=>$finalFunctionPassword));
  20. $ticket = ($arrResponse->LogonResult);
  21.  
  22. $custAnalysis = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket'=>$ticket,'AnalysisCodeLabel'=>''));
  23.  
  24.  
  25. $analysisNames = array();
  26. $analysisCodeOne = array();
  27. $analysisCodeTwo = array();
  28.  
  29.                
  30. foreach($custAnalysis->GetCustomerAnalysisCodesResult->AnalysisCodeGroup as $acode)
  31.     {
  32.         $analysisNames[] = $acode->Name;   
  33.     }  
  34.         for($i=0;$i<count($analysisNames)-1; $i+=1)
  35.             {
  36.  
  37.         $custAnalysisInner = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket'=>$ticket,'AnalysisCodeLabel'=>$analysisNames[$i]));
  38.        
  39.                    
  40.                     foreach($custAnalysisInner->GetCustomerAnalysisCodesResult->AnalysisCodeGroup->AnalysisCodes->AnalysisCode as $acodes)
  41.                     {
  42.                    
  43.                     if($i ==0)
  44.                     {
  45.                     $codeOne = $acodes->Name;
  46.                     $analysisCodeOne[] = $codeOne;
  47.                     }
  48.                     if($i==1)
  49.                     {
  50.                     $codeTwo = $acodes->Name;
  51.                     $analysisCodeTwo[] = $codeTwo;
  52.                     }
  53.                    
  54.                     }
  55.  
  56.                        
  57.             }  
  58.  
  59.             }
  60.            
  61.             catch(SoapFault $exception)
  62.             {  
  63.             drupal_set_message("The following exception took place.".$exception."Kindly check Freeway mapping");
  64.             drupal_goto("user");
  65.            
  66.            
  67.              
  68.             }
  69.  
  70.  
  71.  
  72.  
  73.   $defaultRef ='My Reference';
  74.  
  75.   $form['title'] = array(
  76.   '#type' => 'textfield',
  77.   '#title' => t('Project Description'),
  78.   '#size' => 60,
  79.   '#maxlength' => 30,
  80.   '#required' => TRUE,
  81. );
  82.  
  83.   $form['custRef'] = array(
  84.   '#type' => 'textfield',
  85.   '#title' => t('Customer Reference'),
  86.   '#default_value' => $defaultRef,
  87.   '#size' => 60,
  88.   '#maxlength' => 30,
  89.   '#required' => TRUE,
  90. );
  91.  
  92.   $form['poRef'] = array(
  93.   '#type' => 'textfield',
  94.   '#title' => t('PO Reference'),
  95.   '#size' => 60,
  96.   '#maxlength' => 30,
  97.   '#required' => TRUE,
  98. );
  99.  
  100.  
  101.   $form['splinst'] = array(
  102.   '#type' => 'textarea',
  103.   '#title' => t('Special Instructions'),
  104.   '#size' => 60,
  105.   '#maxlength' => 100,
  106.   '#required' => TRUE,
  107. );
  108.  
  109. /*
  110.   $form['strtdate'] = array(
  111.   '#type' => 'date_popup',
  112.   '#title' => t('Delivery Date'),
  113.   '#size' => 60,
  114.   '#maxlength' => 128,
  115.   '#required' => TRUE,
  116. );
  117.  
  118.  
  119.   $form['enddate'] = array(
  120.   '#type' => 'date_popup',
  121.   '#title' => t('End Date'),
  122.   '#size' => 60,
  123.   '#maxlength' => 128,
  124.   '#required' => TRUE,
  125. );
  126. */  
  127. /*
  128.           $form['analysis_code_one']=array(
  129.                 '#type'=>'select',
  130.                 '#title' => t('Analysis Code One'),
  131.                 '#options' => $analysisCodeOne,
  132.                 '#default_value' => t('-Select-'),     
  133.                 '#attributes'=> array('onChange' => "populateReference();"),
  134.                
  135.             );
  136.            
  137.              $form['analysis_code_two']=array(
  138.                 '#type'=>'select',
  139.                 '#title' => t('Analysis Code Two'),
  140.                 '#options' => $analysisCodeTwo,
  141.                 '#default_value' => t('-Select-'),     
  142.                 '#attributes'=> array('onChange' => "populateReference();"),
  143.                
  144.             );
  145.  
  146. */
  147.  
  148.    $form['create_project_btn'] = array(
  149.     '#type' => 'submit',
  150.     '#value' => 'Create Freeway Project',
  151.     '#weight'=>10,
  152.    
  153.   );
  154.  
  155.  
  156.    return $form;
  157.  
  158. }
  159.  
  160. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement