Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function create_freeway_project (){
- drupal_add_js(drupal_get_path('module', 'freeway') .'/js/dashboardscript.js');
- $node = node_load(arg(1));
- $form = array();
- date_popup_load();
- $arrayForSendTranslation = array();
- $arrayForSendTranslation = credentialProvider();
- $finalFunctionUserName = $arrayForSendTranslation[0];
- $finalFunctionPassword = $arrayForSendTranslation[1];
- $LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
- $ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
- try
- {
- $arrResponse = $LoginClient->Logon(array ('Username'=>$finalFunctionUserName,'Password'=>$finalFunctionPassword));
- $ticket = ($arrResponse->LogonResult);
- $custAnalysis = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket'=>$ticket,'AnalysisCodeLabel'=>''));
- $analysisNames = array();
- $analysisCodeOne = array();
- $analysisCodeTwo = array();
- foreach($custAnalysis->GetCustomerAnalysisCodesResult->AnalysisCodeGroup as $acode)
- {
- $analysisNames[] = $acode->Name;
- }
- for($i=0;$i<count($analysisNames)-1; $i+=1)
- {
- $custAnalysisInner = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket'=>$ticket,'AnalysisCodeLabel'=>$analysisNames[$i]));
- foreach($custAnalysisInner->GetCustomerAnalysisCodesResult->AnalysisCodeGroup->AnalysisCodes->AnalysisCode as $acodes)
- {
- if($i ==0)
- {
- $codeOne = $acodes->Name;
- $analysisCodeOne[] = $codeOne;
- }
- if($i==1)
- {
- $codeTwo = $acodes->Name;
- $analysisCodeTwo[] = $codeTwo;
- }
- }
- }
- }
- catch(SoapFault $exception)
- {
- drupal_set_message("The following exception took place.".$exception."Kindly check Freeway mapping");
- drupal_goto("user");
- }
- $defaultRef ='My Reference';
- $form['title'] = array(
- '#type' => 'textfield',
- '#title' => t('Project Description'),
- '#size' => 60,
- '#maxlength' => 30,
- '#required' => TRUE,
- );
- $form['custRef'] = array(
- '#type' => 'textfield',
- '#title' => t('Customer Reference'),
- '#default_value' => $defaultRef,
- '#size' => 60,
- '#maxlength' => 30,
- '#required' => TRUE,
- );
- $form['poRef'] = array(
- '#type' => 'textfield',
- '#title' => t('PO Reference'),
- '#size' => 60,
- '#maxlength' => 30,
- '#required' => TRUE,
- );
- $form['splinst'] = array(
- '#type' => 'textarea',
- '#title' => t('Special Instructions'),
- '#size' => 60,
- '#maxlength' => 100,
- '#required' => TRUE,
- );
- /*
- $form['strtdate'] = array(
- '#type' => 'date_popup',
- '#title' => t('Delivery Date'),
- '#size' => 60,
- '#maxlength' => 128,
- '#required' => TRUE,
- );
- $form['enddate'] = array(
- '#type' => 'date_popup',
- '#title' => t('End Date'),
- '#size' => 60,
- '#maxlength' => 128,
- '#required' => TRUE,
- );
- */
- /*
- $form['analysis_code_one']=array(
- '#type'=>'select',
- '#title' => t('Analysis Code One'),
- '#options' => $analysisCodeOne,
- '#default_value' => t('-Select-'),
- '#attributes'=> array('onChange' => "populateReference();"),
- );
- $form['analysis_code_two']=array(
- '#type'=>'select',
- '#title' => t('Analysis Code Two'),
- '#options' => $analysisCodeTwo,
- '#default_value' => t('-Select-'),
- '#attributes'=> array('onChange' => "populateReference();"),
- );
- */
- $form['create_project_btn'] = array(
- '#type' => 'submit',
- '#value' => 'Create Freeway Project',
- '#weight'=>10,
- );
- return $form;
- }
- >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement