Advertisement
DrupalCustom

CreteFreewaty

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