$this->jok($x->toArray());
}
-
$this->loadMap($x, array(
'columns' => $_columns,
}
$se->send($fn .'.xls');
exit;
+
+ }
+
+ var $cols = array();
+
+ function loadMap($do, $cfg =array())
+ {
+ $onlycolumns = !empty($cfg['columns']) ? $cfg['columns'] : false;
+ $distinct = !empty($cfg['distinct']) ? $cfg['distinct'] : false;
+ $excludecolumns = !empty($cfg['exclude']) ? $cfg['exclude'] : array();
+
+ $excludecolumns[] = 'passwd'; // we never expose passwords
+
+ $ret = $do->autoJoin(array(
+ 'include' => $onlycolumns,
+ 'exclude' => $excludecolumns,
+ 'distinct' => $distinct
+ ));
+ exit;
+ $this->countWhat = $ret['count'];
+ $this->cols = $ret['cols'];
+ $this->colsJname = $ret['join_names'];
+
+ return;
+
+ }
+ function meta($x, $data)
+ {
+ $lost = 0;
+ $cols = array_keys($data[0]);
+
+ $options = &PEAR::getStaticProperty('DB_DataObject','options');
+ $reader = $options["ini_{$x->_database}"] .'.reader';
+ if (!file_exists( $reader )) {
+ return;
+ }
+
+ $rdata = unserialize(file_get_contents($reader));
+
+ $keys = $x->keys();
+ $key = empty($keys) ? 'id' : $keys[0];
+
+ $meta = array();
+ foreach($cols as $c ) {
+ if (!isset($this->cols[$c]) || !isset($rdata[$this->cols[$c]]) || !is_array($rdata[$this->cols[$c]])) {
+ $meta[] = $c;
+ continue;
+ }
+ $add = $rdata[$this->cols[$c]];
+ $add['name'] = $c;
+ $meta[] = $add;
+ }
+ return array(
+ 'totalProperty' => 'total',
+ 'successProperty' => 'success',
+ 'root' => 'data',
+ 'id' => $key, // was 'id'...
+ 'fields' => $meta
+ );
+
}
}