如何在Drupal 6主题表中添加超链接

时间:2011-12-23 10:48:46

标签: php drupal-6 drupal-themes

我在我的Drupal 6设置中创建了一个表,其中的主题是http://www.image-share.com/ijpg-1153-142.html,这里是代码

function theme_freeway_dashboard($form) {

  $rows = array();
  foreach (element_children($form) as $key) {
    $row = array();
    if (isset($form[$key]['projectID'])) {
      $status = drupal_render($form['featured'][$key]);
      $row[] = array('data' => $status, 'class' => 'checkbox');
      $row[] = '' . drupal_render($form[$key]['projectID']) . '';
      $row[] = array('data' => drupal_render($form[$key]['projectDesc']));
      $rows[] = $row;
    }
  }

  $header = array();
  $header[] = array('data' => t('Featured'), 'class' => 'checkbox');
  $header[] = t('Project ID');
  $header[] = t('Project Description');

  $output = theme('table', $header, $rows, array('size' => 10, 'class' => 'table_class'));

  $output .= drupal_render($form);

  return $output;
}

..我想知道我是否可以在表内有超链接对于rg:如果你看到图像..我需要项目ID行是超链接 我跟着这个链接'http://www.akchauhan.com/create-drupal-form-using-theme_table-like-module-list-form/'作为表格部分,但是他们在那里使用了复选框......我怎么能使用超链接导航到下一页?

下面显示的代码是获取创建表的组件的代码。即数组中的项目ID和项目描述。基本上这些是从Web服务调用调用的。

        function freeway_dashboard(){
          drupal_add_js(drupal_get_path('module', 'freeway') .'/js/dashboardscript.js');

          $statusValue = 'Draft';
          $listOfProjectsIds = array();
          $listOfProjectsDesc = array();
          $node = node_load(arg(1));
          $form = array(); 
          $url_arg = trim($_GET['status']);
          //echo($url_arg);

          $arrayStatus = array(1 =>'Draft',2=>'NotSpecified',3=>'Quote',4=>'Forecasted',5=>'InEvaluation',6=>'Cancelled',7=>'Booked',8=>'InProduction',9=>'Completed',10=>'Closed');

                    $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));

         if (!$url_arg){
                          try{

                          $arrResponse = $LoginClient->Logon(array ('Username'=>'user','Password'=>'pwrd'));
                          $ticket = ($arrResponse->LogonResult);
                          $getSrcLang = $ServicesLink->GetSourceLanguages(array('Ticket'=>$ticket));
                          $getDraftProjectIds = $ServicesLink->GetProjectSummariesList(array('Ticket'=>$ticket,'NumberOfProjects'=>100,'SortOrder'=>MostRecent,'ProjectStatusCode'=>'Draft'));

                                        foreach ($getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary as $i=>$getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary) 
                                        {

                                         $listOfProjectsIds[$i] = $getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary->ID;                     
                                         $listOfProjectsDesc[$i] = $getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary->Description;                       
                                        } 

                          }
                              catch (SoapFault $exception){
                              return $exception;
                          }
                }     

                else {
                        try{

                              $arrResponse = $LoginClient->Logon(array ('Username'=>'dmitry.testuser','Password'=>'I8it4lunch'));
                              $ticket = ($arrResponse->LogonResult);
                              $getSrcLang = $ServicesLink->GetSourceLanguages(array('Ticket'=>$ticket));
                              $getDraftProjectIds = $ServicesLink->GetProjectSummariesList(array('Ticket'=>$ticket,'NumberOfProjects'=>100,'SortOrder'=>MostRecent,'ProjectStatusCode'=>$url_arg));

                                            foreach ($getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary as $i=>$getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary) 
                                            {

                                             $listOfProjectsIds[$i] = $getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary->ID;                     
                                             $listOfProjectsDesc[$i] = $getDraftProjectIds->GetProjectSummariesListResult->ProjectSummaries->ProjectSummary->Description;                       
                                            } 

                              }
                                  catch (SoapFault $exception){
                                  return $exception;
                              }
                     }

                      $form['status_list']=array(
                        '#type'=>'select',
                        '#title' => t('Freeway Project Statuses'),
                        '#options' => $arrayStatus,
                        '#default_value' => t('Select Status'),
                        '#attributes'=> array('onselect' => "populateStatusTables();"),
                        '#weight'=>0,
                    );





                      for($m=0;$m <count($listOfProjectsIds);$m+=1){
                       $options[$listOfProjectsIds[$m]] = '';
                       $form[$listOfProjectsIds[$m]]['projectID'] = array('#value' =>  $listOfProjectsIds[$m]);
                        $form[$listOfProjectsIds[$m]]['projectDesc'] = array('#value' =>  $listOfProjectsDesc[$m]);

                      }




                    $form['featured'] = array(
                            '#type' => 'checkboxes',
                            '#options' => $options,
                            '#multiple' => false,

                        );

                    $form['getProjectDetails'] = array(
                            '#type' => 'submit',
                            '#value' => t('Get Details'),
                            '#weight'=>5,
                        );

                    $form['cancel'] = array(
                            '#type' => 'markup',
                            '#value' => l(t('Cancel'), 'dashboard'),
                            '#weight'=>6,
                        );

        return $form;

        }

谢谢, 安吉拉

0 个答案:

没有答案