Advertisement
DrupalCustom

extrarows

Jan 31st, 2012
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.18 KB | None | 0 0
  1. <?php
  2. function freeway_dashboard_details(){
  3.    GLOBAL $user;
  4.  
  5.   $pidobtained = $_GET['project_id'] ;
  6.  
  7.  $arrayForSendTranslation = array();
  8. $arrayForSendTranslation = credentialProvider();
  9. /*
  10. for($u=0;$u<count($arrayForSendTranslation);$u+=1){
  11. echo ($arrayForSendTranslation[$u]);
  12. echo ('<br>');
  13. }
  14. */
  15. $finalFunctionUserName = $arrayForSendTranslation[0];
  16. $finalFunctionPassword = $arrayForSendTranslation[1];
  17.  
  18. $form['link_br2_'] = array(
  19.             '#value' => variable_get('link_form_br2_',t('<br/>') ),
  20.             '#weight'=>5,
  21.         );
  22.        
  23.         $form['switch_mode_'] = array(
  24.             '#value' => variable_get('switch_form_mode_',l(t('Create Freeway Project'), 'user/'. $user->uid .'/createFreewayProject', array('attributes' => array('class' => 'link_class'))) ),
  25.             '#weight'=>6,
  26.         );  
  27.  
  28.  
  29.  
  30. $form['link_br2'] = array(
  31.             '#value' => variable_get('link_form_br2',t('<br/>') ),
  32.             '#weight'=>8,
  33.         );
  34.        
  35.         $form['switch_mode'] = array(
  36.             '#value' => variable_get('switch_form_mode',l(t('Freeway Dashboard'), 'user/'. $user->uid .'/freewayDashboard', array('attributes' => array('class' => 'link_class'))) ),
  37.             '#weight'=>9,
  38.         );  
  39.        
  40.  
  41.        
  42.         $form['link_br2__'] = array(
  43.             '#value' => variable_get('link_form_br2__',t('<br/>') ),
  44.             '#weight'=>11,
  45.         );
  46.        
  47.         $form['switch_mode__'] = array(
  48.             '#value' => variable_get('switch_form_mode__',l(t('Freeway User Mapping'), 'user/'. $user->uid .'/freewayUserMapping', array('attributes' => array('class' => 'link_class'))) ),
  49.             '#weight'=>12,
  50.         );  
  51.        
  52.  
  53.  
  54.   $fileId = array();
  55.   $fileName = array();
  56.   $srcLang = array();
  57.   $targLang = array();
  58.   $statusId = array();
  59.   $statusDesc = array();
  60.  
  61.   $LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
  62.  $ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
  63.  
  64.             try
  65.             {
  66.                 $arrResponse = $LoginClient->Logon(array ('Username'=>$finalFunctionUserName,'Password'=>$finalFunctionPassword));
  67.                 $ticket = ($arrResponse->LogonResult);
  68.                
  69.                 try{
  70.                 $fileStatus = $ServicesLink->GetFileStatus(array('Ticket'=>$ticket,'ProjectID'=>$pidobtained,'SourceLanguageID'=> "", 'TargetLanguageID'=> "",'FileID'=> "",'Filename'=>""));
  71.                 }
  72.                 catch (SoapFault $exceptionInner){
  73.                
  74.                 drupal_get_messages();
  75.                 drupal_set_message("No Files attached to the project with project ID :".$pidobtained."!");
  76.                 drupal_goto('user/'. $user->uid .'/freewayDashboard');
  77.                 }
  78.                
  79.            
  80.                 $arrayPid = array();
  81.                 foreach($fileStatus->GetFileStatusResult->FileStatuses->FileStatus as $fileStatusObtained)
  82.                 {
  83.                 if(is_string($fileStatusObtained)){
  84.                 drupal_get_messages();
  85.                 drupal_set_message("Kindly check Freeway status compliance for the project with ID ".$pidobtained);
  86.                 drupal_goto('user/'. $user->uid .'/freewayDashboard');
  87.                 }
  88.                 else{
  89.                     $arrayPid = get_object_vars($fileStatusObtained);
  90.                     //print_r($fileStatusObtained->FileID);                
  91.                      $fileId [] = $fileStatusObtained->FileID;
  92.                      $fileName[] = $fileStatusObtained->Filename;
  93.                      $srcLang[] =  $fileStatusObtained->SourceLanguageID;
  94.                      $targLang[] = $fileStatusObtained->TargetLanguageID;
  95.                      $statusId[] = $fileStatusObtained->StatusID;
  96.                      $statusDesc[] = $fileStatusObtained->StatusDescription;
  97.                      }
  98.                 }
  99.                
  100.            
  101.             /// echo ("Count of aray !!!" . count($fileId));
  102.  
  103.                  
  104.               for($n=0;$n <count($fileId);$n+=1){
  105.              
  106.                $form[$fileId[$n]]['FileID'] = array('#value' =>  $fileId[$n]);
  107.                $form[$fileId[$n]]['Filename'] = array('#value' =>  $fileName[$n]);
  108.                $form[$fileId[$n]]['SourceLanguageID'] = array('#value' =>  $srcLang[$n]);
  109.                $form[$fileId[$n]]['TargetLanguageID'] = array('#value' =>  $targLang[$n]); 
  110.                $form[$fileId[$n]]['StatusID'] = array('#value' =>  $statusId[$n]); 
  111.                $form[$fileId[$n]]['StatusDescription'] = array('#value' =>  $statusDesc[$n]);                  
  112.               }
  113.                    
  114.             }
  115.                                    
  116.             catch(SoapFault $exception)
  117.             {    
  118.  
  119.             drupal_set_message("The following exception took place.".$exception."Kindly check Freeway mapping");
  120.             drupal_goto("user");           
  121.               // return $exception;
  122.              
  123.             }
  124.            
  125.  
  126.            
  127.   return $form;
  128.  
  129.  
  130. }
  131. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement