Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function freeway_dashboard_details(){
- GLOBAL $user;
- $pidobtained = $_GET['project_id'] ;
- $arrayForSendTranslation = array();
- $arrayForSendTranslation = credentialProvider();
- /*
- for($u=0;$u<count($arrayForSendTranslation);$u+=1){
- echo ($arrayForSendTranslation[$u]);
- echo ('<br>');
- }
- */
- $finalFunctionUserName = $arrayForSendTranslation[0];
- $finalFunctionPassword = $arrayForSendTranslation[1];
- $form['link_br2_'] = array(
- '#value' => variable_get('link_form_br2_',t('<br/>') ),
- '#weight'=>5,
- );
- $form['switch_mode_'] = array(
- '#value' => variable_get('switch_form_mode_',l(t('Create Freeway Project'), 'user/'. $user->uid .'/createFreewayProject', array('attributes' => array('class' => 'link_class'))) ),
- '#weight'=>6,
- );
- $form['link_br2'] = array(
- '#value' => variable_get('link_form_br2',t('<br/>') ),
- '#weight'=>8,
- );
- $form['switch_mode'] = array(
- '#value' => variable_get('switch_form_mode',l(t('Freeway Dashboard'), 'user/'. $user->uid .'/freewayDashboard', array('attributes' => array('class' => 'link_class'))) ),
- '#weight'=>9,
- );
- $form['link_br2__'] = array(
- '#value' => variable_get('link_form_br2__',t('<br/>') ),
- '#weight'=>11,
- );
- $form['switch_mode__'] = array(
- '#value' => variable_get('switch_form_mode__',l(t('Freeway User Mapping'), 'user/'. $user->uid .'/freewayUserMapping', array('attributes' => array('class' => 'link_class'))) ),
- '#weight'=>12,
- );
- $fileId = array();
- $fileName = array();
- $srcLang = array();
- $targLang = array();
- $statusId = array();
- $statusDesc = array();
- $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);
- try{
- $fileStatus = $ServicesLink->GetFileStatus(array('Ticket'=>$ticket,'ProjectID'=>$pidobtained,'SourceLanguageID'=> "", 'TargetLanguageID'=> "",'FileID'=> "",'Filename'=>""));
- }
- catch (SoapFault $exceptionInner){
- drupal_get_messages();
- drupal_set_message("No Files attached to the project with project ID :".$pidobtained."!");
- drupal_goto('user/'. $user->uid .'/freewayDashboard');
- }
- $arrayPid = array();
- foreach($fileStatus->GetFileStatusResult->FileStatuses->FileStatus as $fileStatusObtained)
- {
- if(is_string($fileStatusObtained)){
- drupal_get_messages();
- drupal_set_message("Kindly check Freeway status compliance for the project with ID ".$pidobtained);
- drupal_goto('user/'. $user->uid .'/freewayDashboard');
- }
- else{
- $arrayPid = get_object_vars($fileStatusObtained);
- //print_r($fileStatusObtained->FileID);
- $fileId [] = $fileStatusObtained->FileID;
- $fileName[] = $fileStatusObtained->Filename;
- $srcLang[] = $fileStatusObtained->SourceLanguageID;
- $targLang[] = $fileStatusObtained->TargetLanguageID;
- $statusId[] = $fileStatusObtained->StatusID;
- $statusDesc[] = $fileStatusObtained->StatusDescription;
- }
- }
- /// echo ("Count of aray !!!" . count($fileId));
- for($n=0;$n <count($fileId);$n+=1){
- $form[$fileId[$n]]['FileID'] = array('#value' => $fileId[$n]);
- $form[$fileId[$n]]['Filename'] = array('#value' => $fileName[$n]);
- $form[$fileId[$n]]['SourceLanguageID'] = array('#value' => $srcLang[$n]);
- $form[$fileId[$n]]['TargetLanguageID'] = array('#value' => $targLang[$n]);
- $form[$fileId[$n]]['StatusID'] = array('#value' => $statusId[$n]);
- $form[$fileId[$n]]['StatusDescription'] = array('#value' => $statusDesc[$n]);
- }
- }
- catch(SoapFault $exception)
- {
- drupal_set_message("The following exception took place.".$exception."Kindly check Freeway mapping");
- drupal_goto("user");
- // return $exception;
- }
- return $form;
- }
- >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement