Changeset 113

Show
Ignore:
Timestamp:
05/11/08 04:53:29 (3 months ago)
Author:
felix
Message:

alignment with productuon env

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rapyd/components/component.php

    r76 r113  
    157157  public function replace_functions($content, $functions='ALL') 
    158158  { 
    159     $formatting_functions = array ( 
     159    $formatting_functions = array("htmlspecialchars","htmlentities", 
    160160                                  "strtolower","strtoupper", 
    161161                                  "substr","strpos","nl2br", "number_format", 
    162                                   "dropdown","radiogroup","htmlspecialchars","htmlentities", 
     162                                  "dropdown", "radiogroup" 
    163163                                  ); 
    164164 
     
    226226  public function radiogroup($field,$id) 
    227227  { 
    228     if(is_object($this->source) ) 
    229     { 
    230       return $this->source->fields[$field]->options[$id]; 
    231     } 
     228    return $this->dropdown($field,$id); 
    232229  } 
    233230 
     
    253250  // -------------------------------------------------------------------- 
    254251 
    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); 
    258255  } 
    259256 
     
    264261     $this->button_container[$position][] = rpd_html::button($name, $caption, "", "submit", "button"); 
    265262  } 
     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   
    266284 
    267285  // -------------------------------------------------------------------- 
  • trunk/rapyd/components/datagrid.php

    r89 r113  
    116116  } 
    117117 
     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   
    118184  // -------------------------------------------------------------------- 
    119185 
  • trunk/rapyd/components/dataset.php

    r54 r113  
    196196      case "query": 
    197197        //orderby 
     198        $orderby_sql = ''; 
    198199        if(isset($this->orderby)) 
    199200        { 
     
    201202        } 
    202203        //limit-offset 
     204        $offset_sql = ''; 
    203205        if (isset($this->limit)) 
    204206        {