Changeset 113
- Timestamp:
- 05/11/08 04:53:29 (3 months ago)
- Files:
-
- trunk/rapyd/components/component.php (modified) (4 diffs)
- trunk/rapyd/components/datagrid.php (modified) (1 diff)
- trunk/rapyd/components/dataset.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rapyd/components/component.php
r76 r113 157 157 public function replace_functions($content, $functions='ALL') 158 158 { 159 $formatting_functions = array (159 $formatting_functions = array("htmlspecialchars","htmlentities", 160 160 "strtolower","strtoupper", 161 161 "substr","strpos","nl2br", "number_format", 162 "dropdown", "radiogroup","htmlspecialchars","htmlentities",162 "dropdown", "radiogroup" 163 163 ); 164 164 … … 226 226 public function radiogroup($field,$id) 227 227 { 228 if(is_object($this->source) ) 229 { 230 return $this->source->fields[$field]->options[$id]; 231 } 228 return $this->dropdown($field,$id); 232 229 } 233 230 … … 253 250 // -------------------------------------------------------------------- 254 251 255 function button($name, $caption, $action, $position="BL" )256 { 257 $this->button_container[$position][] = rpd_html::button($name, $caption, $action, "button", "button");252 function button($name, $caption, $action, $position="BL", $class="button") 253 { 254 $this->button_container[$position][] = rpd_html::button($name, $caption, $action, "button", $class); 258 255 } 259 256 … … 264 261 $this->button_container[$position][] = rpd_html::button($name, $caption, "", "submit", "button"); 265 262 } 263 264 // -------------------------------------------------------------------- 265 266 function action_button($config) 267 { 268 269 $caption = (isset($config['caption'])) ? $config['caption'] : "Azione"; 270 if (isset($config['popup']) || isset($config['target'])) 271 { 272 $config['popup'] = (isset($config['popup'])) ? ",'mywin','".$config['popup']."'" : ""; 273 $action = "javascript:window.open('".$config['url']."'".$config['popup'].")"; 274 } 275 else 276 { 277 $action = "javascript:window.location='".$config['url']."'"; 278 } 279 $position = (isset($config['position'])) ? $config['position'] : "TR"; 280 $class = (isset($config['class'])) ? $config['class'] : "button"; 281 $this->button("btn_act", $caption, $action, $position, $class); 282 } 283 266 284 267 285 // -------------------------------------------------------------------- trunk/rapyd/components/datagrid.php
r89 r113 116 116 } 117 117 118 // -------------------------------------------------------------------- 119 120 protected function build_excel() 121 { 122 $filename = $this->label.".xls"; 123 header ("Content-Type: application/vnd.ms-excel"); 124 header ("Content-Disposition: inline; filename=$filename"); 125 126 $data = get_object_vars($this); 127 128 //table rows 129 foreach ($this->data as $tablerow) 130 { 131 unset($row); 132 foreach ($this->columns as $column) 133 { 134 unset($cell); 135 $column->reset_pattern(); 136 $column->set_row($tablerow); 137 138 $cell = get_object_vars($column); 139 $cell["value"] = $column->get_value(); 140 $cell["type"] = $column->column_type; 141 $row[] = $cell; 142 } 143 $data["rows"][] = $row; 144 } 145 $data["total_rows"] = $this->total_rows; 146 return rpd::load_view('datagrid_excell', $data, RAPYDPATH.'views/'); 147 } 148 149 // -------------------------------------------------------------------- 150 151 protected function build_csv() 152 { 153 $output = ''; 154 $filename = $this->label.".csv"; 155 header('Pragma: private'); 156 header('Cache-control: private, must-revalidate'); 157 header("Content-type: csv/xml;"); 158 header("Content-Disposition: attachment; filename=" . $filename); 159 160 $data = get_object_vars($this); 161 162 foreach ($this->columns as $column) 163 { 164 $labels[] = $column->label; 165 } 166 $output .= implode(';',$labels)."\n"; 167 168 //rows 169 foreach ($this->data as $tablerow) 170 { 171 unset($values); 172 foreach ($this->columns as $column) 173 { 174 $column->reset_pattern(); 175 $column->set_row($tablerow); 176 $values[] = str_replace('"','""',$column->get_value()); //quota " come "" (notazione excel) 177 } 178 $rows[] = '"'.implode('";"',$values).'"'; 179 } 180 $output .= implode("\n",$rows)."\n"; 181 return mb_convert_encoding($output, 'iso-8859-1', 'utf-8'); 182 } 183 118 184 // -------------------------------------------------------------------- 119 185 trunk/rapyd/components/dataset.php
r54 r113 196 196 case "query": 197 197 //orderby 198 $orderby_sql = ''; 198 199 if(isset($this->orderby)) 199 200 { … … 201 202 } 202 203 //limit-offset 204 $offset_sql = ''; 203 205 if (isset($this->limit)) 204 206 {