Advertisement
DrupalCustom

tableattaempt

Dec 28th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.57 KB | None | 0 0
  1. function freeway_dashboard_details(){
  2.  
  3.   $pidobtained = $_GET['project_id'] ;
  4.  
  5.  
  6.   $fileId = array();
  7.   $fileName = array();
  8.   $srcLang = array();
  9.   $targLang = array();
  10.   $statusId = array();
  11.   $statusDesc = array();
  12.  
  13.   $LoginClient = new SoapClient("https://freeway.demo.company.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
  14.  $ServicesLink = new SoapClient("https://freeway.demo.company.com/vojo/Service.asmx?wsdl", array("trace"=>1));
  15.  
  16.             try
  17.             {
  18.                 $arrResponse = $LoginClient->Logon(array ('Username'=>'','Password'=>''));
  19.                 $ticket = ($arrResponse->LogonResult);
  20.                 $fileStatus = $ServicesLink->GetFileStatus(array('Ticket'=>$ticket,'ProjectID'=>$pidobtained,'SourceLanguageID'=> "", 'TargetLanguageID'=> "",'FileID'=> "",'Filename'=>""));
  21.                 $arrayPid = array();
  22.                
  23.                 foreach($fileStatus->GetFileStatusResult->FileStatuses->FileStatus as $fileStatusObtained)
  24.                 {
  25.                     $arrayPid = get_object_vars($fileStatusObtained);
  26.                     //print_r($fileStatusObtained->FileID);                
  27.                      $fileId [] = $fileStatusObtained->FileID;
  28.                      $fileName[] = $fileStatusObtained->Filename;
  29.                      $srcLang[] =  $fileStatusObtained->SourceLanguageID;
  30.                      $targLang[] = $fileStatusObtained->TargetLanguageID;
  31.                      $statusId[] = $fileStatusObtained->StatusID;
  32.                      $statusDesc[] = $fileStatusObtained->StatusDescription;
  33.                 }
  34.    
  35.                
  36.                
  37.  
  38.                  
  39.               for($n=0;$n <count($fileId);$n+=1){
  40.                $options[$fileId[$n]] = '';
  41.                $form[$fileId[$n]]['FileID'] = array('#value' =>  $fileId[$n]);
  42.                $form[$fileName[$n]]['FileName'] = array('#value' =>  $fileName[$n]);
  43.                $form[$srcLang[$n]]['SrcLang'] = array('#value' =>  $srcLang[$n]);
  44.                $form[$targLang[$n]]['TarLang'] = array('#value' =>  $targLang[$n]);
  45.                $form[$statusId[$n]]['StatusID'] = array('#value' =>  $statusId[$n]);   
  46.                $form[$statusDesc[$n]]['StatusDesc'] = array('#value' =>  $statusDesc[$n]);                 
  47.               }
  48.                    
  49.             }
  50.                                    
  51.             catch(SoapFault $exception)
  52.             {                  
  53.                return $exception;
  54.              
  55.             }
  56.            
  57.            
  58.             $form['featured'] = array(
  59.             '#type' => 'checkboxes',
  60.             '#options' => $options,
  61.             '#multiple' => false,
  62.             );
  63.            
  64.   return $form;
  65.  
  66.  
  67. }
  68.  
  69.  
  70.  
  71. function freeway_theme() {
  72.     return array('freeway_dashboard' => array('arguments' => array('form' => NULL),),'freeway_dashboard_details' => array('arguments' => array('form' => NULL),),);
  73. }
  74.    
  75.    
  76.    
  77. function theme_freeway_dashboard_details($form) {
  78.                 $rows = array();
  79.                 foreach (element_children($form) as $key) {
  80.                 $row = array();
  81.                         if (isset($form[$key]['FileID'])) {
  82.                         $status = drupal_render($form['featured'][$key]);
  83.                         $row[] = array('data' => $status, 'class' => 'checkbox');
  84.                         $row[] = ''. drupal_render($form[$key]['FileID']) .'';
  85.                         $row[] = array('data' => drupal_render($form[$key]['FileName']));
  86.                         $row[] = array('data' => drupal_render($form[$key]['SrcLang']));
  87.                         $row[] = array('data' => drupal_render($form[$key]['TarLang']));
  88.                         $row[] = array('data' => drupal_render($form[$key]['StatusID']));
  89.        
  90.                        
  91.                        
  92.                        
  93.                         $rows[] = $row;
  94.                        
  95.                         }
  96.  
  97.                 }
  98.                 $header = array();
  99.                 $header[] = array('data' => t('Featured'), 'class' => 'checkbox');
  100.                 $header[] = t('File ID');
  101.                 $header[] = t('File Name');
  102.                 $header[] = t('Source Language');
  103.                 $header[] = t('Target Language');
  104.                 $header[] = t('Status ID');
  105.                 $header[] = t('Status Description');
  106.                
  107.                    
  108.                 $output = theme('table', $header, $rows,array('size'=>10, 'class' => 'table_class'));
  109.                 $output .= drupal_render($form);
  110.      
  111.    
  112.             return $output;
  113.  
  114.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement