Author: p.juanpablo
Date: 2010-03-03 14:10:57 +0100 (Wed, 03 Mar 2010)
New Revision: 28363
Modified:
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportColumnWrapper.class.php
plugins/dcPropelReportsPlugin/trunk/lib/model/dcReportQuery.php
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/actions/actions.class.php
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result_row.php
Log:
se agrega para emitir se?\195?\177ales diferentes para html y para excel y se
agrega el numbre del reporte a la se?\195?\177al que se levanta
Modified:
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportColumnWrapper.class.php
===================================================================
---
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportColumnWrapper.class.php
2010-03-03 12:27:03 UTC (rev 28362)
+++
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportColumnWrapper.class.php
2010-03-03 13:10:57 UTC (rev 28363)
@@ -12,6 +12,9 @@
protected $field = null;
protected $value = null;
+ const FORMAT_HTML = 'HTML';
+ const FORMAT_EXCEL = 'EXCEL';
+
public function __construct($dcPropelReportFiled)
{
$this->field = $dcPropelReportFiled;
@@ -23,16 +26,15 @@
$this->value = $value;
}
- public function getValue($emitSignal=false)
+ public function getValue($format = 'HTML')
{
$res = $this->value;
$event = null;
- if ($emitSignal)
- {
- $event = $this->createEvent();
// Creo el evento
-
sfContext::getInstance()->getConfiguration()->getEventDispatcher()->filter($event,
$this->value); // Levanto la señal
- $res = $event->getReturnValue();
// Obtengo el valor modificado
- }
+
+ $event = $this->createEvent($format);
// Creo el evento
+
sfContext::getInstance()->getConfiguration()->getEventDispatcher()->filter($event,
$this->value); // Levanto la señal
+ $res = $event->getReturnValue();
// Obtengo el valor modificado
+
if (is_null($event) || (!$event->isProcessed() && !empty($value)))
{
// Si el evento no se procesó, obtengo el valor normalmente
@@ -42,11 +44,11 @@
}
- protected function createEvent()
+ protected function createEvent($format)
{
return new sfEvent(
$this,
// Objeto que levanto la señal
- 'dc_propel_report_query_'.$this->field->getRealColumnName(),
// Nombre de la señal
+
'dc_propel_report_query_'.$format.'_'.$this->field->getDcReportQuery()->getNameSlug().'_'.$this->field->getRealColumnName(),
// Nombre de la señal
array('fieldName' => $this->field->__toString())
// Lista de parámetros
);
}
Modified: plugins/dcPropelReportsPlugin/trunk/lib/model/dcReportQuery.php
===================================================================
--- plugins/dcPropelReportsPlugin/trunk/lib/model/dcReportQuery.php
2010-03-03 12:27:03 UTC (rev 28362)
+++ plugins/dcPropelReportsPlugin/trunk/lib/model/dcReportQuery.php
2010-03-03 13:10:57 UTC (rev 28363)
@@ -128,6 +128,19 @@
$cri->addAscendingOrderByColumn(dcReportTablePeer::ID);
return dcReportTablePeer::doSelect($cri);
}
+
+
+ public function getNameSlug()
+ {
+ // replace all non letters or digits by -
+ $text = preg_replace('/\W+/', '-', $this->getName());
+
+ // trim and lowercase
+ $text = strtolower(trim($text, '-'));
+
+ return $text;
+
+ }
}
Modified:
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/actions/actions.class.php
===================================================================
---
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/actions/actions.class.php
2010-03-03 12:27:03 UTC (rev 28362)
+++
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/actions/actions.class.php
2010-03-03 13:10:57 UTC (rev 28363)
@@ -315,7 +315,7 @@
foreach($data_row as $key=>$value) {
$wrapper = $column_wrappers[$column];
$wrapper->setValue($value);
-
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column,
$row,$wrapper->getValue(true));
+
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column,
$row,$wrapper->getValue(dcPropelReportColumnWrapper::FORMAT_EXCEL));
$column++;
}
$row++;
Modified:
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result_row.php
===================================================================
---
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result_row.php
2010-03-03 12:27:03 UTC (rev 28362)
+++
plugins/dcPropelReportsPlugin/trunk/modules/dc_report_list/templates/_result_row.php
2010-03-03 13:10:57 UTC (rev 28363)
@@ -3,7 +3,7 @@
<?php $wrapper = $column_wrappers[$i]; ?>
<?php $wrapper->setValue($field); ?>
<td class="sf_admin_text">
- <?php echo $wrapper->getValue(true); ?>
+ <?php echo $wrapper->getValue(dcPropelReportColumnWrapper::FORMAT_HTML); ?>
</td>
<?php $i++; ?>
<?php endforeach ?>
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.