Development

Changeset 9016

You must first sign up to be able to contribute.

Changeset 9016

Show
Ignore:
Timestamp:
05/16/08 20:07:38 (5 months ago)
Author:
Jonathan.Todd
Message:

sfYUIPlugin: branches/jtodd - made actions passing more generic

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfYUIPlugin/branches/jtodd/lib/helper/YUIDatatableHelper.php

    r8968 r9016  
    6666 * @param array $objects Array of hydrated objects like $objects = Doctrine::getTable('EmailInformation')->findAll() 
    6767 * @param array $fields Associative array of fields and column definitions 
    68  * @param array $actions Associative array of the form: array('Edit' => url_for('EmailInformation/edit')); 
     68 * @param array $actions Associative array of the form: array('Edit' => array('href' => url_for('EmailInformation/edit'))); 
    6969 */  
    7070function yui_datatable_doctrine_object_to_data_js($objects,$fields,$actions) 
     
    8181      { 
    8282        $js_data .= 'actions: '; 
    83         foreach($actions as $action => $url
     83        foreach($actions as $action => $options
    8484        { 
    85           $js_data .= '"<a href=\"'.$url.'?id='.$object->getId().'\">'.$action.'</a>" '; 
     85          $js_data .= '"<a '; 
     86          foreach($options as $option => $value) 
     87          { 
     88            $val = str_replace($value, '#id#', $object->getId()); 
     89            $js_data .= ' '.$option.'=\"'.$val.'\" '; 
     90             
     91          } 
     92          $js_data .=' \">'.$action.'</a>" '; 
    8693        } 
    8794        $js_data .= ',';