/**
  * Transforms Tracker_Renderer into a SimpleXMLElement
  * 
  * @param SimpleXMLElement $root the node to which the renderer is attached (passed by reference)
  * @param $formsMapping the form elements mapping
  */
 public function exportToXml(SimpleXMLElement $root, $formsMapping)
 {
     parent::exportToXML($root, $formsMapping);
     if ($mapping = (string) array_search($this->field_id, $formsMapping)) {
         $root->addAttribute('field_id', $mapping);
     }
 }
 /**
  * Finnish saving renderer to database by creating colunms
  * 
  * @param Tracker_Report_Renderer $renderer containing the columns
  */
 public function afterSaveObject($renderer)
 {
     $renderer->injectUnsavedColumnsInRendererDB($this);
     $this->saveAggregates($renderer->getAggregates());
     $this->saveSort($renderer->getSort());
 }
 /**
  * Transforms Tracker_Renderer into a SimpleXMLElement
  * 
  * @param SimpleXMLElement $root the node to which the renderer is attached (passed by reference)
  */
 public function exportToXml(SimpleXMLElement $root, $formsMapping)
 {
     parent::exportToXML($root, $formsMapping);
     $child = $root->addChild('charts');
     foreach ($this->getChartFactory()->getCharts($this) as $chart) {
         $grandchild = $child->addChild('chart');
         $chart->exportToXML($grandchild, $formsMapping);
     }
 }
 /**
  * Transforms Tracker_Renderer into a SimpleXMLElement
  * 
  * @param SimpleXMLElement $root the node to which the renderer is attached (passed by reference)
  */
 public function exportToXML($root, $xmlMapping)
 {
     parent::exportToXML($root, $xmlMapping);
     $root->addAttribute('chunksz', $this->chunksz);
     if ($this->multisort) {
         $root->addAttribute('multisort', $this->multisort);
     }
     $child = $root->addChild('columns');
     foreach ($this->getColumns() as $key => $col) {
         $child->addChild('field')->addAttribute('REF', array_search($key, $xmlMapping));
     }
     //TODO : add aggregates in XML export
     /*if ($this->getAggregates()) {
           $child = $root->addChild('aggregates');
           foreach ($this->getAggregates() as $field_id => $aggregates) {
               foreach ($aggregates as $aggregate) {
                   $child->addChild('aggregate')->addAttribute('REF', array_search($field_id, $xmlMapping))
                                                ->addAttribute('function', $aggregate);
               }
           }
       }*/
     if ($this->getSort()) {
         $child = $root->addChild('sort');
         foreach ($this->getSort() as $key => $sort) {
             $child->addChild('field')->addAttribute('REF', array_search($key, $xmlMapping));
         }
     }
 }