...
 
Commits (4)
......@@ -13,7 +13,7 @@
$info = array(
'title' => 'ProcessRockFinder',
'summary' => 'ProcessModule to test RockFinders',
'version' => 2,
'version' => 3,
'author' => 'Bernhard Baumrock, baumrock.com',
'icon' => 'bolt',
'requires' => ['RockFinder'],
......
......@@ -10,14 +10,22 @@ class ProcessRockFinder extends Process {
}
/**
* list all projects
* execute the tester interface
*/
public function ___execute() {
$form = $this->modules->get('InputfieldForm');
// if reset parameter is set, add comments to tester.txt file
$file = $this->config->paths->assets . 'RockGrid/tester.txt';
if($this->input->get->reset) {
$str = file_get_contents($file);
file_put_contents($file, str_replace("\n", "\n// ", $str));
$this->session->redirect('./');
}
// if tester.txt does not exist create it from sample file
if(!is_file($this->config->paths->assets . 'RockGrid/tester.txt')) {
$this->files->copy(__DIR__ . '/exampleTester.php', $this->config->paths->assets . 'RockGrid/tester.txt');
if(!is_file($file)) {
$this->files->copy(__DIR__ . '/exampleTester.php', $file);
}
$f = $this->modules->get('InputfieldTextarea');
......
<?php
$info = [
'title' => 'RockFinder',
'version' => '1.0.6',
'version' => '1.0.7',
'summary' => 'Highly Efficient and Flexible SQL Finder Module to return page data without loading PW pages into memory',
'singular' => true,
'autoload' => false,
......
......@@ -218,7 +218,6 @@ class RockFinder extends WireData implements Module {
*/
private function joinedFinderJoins() {
if(!count($this->joinedFinders)) return;
bd($this->joinedFinders);
$sql = "\n\n/* joinedFinderJoins */";
foreach($this->joinedFinders as $finder) {
......@@ -325,7 +324,6 @@ class RockFinder extends WireData implements Module {
* execute closures
*/
private function executeClosures($objects) {
// if limit is set return the objects
if($this->limit != '') return $objects;
......@@ -334,10 +332,17 @@ class RockFinder extends WireData implements Module {
// otherwise loop all objects and execute closures
foreach($this->closures as $column => $closure) {
foreach($objects as $row) {
// find the column and execute closure
$page = $this->pages->get($row->id);
$row->{$column} = $closure->__invoke($page);
foreach($objects as $i=>$row) {
if(is_array($row)) {
// initial request was getArrays()
$page = $this->pages->get($row['id']);
$objects[$i][$column] = $closure->__invoke($page);
}
else {
// initial request was getObjects()
$page = $this->pages->get($row->id);
$row->{$column} = $closure->__invoke($page);
}
}
}
return $objects;
......@@ -361,8 +366,6 @@ class RockFinder extends WireData implements Module {
* join another finder
*/
public function join($finder, $prefix, $fields) {
bd('join');
// parameter checks
if(!$finder instanceof RockFinder) {
throw new WireException('First parameter needs to be a RockFinder instance');
......