Changeset 126
- Timestamp:
- 05/27/08 14:01:32 (3 months ago)
- Files:
-
- trunk/rapyd/components/datagrid.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rapyd/components/datagrid.php
r113 r126 40 40 // -------------------------------------------------------------------- 41 41 42 function delete_button($config=null)42 function action_button($config=null) 43 43 { 44 44 $caption = (isset($config['caption'])) ? $config['caption'] : rpd::lang('btn.delete'); 45 $action = "javascript:document.forms['grid'].grid_action.value='delete';document.forms['grid'].submit()"; 46 $this->button("btn_delete", $caption, $action, "TR"); 45 $action_name = (isset($config['name'])) ? $config['name'] : 'delete'; 46 $action = "javascript:document.forms['grid".$this->cid."'].grid_action.value='".$action_name."';document.forms['grid".$this->cid."'].submit()"; 47 $this->button("btn_".$action_name, $caption, $action, "TR"); 47 48 } 48 49 … … 52 53 { 53 54 $caption = (isset($config['caption'])) ? $config['caption'] : rpd::lang('btn.add'); 54 $url = (isset($config['url'])) ? $config['url'] : $this->add_url; 55 $url = null; 56 if (isset($config['url']) OR $this->add_url!="") 57 { 58 $url = (isset($config['url'])) ? $config['url'] : $this->add_url; 59 } 60 55 61 $url = rpd_url::append('create'.$this->cid, 1, $url); 56 62 $action = "javascript:window.location='".$url."'"; … … 65 71 { 66 72 $action = $_POST['grid_action']; 73 67 74 if (isset($this->actions[$action])) call_user_func($this->actions[$action]); 68 75 } … … 81 88 if ($this->checkbox_form) 82 89 { 90 rpd::load_helper('form'); 83 91 $attributes = array('class'=>'form', 'name'=>'grid'); 84 92 $data['form_begin'] = rpd_form::open(rpd_url::get_url(), $attributes); … … 146 154 return rpd::load_view('datagrid_excell', $data, RAPYDPATH.'views/'); 147 155 } 148 149 // -------------------------------------------------------------------- 150 156 157 // -------------------------------------------------------------------- 158 151 159 protected function build_csv() 152 160 { … … 157 165 header("Content-type: csv/xml;"); 158 166 header("Content-Disposition: attachment; filename=" . $filename); 159 167 160 168 $data = get_object_vars($this); 161 169 … … 165 173 } 166 174 $output .= implode(';',$labels)."\n"; 167 175 168 176 //rows 169 177 foreach ($this->data as $tablerow) … … 181 189 return mb_convert_encoding($output, 'iso-8859-1', 'utf-8'); 182 190 } 183 191 184 192 // -------------------------------------------------------------------- 185 193 … … 335 343 if ($this->checkbox!="") 336 344 { 345 $value = $data_row[$this->field_name]; 337 346 $attributes = array( 338 347 'name' => $this->field_name.'[]', 339 348 'id' => $this->field_name.(string)self::$checkbox_id++, 340 349 ); 341 $value = $data_row[$this->checkbox];342 350 $this->check = rpd_form::checkbox($attributes, $value); 343 351 }