我正在使用表格主题。下面是我尝试创建表格以显示行和列中的值的整个代码。该代码还包含我的主题的注册。这些值来自代码中的 6 个数组,即 fileId 、fileName 等。现在使用此代码,我得到此输出http://www.image-share.com/ijpg-1166-290.html。我想要的输出必须像这样http://www.image-share.com/ijpg-1166-289.html。数组已正确填充,因为我成功打印出此处的值http://www.image-share.com/ijpg-1166-288.html 我不需要复选框,但我使用了此代码,因为我遵循了它从我之前使用的一个例子。
你能否指导我错误在哪里,我得到了这个奇怪的输出。
function freeway_dashboard_details(){
$pidobtained = $_GET['project_id'] ;
$fileId = array();
$fileName = array();
$srcLang = array();
$targLang = array();
$statusId = array();
$statusDesc = array();
$LoginClient = new SoapClient("https://freeway.demo.company.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
$ServicesLink = new SoapClient("https://freeway.demo.company.com/vojo/Service.asmx?wsdl", array("trace"=>1));
try
{
$arrResponse = $LoginClient->Logon(array ('Username'=>'','Password'=>''));
$ticket = ($arrResponse->LogonResult);
$fileStatus = $ServicesLink->GetFileStatus(array('Ticket'=>$ticket,'ProjectID'=>$pidobtained,'SourceLanguageID'=> "", 'TargetLanguageID'=> "",'FileID'=> "",'Filename'=>""));
$arrayPid = array();
foreach($fileStatus->GetFileStatusResult->FileStatuses->FileStatus as $fileStatusObtained)
{
$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;
}
for($n=0;$n <count($fileId);$n+=1){
$options[$fileId[$n]] = '';
$form[$fileId[$n]]['FileID'] = array('#value' => $fileId[$n]);
$form[$fileName[$n]]['FileName'] = array('#value' => $fileName[$n]);
$form[$srcLang[$n]]['SrcLang'] = array('#value' => $srcLang[$n]);
$form[$targLang[$n]]['TarLang'] = array('#value' => $targLang[$n]);
$form[$statusId[$n]]['StatusID'] = array('#value' => $statusId[$n]);
$form[$statusDesc[$n]]['StatusDesc'] = array('#value' => $statusDesc[$n]);
}
}
catch(SoapFault $exception)
{
return $exception;
}
$form['featured'] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#multiple' => false,
);
return $form;
}
function freeway_theme() {
return array('freeway_dashboard' => array('arguments' => array('form' => NULL),),'freeway_dashboard_details' => array('arguments' => array('form' => NULL),),);
}
function theme_freeway_dashboard_details($form) {
$rows = array();
foreach (element_children($form) as $key) {
$row = array();
if (isset($form[$key]['FileID'])) {
$status = drupal_render($form['featured'][$key]);
$row[] = array('data' => $status, 'class' => 'checkbox');
$row[] = ''. drupal_render($form[$key]['FileID']) .'';
$row[] = array('data' => drupal_render($form[$key]['FileName']));
$row[] = array('data' => drupal_render($form[$key]['SrcLang']));
$row[] = array('data' => drupal_render($form[$key]['TarLang']));
$row[] = array('data' => drupal_render($form[$key]['StatusID']));
$rows[] = $row;
}
}
$header = array();
$header[] = array('data' => t('Featured'), 'class' => 'checkbox');
$header[] = t('File ID');
$header[] = t('File Name');
$header[] = t('Source Language');
$header[] = t('Target Language');
$header[] = t('Status ID');
$header[] = t('Status Description');
$output = theme('table', $header, $rows,array('size'=>10, 'class' => 'table_class'));
$output .= drupal_render($form);
return $output;
}
谢谢安吉拉