[Tutos-commits] SF.net SVN: tutos:[1172] trunk/php
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
From: <gok...@us...> - 2013-11-13 13:17:07
|
Revision: 1172 http://sourceforge.net/p/tutos/code/1172 Author: gokohnert Date: 2013-11-13 13:17:04 +0000 (Wed, 13 Nov 2013) Log Message: ----------- product overview export Modified Paths: -------------- trunk/php/custom.pinc trunk/php/product.pinc trunk/php/product_overview.php Modified: trunk/php/custom.pinc =================================================================== --- trunk/php/custom.pinc 2013-11-11 14:44:19 UTC (rev 1171) +++ trunk/php/custom.pinc 2013-11-13 13:17:04 UTC (rev 1172) @@ -843,9 +843,13 @@ function get() { global $lang; - $r = '<span class="CL_'.$this->get_parsename().' CL_'.$this->get_parsename().'_'.$this->content.'">'; - $r .= myentities(isset($lang[$this->x['lang'].'_'][$this->content]) ? $lang[$this->x['lang'].'_'][$this->content]: ($this->required ? $this->content .'??' : '')); - $r .= '</span>'; + if ($this->layout != null) { + $r = '<span class="CL_'.$this->get_parsename().' CL_'.$this->get_parsename().'_'.$this->content.'">'; + $r .= myentities(isset($lang[$this->x['lang'].'_'][$this->content]) ? $lang[$this->x['lang'].'_'][$this->content]: ($this->required ? $this->content .'??' : '')); + $r .= '</span>'; + } else { + $r .= (isset($lang[$this->x['lang'].'_'][$this->content]) ? $lang[$this->x['lang'].'_'][$this->content]: ($this->required ? $this->content .'??' : '')); + } return $r; } @@ -891,7 +895,10 @@ global $lang; if ($this->x['hideempty'] && (trim($this->content) == '') ) return ''; - return '<span class="pre CL_'.$this->get_parsename().'">'.format_txt($this->obj,$this->content,true,true,$this->txcols).'</span>'; + if ($this->layout != null) { + return '<span class="pre CL_'.$this->get_parsename().'">'.format_txt($this->obj,$this->content,true,true,$this->txcols).'</span>'; + } + return format_txt($this->obj,$this->content,true,true,$this->txcols); } /** Modified: trunk/php/product.pinc =================================================================== --- trunk/php/product.pinc 2013-11-11 14:44:19 UTC (rev 1171) +++ trunk/php/product.pinc 2013-11-13 13:17:04 UTC (rev 1172) @@ -407,6 +407,125 @@ } /** + * a headline for CSV Export + */ + static function exportCSV_Header(array $pshow) { + global $tutos; + + $r = ''; + $r .= txt2csv('ID'); + foreach ($tutos[prodfields] as $c) { + if ($c == 'ptask') { + continue; + } + if ($c == 'pbugs') { + continue; + } + if ($c == 'pfile') { + continue; + } + if ($c == 'checkbox') { + continue; + } + if ($pshow[$c]) { + $r .= txt2csv($c); + } + } + $r .= "\r\n"; + return $r; + } + + /** + * Return a data as comma seperated values string + */ + function exportCSV(array $pshow) { + global $lang, $table, $tutos; + + $r = ''; + $r .= txt2csv($this->id); + foreach ($tutos[prodfields] as $c) { + if (!$pshow[$c]) { + continue; + } + if ($c == 'name') { + $r .= txt2csv($this->name); + } else if ($c == 'version') { + $r .= txt2csv($this->version); + } else if ( preg_match('#role_#',$c) ) { + $this->readroles(); + $xx = ''; + foreach ( $lang['ProdRole'] as $ti => $tx) { + if ( ($c == 'role_'.$ti) && isset($this->role[$ti]) && (count($this->role[$ti]) > 0) ) { + $x = 0; + foreach ($this->role[$ti] as $i => $rx ) { + if ( $x > 0 ) { + $xx .= "\r\n"; + } + $xx .= $rx->getFullname(); + $x++; + } + } + } + $r .= txt2csv($xx); + } else if ($c == 'desc') { + $r .= txt2csv($this->description); + } else if ($c == 'desc1') { + $r .= txt2csv($this->desc1); + } else if ($c == 'desc2') { + $r .= txt2csv($this->desc2); + } else if ($c == 'state') { + $r .= txt2csv($this->getState()); + } else if ($c == 'probability') { + $r .= txt2csv($this->probability.' %'); + } else if ($c == 'price') { + $r .= txt2csv($this->price); + } else if ($c == 'cost') { + $r .= txt2csv($this->cost); + } else if ($c == 'creator') { + $r .= txt2csv($this->creator->getFullName()); + } else if ($c == 'creation') { + $r .= txt2csv($this->creation->getDate()); + } else if ($c == 'p_start') { + $r .= txt2csv($this->p_start->getDate()); + } else if ($c == 'p_end') { + $r .= txt2csv($this->p_end->getDate()); + } else if ($c == 'ptask') { + } else if ($c == 'pbugs') { + } else if ($c == 'pfile') { + } else if ($c == 'checkbox') { + } else if( preg_match('#cl#',$c) ) { + $xx = ''; + for ( $cl = 1;$cl <= $this->classes; $cl++) { + if ( $c != 'cl'.$cl ) { + continue; + } + $sep = ''; + foreach($this->cl[$cl] as $i => $f ) { + if ( isset ($lang['ProdClasses'.$cl][$f]) ) { + $xx .= $sep . $lang['ProdClasses'.$cl][$f] ; + } else { + $xx .= $sep . $f ; + } + $sep = "\r\n"; + } + } + $r .= txt2csv($xx); + } else if( preg_match('#p_c_#',$c) ) { + $c = preg_replace('#^p_c_#','',$c); + $x = $table['product'][$c]; + $f = '_fld_'.$c; + $r .= txt2csv(get_custom_field($x,$this->$f,$p,null,'product',$c)); + } else { + $r .= txt2csv('??? '.$c); + } + + } + $r .= "\r\n"; + + return $r; + } + + /** * Data of XML export */ function exportXML_body ($only_ids = false) { Modified: trunk/php/product_overview.php =================================================================== --- trunk/php/product_overview.php 2013-11-11 14:44:19 UTC (rev 1171) +++ trunk/php/product_overview.php 2013-11-13 13:17:04 UTC (rev 1172) @@ -34,6 +34,24 @@ */ class Product_overview extends layout { /** + * CSV Export Info + */ + Function exportinfo() { + global $lang,$tutos; + + $r = ''; + export_headers('TUTOS_product_export','csv'); + $a = 0; + + $r .= product::exportCSV_Header($this->pshow); + foreach($this->plist as $x) { + $r .= $x->exportCSV($this->pshow); + unset($x); + } + return $r; + } + + /** * display the info */ Function info() { @@ -59,6 +77,10 @@ $r = $this->statinfo(); return $r; } + if ($this->format == "csv" ) { + $r = $this->exportinfo(); + return $r; + } $this->flds = 0; $pf = 0; @@ -948,6 +970,17 @@ $this->addMenu($x); } + if ( $this->format != "paper" ) { + $ll = addUrlParameter($this->link1,'format=csv'); + $ll = addUrlParameter($ll,'ss='.$this->ss); + $x = array( url => $ll, + text => $lang['Export'].' (CSV)', + info => $lang['ExportInfo'], + category => array('csv','product','view',useprojects) + ); + $this->addMenu($x); + } + $x = array( url => $this->link3, text => $lang['SalesForecastRep'], info => $lang['SalesForecastRep'], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |