Completed
Push — issue/203 ( 66dda3...51c0a4 )
by Tomas Norre
32:37 queued 23:42
created
domain/process/class.tx_crawler_domain_process_manager.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * Manages cralwer processes and can be used to start a new process or multiple processes
27 27
  *
28 28
  */
29
-class tx_crawler_domain_process_manager  {
29
+class tx_crawler_domain_process_manager {
30 30
 
31 31
     /**
32 32
      * @var $timeToLive integer
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @throws RuntimeException
85 85
      */
86
-    public function multiProcess( $timeout ) {
86
+    public function multiProcess($timeout) {
87 87
 
88 88
         if ($this->processLimit <= 1) {
89
-            throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.' . PHP_EOL);
89
+            throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.'.PHP_EOL);
90 90
         }
91 91
 
92 92
         $pendingItemsStart = $this->queueRepository->countAllPendingItems();
93 93
         $itemReportLimit = 20;
94
-        $reportItemCount =     $pendingItemsStart -  $itemReportLimit;
94
+        $reportItemCount = $pendingItemsStart - $itemReportLimit;
95 95
         if ($this->verbose) {
96 96
             $this->reportItemStatus();
97 97
         }
98 98
         $this->startRequiredProcesses();
99 99
         $nextTimeOut = time() + $this->timeToLive;
100
-        for ($i=0; $i<$timeout; $i++) {
100
+        for ($i = 0; $i < $timeout; $i++) {
101 101
             $currentPendingItems = $this->queueRepository->countAllPendingItems();
102 102
             if ($this->startRequiredProcesses($this->verbose)) {
103 103
                 $nextTimeOut = time() + $this->timeToLive;
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
                 if ($this->verbose) {
113 113
                     $this->reportItemStatus();
114 114
                 }
115
-                $reportItemCount = $currentPendingItems -  $itemReportLimit;
115
+                $reportItemCount = $currentPendingItems - $itemReportLimit;
116 116
             }
117 117
             sleep(1);
118 118
             if ($nextTimeOut < time()) {
119
-                $timedOutProcesses = $this->processRepository->findAll('','DESC',NULL,0,'ttl >'.$nextTimeOut);
119
+                $timedOutProcesses = $this->processRepository->findAll('', 'DESC', NULL, 0, 'ttl >'.$nextTimeOut);
120 120
                 $nextTimeOut = time() + $this->timeToLive;
121 121
                 if ($this->verbose) {
122
-                    echo 'Cleanup'.implode(',',$timedOutProcesses->getProcessIds()).chr(10);
122
+                    echo 'Cleanup'.implode(',', $timedOutProcesses->getProcessIds()).chr(10);
123 123
                 }
124
-                $this->crawlerObj->CLI_releaseProcesses($timedOutProcesses->getProcessIds(),true);
124
+                $this->crawlerObj->CLI_releaseProcesses($timedOutProcesses->getProcessIds(), true);
125 125
             }
126 126
         }
127 127
         if ($currentPendingItems > 0 && $this->verbose) {
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
      */
144 144
     private function startRequiredProcesses() {
145 145
         $ret = FALSE;
146
-        $currentProcesses= $this->processRepository->countActive();
147
-        $availableProcessesCount = $this->processLimit-$currentProcesses;
146
+        $currentProcesses = $this->processRepository->countActive();
147
+        $availableProcessesCount = $this->processLimit - $currentProcesses;
148 148
         $requiredProcessesCount = ceil($this->queueRepository->countAllUnassignedPendingItems() / $this->countInARun);
149
-        $startProcessCount = min(array($availableProcessesCount,$requiredProcessesCount));
149
+        $startProcessCount = min(array($availableProcessesCount, $requiredProcessesCount));
150 150
         if ($startProcessCount <= 0) {
151 151
             return $ret;
152 152
         }
153 153
         if ($startProcessCount && $this->verbose) {
154 154
             echo 'Start '.$startProcessCount.' new processes (Running:'.$currentProcesses.')';
155 155
         }
156
-        for($i=0;$i<$startProcessCount;$i++) {
156
+        for ($i = 0; $i < $startProcessCount; $i++) {
157 157
             usleep(100);
158 158
             if ($this->startProcess()) {
159 159
                 if ($this->verbose) {
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
      * @throws Exception if no crawlerprocess was started
174 174
      */
175 175
     public function startProcess() {
176
-        $ttl = (time() + $this->timeToLive -1);
176
+        $ttl = (time() + $this->timeToLive - 1);
177 177
         $current = $this->processRepository->countNotTimeouted($ttl);
178 178
         // Check whether OS is Windows
179 179
         if (TYPO3_OS === 'WIN') {
180
-            $sCompletePath = escapeshellcmd('start ' . $this->getCrawlerCliPath());
180
+            $sCompletePath = escapeshellcmd('start '.$this->getCrawlerCliPath());
181 181
             $oFileHandler = popen($sCompletePath, 'r');
182 182
             if ($oFileHandler !== false) {
183 183
                 pclose($oFileHandler);
184 184
             }
185 185
         }
186 186
         else {
187
-            $sCompletePath = '(' .escapeshellcmd($this->getCrawlerCliPath()) . ' &) > /dev/null';
187
+            $sCompletePath = '('.escapeshellcmd($this->getCrawlerCliPath()).' &) > /dev/null';
188 188
             $oFileHandler = system($sCompletePath);
189 189
         }
190 190
         if ($oFileHandler === false) {
191 191
             throw new Exception('could not start process!');
192 192
         }
193 193
         else {
194
-            for ($i=0;$i<10;$i++) {
194
+            for ($i = 0; $i < 10; $i++) {
195 195
                 if ($this->processRepository->countNotTimeouted($ttl) > $current) {
196 196
                     return true;
197 197
                 }
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
      *
207 207
      * @return string
208 208
      */
209
-    public function getCrawlerCliPath(){
210
-        $phpPath         = $this->crawlerObj->extensionSettings['phpPath'] . ' ';
209
+    public function getCrawlerCliPath() {
210
+        $phpPath         = $this->crawlerObj->extensionSettings['phpPath'].' ';
211 211
         $pathToTypo3     = rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/');
212
-        $pathToTypo3     .= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/');
212
+        $pathToTypo3 .= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/');
213 213
         $cliPart         = '/typo3/cli_dispatch.phpsh crawler';
214 214
         
215 215
         $scriptPath = $phpPath.$pathToTypo3.$cliPart;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -182,15 +182,13 @@
 block discarded – undo
182 182
             if ($oFileHandler !== false) {
183 183
                 pclose($oFileHandler);
184 184
             }
185
-        }
186
-        else {
185
+        } else {
187 186
             $sCompletePath = '(' .escapeshellcmd($this->getCrawlerCliPath()) . ' &) > /dev/null';
188 187
             $oFileHandler = system($sCompletePath);
189 188
         }
190 189
         if ($oFileHandler === false) {
191 190
             throw new Exception('could not start process!');
192
-        }
193
-        else {
191
+        } else {
194 192
             for ($i=0;$i<10;$i++) {
195 193
                 if ($this->processRepository->countNotTimeouted($ttl) > $current) {
196 194
                     return true;
Please login to merge, or discard this patch.
domain/process/class.tx_crawler_domain_process.php 2 patches
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -24,145 +24,145 @@
 block discarded – undo
24 24
 
25 25
 class tx_crawler_domain_process extends tx_crawler_domain_lib_abstract_dbobject {
26 26
 
27
-	CONST STATE_RUNNING = 'running';
28
-	CONST STATE_CANCELLED = 'cancelled';
29
-	CONST STATE_COMPLETED = 'completed';
30
-
31
-	/**
32
-	 * @var string table name
33
-	 */
34
-	protected static $tableName = 'tx_crawler_process';
35
-
36
-	/**
37
-	 * Returns the activity state for this process
38
-	 *
39
-	 * @param void
40
-	 * @return boolean
41
-	 */
42
-	public function getActive() {
43
-		return $this->row['active'];
44
-	}
45
-
46
-	/**
47
-	 * Returns the identifier for the process
48
-	 *
49
-	 * @return string
50
-	 */
51
-	public function getProcess_id() {
52
-		return $this->row['process_id'];
53
-	}
54
-
55
-	/**
56
-	 * Returns the timestamp of the exectime for the first relevant queue item.
57
-	 * This can be used to determine the runtime
58
-	 *
59
-	 * @return int
60
-	 */
61
-	public function getTimeForFirstItem() {
62
-		$queueRepository = new tx_crawler_domain_queue_repository();
63
-		$entry = $queueRepository->findYoungestEntryForProcess($this);
64
-
65
-		return $entry->getExecutionTime();
66
-	}
67
-
68
-	/**
69
-	 * Returns the timestamp of the exectime for the last relevant queue item.
70
-	 * This can be used to determine the runtime
71
-	 *
72
-	 * @return int
73
-	 */
74
-	public function getTimeForLastItem() {
75
-		$queueRepository = new tx_crawler_domain_queue_repository();
76
-		$entry = $queueRepository->findOldestEntryForProcess($this);
77
-
78
-		return $entry->getExecutionTime();
79
-	}
80
-
81
-	/**
82
-	 * Returns the difference between first and last processed item
83
-	 *
84
-	 * @return int
85
-	 */
86
-	public function getRuntime() {
87
-		return $this->getTimeForLastItem() - $this->getTimeForFirstItem();
88
-	}
89
-
90
-	/**
91
-	 * Returns the ttl of the process
92
-	 *
93
-	 * @return int
94
-	 */
95
-	public function getTTL() {
96
-		return $this->row['ttl'];
97
-	}
98
-
99
-	/**
100
-	 * Counts the number of items which need to be processed
101
-	 *
102
-	 * @author Timo Schmidt <[email protected]>
103
-	 * @param void
104
-	 * @return int
105
-	 */
106
-	public function countItemsProcessed() {
107
-		$queueRepository = new tx_crawler_domain_queue_repository();
108
-		return $queueRepository->countExecutedItemsByProcess($this);
109
-	}
110
-
111
-	/**
112
-	 * Counts the number of items which still need to be processed
113
-	 *
114
-	 * @author Timo Schmidt <[email protected]>
115
-	 * @param void
116
-	 * @return int
117
-	 */
118
-	public function countItemsToProcess() {
119
-		$queueRepository = new tx_crawler_domain_queue_repository();
120
-		return $queueRepository->countNonExecutedItemsByProcess($this);
121
-	}
122
-
123
-	/**
124
-	 * Returns the Progress of a crawling process as a percentage value
125
-	 *
126
-	 * @param void
127
-	 * @return float
128
-	 */
129
-	public function getProgress() {
130
-		$all = $this->countItemsAssigned();
131
-		if ($all<=0) {
132
-			return 0;
133
-		}
134
-
135
-		$res = round((100 / $all) * $this->countItemsProcessed());
136
-
137
-		if ($res > 100.0) {
138
-			return 100.0;
139
-		}
140
-		return $res;
141
-	}
142
-
143
-	/**
144
-	 * Returns the number of assigned Entrys
145
-	 *
146
-	 * @return int
147
-	 */
148
-	public function countItemsAssigned() {
149
-		return $this->row['assigned_items_count'];
150
-	}
151
-
152
-	/**
153
-	 * Return the processes current state
154
-	 *
155
-	 * @param void
156
-	 * @return string 'running'|'cancelled'|'completed'
157
-	 */
158
-	public function getState() {
159
-		if ($this->getActive() && $this->getProgress() < 100) {
160
-			$stage = tx_crawler_domain_process::STATE_RUNNING;
161
-		} elseif (!$this->getActive() && $this->getProgress() < 100) {
162
-			$stage = tx_crawler_domain_process::STATE_CANCELLED;
163
-		} else {
164
-			$stage = tx_crawler_domain_process::STATE_COMPLETED;
165
-		}
166
-		return $stage;
167
-	}
27
+    CONST STATE_RUNNING = 'running';
28
+    CONST STATE_CANCELLED = 'cancelled';
29
+    CONST STATE_COMPLETED = 'completed';
30
+
31
+    /**
32
+     * @var string table name
33
+     */
34
+    protected static $tableName = 'tx_crawler_process';
35
+
36
+    /**
37
+     * Returns the activity state for this process
38
+     *
39
+     * @param void
40
+     * @return boolean
41
+     */
42
+    public function getActive() {
43
+        return $this->row['active'];
44
+    }
45
+
46
+    /**
47
+     * Returns the identifier for the process
48
+     *
49
+     * @return string
50
+     */
51
+    public function getProcess_id() {
52
+        return $this->row['process_id'];
53
+    }
54
+
55
+    /**
56
+     * Returns the timestamp of the exectime for the first relevant queue item.
57
+     * This can be used to determine the runtime
58
+     *
59
+     * @return int
60
+     */
61
+    public function getTimeForFirstItem() {
62
+        $queueRepository = new tx_crawler_domain_queue_repository();
63
+        $entry = $queueRepository->findYoungestEntryForProcess($this);
64
+
65
+        return $entry->getExecutionTime();
66
+    }
67
+
68
+    /**
69
+     * Returns the timestamp of the exectime for the last relevant queue item.
70
+     * This can be used to determine the runtime
71
+     *
72
+     * @return int
73
+     */
74
+    public function getTimeForLastItem() {
75
+        $queueRepository = new tx_crawler_domain_queue_repository();
76
+        $entry = $queueRepository->findOldestEntryForProcess($this);
77
+
78
+        return $entry->getExecutionTime();
79
+    }
80
+
81
+    /**
82
+     * Returns the difference between first and last processed item
83
+     *
84
+     * @return int
85
+     */
86
+    public function getRuntime() {
87
+        return $this->getTimeForLastItem() - $this->getTimeForFirstItem();
88
+    }
89
+
90
+    /**
91
+     * Returns the ttl of the process
92
+     *
93
+     * @return int
94
+     */
95
+    public function getTTL() {
96
+        return $this->row['ttl'];
97
+    }
98
+
99
+    /**
100
+     * Counts the number of items which need to be processed
101
+     *
102
+     * @author Timo Schmidt <[email protected]>
103
+     * @param void
104
+     * @return int
105
+     */
106
+    public function countItemsProcessed() {
107
+        $queueRepository = new tx_crawler_domain_queue_repository();
108
+        return $queueRepository->countExecutedItemsByProcess($this);
109
+    }
110
+
111
+    /**
112
+     * Counts the number of items which still need to be processed
113
+     *
114
+     * @author Timo Schmidt <[email protected]>
115
+     * @param void
116
+     * @return int
117
+     */
118
+    public function countItemsToProcess() {
119
+        $queueRepository = new tx_crawler_domain_queue_repository();
120
+        return $queueRepository->countNonExecutedItemsByProcess($this);
121
+    }
122
+
123
+    /**
124
+     * Returns the Progress of a crawling process as a percentage value
125
+     *
126
+     * @param void
127
+     * @return float
128
+     */
129
+    public function getProgress() {
130
+        $all = $this->countItemsAssigned();
131
+        if ($all<=0) {
132
+            return 0;
133
+        }
134
+
135
+        $res = round((100 / $all) * $this->countItemsProcessed());
136
+
137
+        if ($res > 100.0) {
138
+            return 100.0;
139
+        }
140
+        return $res;
141
+    }
142
+
143
+    /**
144
+     * Returns the number of assigned Entrys
145
+     *
146
+     * @return int
147
+     */
148
+    public function countItemsAssigned() {
149
+        return $this->row['assigned_items_count'];
150
+    }
151
+
152
+    /**
153
+     * Return the processes current state
154
+     *
155
+     * @param void
156
+     * @return string 'running'|'cancelled'|'completed'
157
+     */
158
+    public function getState() {
159
+        if ($this->getActive() && $this->getProgress() < 100) {
160
+            $stage = tx_crawler_domain_process::STATE_RUNNING;
161
+        } elseif (!$this->getActive() && $this->getProgress() < 100) {
162
+            $stage = tx_crawler_domain_process::STATE_CANCELLED;
163
+        } else {
164
+            $stage = tx_crawler_domain_process::STATE_COMPLETED;
165
+        }
166
+        return $stage;
167
+    }
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 	 */
129 129
 	public function getProgress() {
130 130
 		$all = $this->countItemsAssigned();
131
-		if ($all<=0) {
131
+		if ($all <= 0) {
132 132
 			return 0;
133 133
 		}
134 134
 
Please login to merge, or discard this patch.
domain/process/class.tx_crawler_domain_process_collection.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -41,62 +41,62 @@
 block discarded – undo
41 41
  */
42 42
 class tx_crawler_domain_process_collection extends ArrayObject {
43 43
 
44
-	/**
45
-	 * Method to retrieve an element from the collection.
46
-	 * @access public
47
- 	 * @throws Exception
48
-	 * @return tx_crawler_domain_process
49
-	 */
50
-	public function offsetGet($index) {
51
-		if (! parent::offsetExists($index)) {
52
-			throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
53
-		}
54
-		return parent::offsetGet($index);
55
-	}
44
+    /**
45
+     * Method to retrieve an element from the collection.
46
+     * @access public
47
+     * @throws Exception
48
+     * @return tx_crawler_domain_process
49
+     */
50
+    public function offsetGet($index) {
51
+        if (! parent::offsetExists($index)) {
52
+            throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
53
+        }
54
+        return parent::offsetGet($index);
55
+    }
56 56
 
57
-	/**
58
-	 * Method to add an element to the collection-
59
-	 *
60
-	 * @param mixed $index
61
-	 * @param tx_crawler_domain_process $subject
62
-	 * @throws InvalidArgumentException
63
-	 * @return void
64
-	 */
65
-	public function offsetSet($index, $subject) {
66
-		if (! $subject instanceof tx_crawler_domain_process ) {
67
-			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
68
-		}
69
-		parent::offsetSet($index, $subject);
70
-	}
57
+    /**
58
+     * Method to add an element to the collection-
59
+     *
60
+     * @param mixed $index
61
+     * @param tx_crawler_domain_process $subject
62
+     * @throws InvalidArgumentException
63
+     * @return void
64
+     */
65
+    public function offsetSet($index, $subject) {
66
+        if (! $subject instanceof tx_crawler_domain_process ) {
67
+            throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
68
+        }
69
+        parent::offsetSet($index, $subject);
70
+    }
71 71
 
72
-	/**
73
-	 * Method to append an element to the collection
74
-	 * @param tx_crawler_domain_process $subject
75
-	 * @throws InvalidArgumentException
76
-	 * @return void
77
-	 */
78
-	public function append($subject) {
79
-		if (! $subject instanceof tx_crawler_domain_process ) {
80
-			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
81
-		}
82
-		parent::append($subject);
83
-	}
72
+    /**
73
+     * Method to append an element to the collection
74
+     * @param tx_crawler_domain_process $subject
75
+     * @throws InvalidArgumentException
76
+     * @return void
77
+     */
78
+    public function append($subject) {
79
+        if (! $subject instanceof tx_crawler_domain_process ) {
80
+            throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
81
+        }
82
+        parent::append($subject);
83
+    }
84 84
 	
85
-	/**
86
-	 * returns array of process ids of the current collection
87
-	 * @return array
88
-	 */
89
-	public function getProcessIds() {
90
-		$result=array();
91
-		foreach ($this->getIterator() as $value) {
92
-			$result[]=$value->getProcess_id();
93
-		}
94
-		return $result;
95
-	}
85
+    /**
86
+     * returns array of process ids of the current collection
87
+     * @return array
88
+     */
89
+    public function getProcessIds() {
90
+        $result=array();
91
+        foreach ($this->getIterator() as $value) {
92
+            $result[]=$value->getProcess_id();
93
+        }
94
+        return $result;
95
+    }
96 96
 }
97 97
 
98 98
 
99 99
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']) {
100
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']);
100
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/domain/process/class.tx_crawler_domain_process_collection.php']);
101 101
 }
102 102
 ?>
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @return tx_crawler_domain_process
49 49
 	 */
50 50
 	public function offsetGet($index) {
51
-		if (! parent::offsetExists($index)) {
52
-			throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
51
+		if (!parent::offsetExists($index)) {
52
+			throw new Exception('Index "'.var_export($index, true).'" for tx_crawler_domain_process are not available');
53 53
 		}
54 54
 		return parent::offsetGet($index);
55 55
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return void
64 64
 	 */
65 65
 	public function offsetSet($index, $subject) {
66
-		if (! $subject instanceof tx_crawler_domain_process ) {
66
+		if (!$subject instanceof tx_crawler_domain_process) {
67 67
 			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
68 68
 		}
69 69
 		parent::offsetSet($index, $subject);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return void
77 77
 	 */
78 78
 	public function append($subject) {
79
-		if (! $subject instanceof tx_crawler_domain_process ) {
79
+		if (!$subject instanceof tx_crawler_domain_process) {
80 80
 			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
81 81
 		}
82 82
 		parent::append($subject);
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @return array
88 88
 	 */
89 89
 	public function getProcessIds() {
90
-		$result=array();
90
+		$result = array();
91 91
 		foreach ($this->getIterator() as $value) {
92
-			$result[]=$value->getProcess_id();
92
+			$result[] = $value->getProcess_id();
93 93
 		}
94 94
 		return $result;
95 95
 	}
Please login to merge, or discard this patch.
domain/events/interface.tx_crawler_domain_events_observer.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 
25 25
 interface tx_crawler_domain_events_observer {
26 26
 
27
-	/**
28
-	 * This method should be implemented by the observer to register events
29
-	 * that should be forwarded to the observer
30
-	 *
31
-	 * @param tx_crawler_domain_events_dispatcher $dispatcher
32
-	 * @return boolean
33
-	 */
34
-	public function registerObservers(tx_crawler_domain_events_dispatcher $dispatcher);
27
+    /**
28
+     * This method should be implemented by the observer to register events
29
+     * that should be forwarded to the observer
30
+     *
31
+     * @param tx_crawler_domain_events_dispatcher $dispatcher
32
+     * @return boolean
33
+     */
34
+    public function registerObservers(tx_crawler_domain_events_dispatcher $dispatcher);
35 35
 }
36 36
 
37 37
 ?>
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
domain/events/class.tx_crawler_domain_events_dispatcher.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -52,32 +52,32 @@  discard block
 block discarded – undo
52 52
  */
53 53
 class tx_crawler_domain_events_dispatcher {
54 54
 
55
-	/**
56
-	 * @var array of tx_crawler_domain_events_observer objects;
57
-	 */
58
-	protected $observers;
55
+    /**
56
+     * @var array of tx_crawler_domain_events_observer objects;
57
+     */
58
+    protected $observers;
59 59
 
60
-	/**
61
-	 * @var tx_crawler_domain_events_dispatcher
62
-	 */
63
-	protected static $instance;
60
+    /**
61
+     * @var tx_crawler_domain_events_dispatcher
62
+     */
63
+    protected static $instance;
64 64
 
65
-	/**
66
-	 * The __constructor is private because the dispatcher is a singleton
67
-	 *
68
-	 * @param void
69
-	 * @return void
70
-	 */
65
+    /**
66
+     * The __constructor is private because the dispatcher is a singleton
67
+     *
68
+     * @param void
69
+     * @return void
70
+     */
71 71
     protected function __construct() {
72
-    	$this->observers = array();
73
-    	if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
74
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) {
75
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
76
-				if (method_exists($hookObj, 'registerObservers')) {
77
-					$hookObj->registerObservers($this);
78
-				}
79
-			}
80
-		}
72
+        $this->observers = array();
73
+        if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
74
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) {
75
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
76
+                if (method_exists($hookObj, 'registerObservers')) {
77
+                    $hookObj->registerObservers($this);
78
+                }
79
+            }
80
+        }
81 81
     }
82 82
 
83 83
     /**
@@ -86,62 +86,62 @@  discard block
 block discarded – undo
86 86
      * @param void
87 87
      * @return array array with registered events.
88 88
      */
89
-	protected function getEvents() {
90
-		return array_keys($this->observers);
91
-	}
89
+    protected function getEvents() {
90
+        return array_keys($this->observers);
91
+    }
92 92
 
93
-	/**
94
-	 * This method can be used to add an observer for an event to the dispatcher
95
-	 *
96
-	 * @param tx_crawler_domain_events_observer $observer_object
97
-	 * @param string $observer_method
98
-	 * @param string $event
99
-	 * @return void
100
-	 */
101
-	public function addObserver(tx_crawler_domain_events_observer $observer_object, $observer_method, $event) {
102
-		$this->observers[$event][] = array('object' => $observer_object, 'method' => $observer_method);
103
-	}
93
+    /**
94
+     * This method can be used to add an observer for an event to the dispatcher
95
+     *
96
+     * @param tx_crawler_domain_events_observer $observer_object
97
+     * @param string $observer_method
98
+     * @param string $event
99
+     * @return void
100
+     */
101
+    public function addObserver(tx_crawler_domain_events_observer $observer_object, $observer_method, $event) {
102
+        $this->observers[$event][] = array('object' => $observer_object, 'method' => $observer_method);
103
+    }
104 104
 
105
-	/**
106
-	 * Enables checking whether a certain event is observed by anyone
107
-	 *
108
-	 * @param string $event
109
-	 * @return boolean
110
-	 */
111
-	public function hasObserver($event) {
112
-		return count($this->observers[$event]) > 0;
113
-	}
105
+    /**
106
+     * Enables checking whether a certain event is observed by anyone
107
+     *
108
+     * @param string $event
109
+     * @return boolean
110
+     */
111
+    public function hasObserver($event) {
112
+        return count($this->observers[$event]) > 0;
113
+    }
114 114
 
115
-	/**
116
-	 * This method should be used to post a event to the dispatcher. Each
117
-	 * registered observer will be notified about the event.
118
-	 *
119
-	 * @param string $event
120
-	 * @param string $group
121
-	 * @param mixed $attachedData
122
-	 * @return void
123
-	 */
124
-	public function post($event, $group, $attachedData) {
125
-		if(is_array($this->observers[$event])) {
126
-			foreach($this->observers[$event] as $eventObserver) {
127
-				call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData);
128
-			}
129
-		}
130
-	}
115
+    /**
116
+     * This method should be used to post a event to the dispatcher. Each
117
+     * registered observer will be notified about the event.
118
+     *
119
+     * @param string $event
120
+     * @param string $group
121
+     * @param mixed $attachedData
122
+     * @return void
123
+     */
124
+    public function post($event, $group, $attachedData) {
125
+        if(is_array($this->observers[$event])) {
126
+            foreach($this->observers[$event] as $eventObserver) {
127
+                call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData);
128
+            }
129
+        }
130
+    }
131 131
 
132
-	/**
133
-	 * Returns the instance of the dispatcher singleton
134
-	 *
135
-	 * @param void
136
-	 * @return tx_crawler_domain_events_dispatcher
137
-	 */
138
-	public static function getInstance() {
132
+    /**
133
+     * Returns the instance of the dispatcher singleton
134
+     *
135
+     * @param void
136
+     * @return tx_crawler_domain_events_dispatcher
137
+     */
138
+    public static function getInstance() {
139 139
 
140
-		if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
141
-			$dispatcher = new tx_crawler_domain_events_dispatcher();
142
-			self::$instance = $dispatcher;
143
-		}
140
+        if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
141
+            $dispatcher = new tx_crawler_domain_events_dispatcher();
142
+            self::$instance = $dispatcher;
143
+        }
144 144
 
145
-		return self::$instance;
146
-	}
145
+        return self::$instance;
146
+    }
147 147
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
     protected function __construct() {
72 72
     	$this->observers = array();
73
-    	if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
73
+    	if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
74 74
 			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) {
75 75
 				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
76 76
 				if (method_exists($hookObj, 'registerObservers')) {
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @return void
123 123
 	 */
124 124
 	public function post($event, $group, $attachedData) {
125
-		if(is_array($this->observers[$event])) {
126
-			foreach($this->observers[$event] as $eventObserver) {
127
-				call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData);
125
+		if (is_array($this->observers[$event])) {
126
+			foreach ($this->observers[$event] as $eventObserver) {
127
+				call_user_func(array($eventObserver['object'], $eventObserver['method']), $event, $group, $attachedData);
128 128
 			}
129 129
 		}
130 130
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public static function getInstance() {
139 139
 
140
-		if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
140
+		if (!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
141 141
 			$dispatcher = new tx_crawler_domain_events_dispatcher();
142 142
 			self::$instance = $dispatcher;
143 143
 		}
Please login to merge, or discard this patch.
view/class.tx_crawler_view_pagination.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -24,121 +24,121 @@
 block discarded – undo
24 24
 
25 25
 class tx_crawler_view_pagination {
26 26
 
27
-	/**
28
-	 * @var string template path
29
-	 */
30
-	protected $template = 'EXT:crawler/template/pagination.php';
31
-
32
-	/**
33
-	 * @var int $perpage number of items perPage
34
-	 */
35
-	protected $perPage;
36
-
37
-	/**
38
-	 * @var int $currentOffset current offset
39
-	 */
40
-	protected $currentOffset;
41
-
42
-	/**
43
-	 * @var int $totalItemCount number of total item
44
-	 */
45
-	protected $totalItemCount;
46
-
47
-	/**
48
-	 * @var string $baseUrl
49
-	 */
50
-	protected $baseUrl;
51
-
52
-
53
-
54
-
55
-	/**
56
-	 * Method to render the view.
57
-	 *
58
-	 * @return string html content
59
-	 */
60
-	public function render() {
61
-		ob_start();
62
-		$this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
63
-		include($this->template);
64
-		$content = ob_get_contents();
65
-		ob_end_clean();
66
-
67
-		return $content;
68
-	}
69
-
70
-	/**
71
-	 * Returns the currently configured offset-
72
-	 * @return int
73
-	 */
74
-	public function getCurrentOffset() {
75
-		return $this->currentOffset;
76
-	}
77
-
78
-	/**
79
-	 * Method to read the number of items per page
80
-	 *
81
-	 * @return int
82
-	 */
83
-	public function getPerPage() {
84
-		return $this->perPage;
85
-	}
86
-
87
-	/**
88
-	 * Method to set the current offset from start
89
-	 *
90
-	 * @param int $currentOffset
91
-	 */
92
-	public function setCurrentOffset($currentOffset) {
93
-		$this->currentOffset = $currentOffset;
94
-	}
95
-
96
-	/**
97
-	 * Number of items per page.
98
-	 *
99
-	 * @param int $perPage
100
-	 */
101
-	public function setPerPage($perPage) {
102
-		$this->perPage = $perPage;
103
-	}
104
-
105
-	/**
106
-	 * returns the total number of items
107
-	 * @return int
108
-	 */
109
-	public function getTotalItemCount() {
110
-		return $this->totalItemCount;
111
-	}
112
-
113
-	/**
114
-	 * Method to set the total number of items in the pagination
115
-	 *
116
-	 * @param int $totalItemCount
117
-	 */
118
-	public function setTotalItemCount($totalItemCount) {
119
-		$this->totalItemCount = $totalItemCount;
120
-	}
121
-
122
-	/**
123
-	 * Returns the total number of pages needed to  display all content which
124
-	 * is paginatable
125
-	 *
126
-	 * @return double
127
-	 */
128
-	public function getTotalPagesCount() {
129
-	 	return ceil($this->getTotalItemCount() / $this->getPerPage());
130
-	}
131
-
132
-	/**
133
-	 * This method is used to caluclate the label for a pageoffset,
134
-	 * in normal cases its the internal offset + 1
135
-	 *
136
-	 * @param int $pageoffset
137
-	 * @return int
138
-	 */
139
-	protected function getLabelForPageOffset($pageoffset) {
140
-		return $pageoffset + 1;
141
-	}
27
+    /**
28
+     * @var string template path
29
+     */
30
+    protected $template = 'EXT:crawler/template/pagination.php';
31
+
32
+    /**
33
+     * @var int $perpage number of items perPage
34
+     */
35
+    protected $perPage;
36
+
37
+    /**
38
+     * @var int $currentOffset current offset
39
+     */
40
+    protected $currentOffset;
41
+
42
+    /**
43
+     * @var int $totalItemCount number of total item
44
+     */
45
+    protected $totalItemCount;
46
+
47
+    /**
48
+     * @var string $baseUrl
49
+     */
50
+    protected $baseUrl;
51
+
52
+
53
+
54
+
55
+    /**
56
+     * Method to render the view.
57
+     *
58
+     * @return string html content
59
+     */
60
+    public function render() {
61
+        ob_start();
62
+        $this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
63
+        include($this->template);
64
+        $content = ob_get_contents();
65
+        ob_end_clean();
66
+
67
+        return $content;
68
+    }
69
+
70
+    /**
71
+     * Returns the currently configured offset-
72
+     * @return int
73
+     */
74
+    public function getCurrentOffset() {
75
+        return $this->currentOffset;
76
+    }
77
+
78
+    /**
79
+     * Method to read the number of items per page
80
+     *
81
+     * @return int
82
+     */
83
+    public function getPerPage() {
84
+        return $this->perPage;
85
+    }
86
+
87
+    /**
88
+     * Method to set the current offset from start
89
+     *
90
+     * @param int $currentOffset
91
+     */
92
+    public function setCurrentOffset($currentOffset) {
93
+        $this->currentOffset = $currentOffset;
94
+    }
95
+
96
+    /**
97
+     * Number of items per page.
98
+     *
99
+     * @param int $perPage
100
+     */
101
+    public function setPerPage($perPage) {
102
+        $this->perPage = $perPage;
103
+    }
104
+
105
+    /**
106
+     * returns the total number of items
107
+     * @return int
108
+     */
109
+    public function getTotalItemCount() {
110
+        return $this->totalItemCount;
111
+    }
112
+
113
+    /**
114
+     * Method to set the total number of items in the pagination
115
+     *
116
+     * @param int $totalItemCount
117
+     */
118
+    public function setTotalItemCount($totalItemCount) {
119
+        $this->totalItemCount = $totalItemCount;
120
+    }
121
+
122
+    /**
123
+     * Returns the total number of pages needed to  display all content which
124
+     * is paginatable
125
+     *
126
+     * @return double
127
+     */
128
+    public function getTotalPagesCount() {
129
+            return ceil($this->getTotalItemCount() / $this->getPerPage());
130
+    }
131
+
132
+    /**
133
+     * This method is used to caluclate the label for a pageoffset,
134
+     * in normal cases its the internal offset + 1
135
+     *
136
+     * @param int $pageoffset
137
+     * @return int
138
+     */
139
+    protected function getLabelForPageOffset($pageoffset) {
140
+        return $pageoffset + 1;
141
+    }
142 142
 
143 143
 }
144 144
 
Please login to merge, or discard this patch.
view/process/class.tx_crawler_view_process_list.php 2 patches
Indentation   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -24,397 +24,397 @@
 block discarded – undo
24 24
 
25 25
 class tx_crawler_view_process_list {
26 26
 
27
-	/**
28
-	 * @var string template path
29
-	 */
30
-	protected $template = 'EXT:crawler/template/process/list.php';
31
-
32
-	/**
33
-	 * @var string icon path
34
-	 */
35
-	protected $iconPath;
36
-
37
-	/**
38
-	 * @var string Holds the path to start a cli process via command line
39
-	 */
40
-	protected $cliPath;
41
-
42
-	/**
43
-	 * @var int Holds the total number of items pending in the queue to be processed
44
-	 */
45
-	protected $totalItemCount;
46
-
47
-	/**
48
-	 * @var boolean Holds the enable state of the crawler
49
-	 */
50
-	protected $isCrawlerEnabled;
51
-
52
-	/**
53
-	 * @var int Holds the number of active processes
54
-	 */
55
-	protected $activeProcessCount;
56
-
57
-	/**
58
-	 * @var int Holds the number of maximum active processes
59
-	 */
60
-	protected $maxActiveProcessCount;
61
-
62
-	/**
63
-	 * @var string Holds the mode state, can be simple or detail
64
-	 */
65
-	protected $mode;
66
-
67
-	/**
68
-	 * @var int Holds the current page id
69
-	 */
70
-	protected $pageId;
71
-
72
-	/**
73
-	 * @var int $totalItemCount number of total item
74
-	 */
75
-	protected $totalUnprocessedItemCount;
76
-
77
-	/**
78
-	 * @var int Holds the number of assigned unprocessed items
79
-	 */
80
-	protected $assignedUnprocessedItemCount;
81
-
82
-	/**
83
-	 * @return int
84
-	 */
85
-	public function getAssignedUnprocessedItemCount() {
86
-		return $this->assignedUnprocessedItemCount;
87
-	}
88
-
89
-	/**
90
-	 * @return int
91
-	 */
92
-	public function getTotalUnprocessedItemCount() {
93
-		return $this->totalUnprocessedItemCount;
94
-	}
95
-
96
-	/**
97
-	 * @param int $assignedUnprocessedItemCount
98
-	 */
99
-	public function setAssignedUnprocessedItemCount($assignedUnprocessedItemCount) {
100
-		$this->assignedUnprocessedItemCount = $assignedUnprocessedItemCount;
101
-	}
102
-
103
-	/**
104
-	 * @param int $totalUnprocessedItemCount
105
-	 */
106
-	public function setTotalUnprocessedItemCount($totalUnprocessedItemCount) {
107
-		$this->totalUnprocessedItemCount = $totalUnprocessedItemCount;
108
-	}
109
-
110
-	/**
111
-	 * Set the page id
112
-	 *
113
-	 * @param int $pageId page id
114
-	 */
115
-	public function setPageId($pageId) {
116
-		$this->pageId = $pageId;
117
-	}
118
-
119
-	/**
120
-	 * Get the page id
121
-	 *
122
-	 * @return int page id
123
-	 */
124
-	public function getPageId() {
125
-		return $this->pageId;
126
-	}
127
-
128
-	/**
129
-	 * @return string
130
-	 */
131
-	public function getMode() {
132
-		return $this->mode;
133
-	}
134
-
135
-	/**
136
-	 * @param string $mode
137
-	 */
138
-	public function setMode($mode) {
139
-		$this->mode = $mode;
140
-	}
141
-
142
-
143
-	/**
144
-	 * @return int
145
-	 */
146
-	public function getMaxActiveProcessCount() {
147
-		return $this->maxActiveProcessCount;
148
-	}
149
-
150
-	/**
151
-	 * @param int $maxActiveProcessCount
152
-	 */
153
-	public function setMaxActiveProcessCount($maxActiveProcessCount) {
154
-		$this->maxActiveProcessCount = $maxActiveProcessCount;
155
-	}
156
-
157
-
158
-	/**
159
-	 * @return int
160
-	 */
161
-	public function getActiveProcessCount() {
162
-		return $this->activeProcessCount;
163
-	}
164
-
165
-	/**
166
-	 * @param int $activeProcessCount
167
-	 */
168
-	public function setActiveProcessCount($activeProcessCount) {
169
-		$this->activeProcessCount = $activeProcessCount;
170
-	}
171
-
172
-	/**
173
-	 * @return boolean
174
-	 */
175
-	public function getIsCrawlerEnabled() {
176
-		return $this->isCrawlerEnabled;
177
-	}
178
-
179
-	/**
180
-	 * @param boolean $isCrawlerEnabled
181
-	 */
182
-	public function setIsCrawlerEnabled($isCrawlerEnabled) {
183
-		$this->isCrawlerEnabled = $isCrawlerEnabled;
184
-	}
185
-
186
-
187
-	/**
188
-	 * Returns the path to start a cli process from the shell
189
-	 * @return string
190
-	 */
191
-	public function getCliPath() {
192
-		return $this->cliPath;
193
-	}
194
-
195
-	/**
196
-	 * @param string $cliPath
197
-	 */
198
-	public function setCliPath($cliPath) {
199
-		$this->cliPath = $cliPath;
200
-	}
201
-
202
-
203
-	/**
204
-	 * @return int
205
-	 */
206
-	public function getTotalItemCount() {
207
-		return $this->totalItemCount;
208
-	}
209
-
210
-	/**
211
-	 * @param int $totalItemCount
212
-	 */
213
-	public function setTotalItemCount($totalItemCount) {
214
-		$this->totalItemCount = $totalItemCount;
215
-	}
216
-
217
-	/**
218
-	 * Method to set the path to the icon from outside
219
-	 *
220
-	 * @param string $iconPath
221
-	 */
222
-	public function setIconPath($iconPath) {
223
-		$this->iconPath = $iconPath;
224
-	}
225
-
226
-	/**
227
-	 * Method to read the configured icon path
228
-	 *
229
-	 * @return string
230
-	 */
231
-	protected function getIconPath() {
232
-		return $this->iconPath;
233
-	}
234
-
235
-	/**
236
-	 * Method to set a collection of process objects to be displayed in
237
-	 * the list view.
238
-	 *
239
-	 * @param tx_crawler_domain_process_collection $processCollection
240
-	 */
241
-	public function setProcessCollection($processCollection) {
242
-		$this->processCollection = $processCollection;
243
-	}
244
-
245
-	/**
246
-	 * Returns a collection of processObjects.
247
-	 *
248
-	 * @return tx_crawler_domain_process_collection
249
-	 */
250
-	protected function getProcessCollection() {
251
-		return $this->processCollection;
252
-	}
253
-
254
-	/**
255
-	 * Formats a timestamp as date
256
-	 *
257
-	 * @param int $timestamp
258
-	 * @return string
259
-	 */
260
-	protected function asDate($timestamp) {
261
-		if ($timestamp > 0) {
262
-			return date($this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:time.detailed'), $timestamp);
263
-		} else {
264
-			return '';
265
-		}
266
-	}
267
-
268
-	/**
269
-	 * Converts seconds into minutes
270
-	 *
271
-	 * @param int $seconds
272
-	 * @return double
273
-	 */
274
-	protected function asMinutes($seconds) {
275
-		return round($seconds / 60);
276
-	}
277
-
278
-	/**
279
-	 * Returns the state icon for the current job
280
-	 *
281
-	 * @param string $state
282
-	 * @return string icon
283
-	 */
284
-	protected function getIconForState($state) {
285
-		switch($state) {
286
-			case 'running':
287
-				$icon = 'bullet_orange';
288
-				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.running');
289
-				break;
290
-			case 'completed':
291
-				$icon = 'bullet_green';
292
-				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.success');
293
-				break;
294
-			case 'cancelled':
295
-				$icon = 'bullet_red';
296
-				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.cancelled');
297
-				break;
298
-		}
299
-
300
-		return $this->getIcon($icon, $title);
301
-	}
302
-
303
-	/**
304
-	 * Returns a tag for the refresh icon
305
-	 *
306
-	 * @return string
307
-	 */
308
-	protected function getRefreshIcon() {
309
-		return $this->getIcon('arrow_refresh');
310
-	}
311
-
312
-	/**
313
-	 * Returns a tag for the refresh icon
314
-	 *
315
-	 * @return string
316
-	 */
317
-	protected function getRefreshLink() {
318
-		return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess' . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />';
319
-	}
320
-
321
-	/**
322
-	 * Returns an icon to stop all processes
323
-	 *
324
-	 * @return string html tag for stop icon
325
-	 */
326
-	protected function getStopIcon() {
327
-		return $this->getIcon('stop');
328
-	}
329
-
330
-	/**
331
-	 * Returns a link for the panel to enable or disable the crawler
332
-	 *
333
-	 * @return string
334
-	 */
335
-	protected function getEnableDisableLink() {
336
-		if ($this->getIsCrawlerEnabled()) {
337
-			return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />';
338
-		} else {
339
-			return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />';
340
-		}
341
-	}
342
-
343
-	/**
344
-	 * Get mode link
345
-	 *
346
-	 * @param void
347
-	 * @return string a-tag
348
-	 */
349
-	protected function getModeLink() {
350
-		if ($this->getMode() == 'detail') {
351
-			return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />';
352
-		} elseif ($this->getMode() == 'simple') {
353
-			return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />';
354
-		}
355
-	}
356
-
357
-	/**
358
-	 * Get add link
359
-	 *
360
-	 * @param void
361
-	 * @return string a-tag
362
-	 */
363
-	protected function getAddLink() {
364
-		if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) {
365
-			return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />';
366
-		} else {
367
-			return '';
368
-		}
369
-	}
370
-
371
-	/**
372
-	 * Returns the icon to add new crawler processes
373
-	 *
374
-	 * @return string html tag for image to add new processes
375
-	 */
376
-	protected function getAddIcon() {
377
-		return $this->getIcon('add');
378
-	}
379
-
380
-	/**
381
-	 * Returns an imagetag for an icon
382
-	 *
383
-	 * @param string $icon
384
-	 * @return string html tag for icon
385
-	 */
386
-	protected function getIcon($icon, $title='') {
387
-		if (!empty($title)) {
388
-			$title = ' title="'.$title.'"';
389
-		}
390
-		return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />';
391
-	}
392
-
393
-	/**
394
-	 * Method to render the view.
395
-	 *
396
-	 * @return string html content
397
-	 */
398
-	public function render() {
399
-		ob_start();
400
-		$this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
401
-		include($this->template);
402
-		$content = ob_get_contents();
403
-		ob_end_clean();
404
-		return $content;
405
-	}
406
-
407
-	/**
408
-	 * retrieve locallanglabel from environment
409
-	 * just a wrapper should be done in a cleaner way
410
-	 * later on
411
-	 *
412
-	 * @param string $label
413
-	 * @return string
414
-	 */
415
-	protected function getLLLabel($label) {
416
-		return $GLOBALS['LANG']->sL($label);
417
-	}
27
+    /**
28
+     * @var string template path
29
+     */
30
+    protected $template = 'EXT:crawler/template/process/list.php';
31
+
32
+    /**
33
+     * @var string icon path
34
+     */
35
+    protected $iconPath;
36
+
37
+    /**
38
+     * @var string Holds the path to start a cli process via command line
39
+     */
40
+    protected $cliPath;
41
+
42
+    /**
43
+     * @var int Holds the total number of items pending in the queue to be processed
44
+     */
45
+    protected $totalItemCount;
46
+
47
+    /**
48
+     * @var boolean Holds the enable state of the crawler
49
+     */
50
+    protected $isCrawlerEnabled;
51
+
52
+    /**
53
+     * @var int Holds the number of active processes
54
+     */
55
+    protected $activeProcessCount;
56
+
57
+    /**
58
+     * @var int Holds the number of maximum active processes
59
+     */
60
+    protected $maxActiveProcessCount;
61
+
62
+    /**
63
+     * @var string Holds the mode state, can be simple or detail
64
+     */
65
+    protected $mode;
66
+
67
+    /**
68
+     * @var int Holds the current page id
69
+     */
70
+    protected $pageId;
71
+
72
+    /**
73
+     * @var int $totalItemCount number of total item
74
+     */
75
+    protected $totalUnprocessedItemCount;
76
+
77
+    /**
78
+     * @var int Holds the number of assigned unprocessed items
79
+     */
80
+    protected $assignedUnprocessedItemCount;
81
+
82
+    /**
83
+     * @return int
84
+     */
85
+    public function getAssignedUnprocessedItemCount() {
86
+        return $this->assignedUnprocessedItemCount;
87
+    }
88
+
89
+    /**
90
+     * @return int
91
+     */
92
+    public function getTotalUnprocessedItemCount() {
93
+        return $this->totalUnprocessedItemCount;
94
+    }
95
+
96
+    /**
97
+     * @param int $assignedUnprocessedItemCount
98
+     */
99
+    public function setAssignedUnprocessedItemCount($assignedUnprocessedItemCount) {
100
+        $this->assignedUnprocessedItemCount = $assignedUnprocessedItemCount;
101
+    }
102
+
103
+    /**
104
+     * @param int $totalUnprocessedItemCount
105
+     */
106
+    public function setTotalUnprocessedItemCount($totalUnprocessedItemCount) {
107
+        $this->totalUnprocessedItemCount = $totalUnprocessedItemCount;
108
+    }
109
+
110
+    /**
111
+     * Set the page id
112
+     *
113
+     * @param int $pageId page id
114
+     */
115
+    public function setPageId($pageId) {
116
+        $this->pageId = $pageId;
117
+    }
118
+
119
+    /**
120
+     * Get the page id
121
+     *
122
+     * @return int page id
123
+     */
124
+    public function getPageId() {
125
+        return $this->pageId;
126
+    }
127
+
128
+    /**
129
+     * @return string
130
+     */
131
+    public function getMode() {
132
+        return $this->mode;
133
+    }
134
+
135
+    /**
136
+     * @param string $mode
137
+     */
138
+    public function setMode($mode) {
139
+        $this->mode = $mode;
140
+    }
141
+
142
+
143
+    /**
144
+     * @return int
145
+     */
146
+    public function getMaxActiveProcessCount() {
147
+        return $this->maxActiveProcessCount;
148
+    }
149
+
150
+    /**
151
+     * @param int $maxActiveProcessCount
152
+     */
153
+    public function setMaxActiveProcessCount($maxActiveProcessCount) {
154
+        $this->maxActiveProcessCount = $maxActiveProcessCount;
155
+    }
156
+
157
+
158
+    /**
159
+     * @return int
160
+     */
161
+    public function getActiveProcessCount() {
162
+        return $this->activeProcessCount;
163
+    }
164
+
165
+    /**
166
+     * @param int $activeProcessCount
167
+     */
168
+    public function setActiveProcessCount($activeProcessCount) {
169
+        $this->activeProcessCount = $activeProcessCount;
170
+    }
171
+
172
+    /**
173
+     * @return boolean
174
+     */
175
+    public function getIsCrawlerEnabled() {
176
+        return $this->isCrawlerEnabled;
177
+    }
178
+
179
+    /**
180
+     * @param boolean $isCrawlerEnabled
181
+     */
182
+    public function setIsCrawlerEnabled($isCrawlerEnabled) {
183
+        $this->isCrawlerEnabled = $isCrawlerEnabled;
184
+    }
185
+
186
+
187
+    /**
188
+     * Returns the path to start a cli process from the shell
189
+     * @return string
190
+     */
191
+    public function getCliPath() {
192
+        return $this->cliPath;
193
+    }
194
+
195
+    /**
196
+     * @param string $cliPath
197
+     */
198
+    public function setCliPath($cliPath) {
199
+        $this->cliPath = $cliPath;
200
+    }
201
+
202
+
203
+    /**
204
+     * @return int
205
+     */
206
+    public function getTotalItemCount() {
207
+        return $this->totalItemCount;
208
+    }
209
+
210
+    /**
211
+     * @param int $totalItemCount
212
+     */
213
+    public function setTotalItemCount($totalItemCount) {
214
+        $this->totalItemCount = $totalItemCount;
215
+    }
216
+
217
+    /**
218
+     * Method to set the path to the icon from outside
219
+     *
220
+     * @param string $iconPath
221
+     */
222
+    public function setIconPath($iconPath) {
223
+        $this->iconPath = $iconPath;
224
+    }
225
+
226
+    /**
227
+     * Method to read the configured icon path
228
+     *
229
+     * @return string
230
+     */
231
+    protected function getIconPath() {
232
+        return $this->iconPath;
233
+    }
234
+
235
+    /**
236
+     * Method to set a collection of process objects to be displayed in
237
+     * the list view.
238
+     *
239
+     * @param tx_crawler_domain_process_collection $processCollection
240
+     */
241
+    public function setProcessCollection($processCollection) {
242
+        $this->processCollection = $processCollection;
243
+    }
244
+
245
+    /**
246
+     * Returns a collection of processObjects.
247
+     *
248
+     * @return tx_crawler_domain_process_collection
249
+     */
250
+    protected function getProcessCollection() {
251
+        return $this->processCollection;
252
+    }
253
+
254
+    /**
255
+     * Formats a timestamp as date
256
+     *
257
+     * @param int $timestamp
258
+     * @return string
259
+     */
260
+    protected function asDate($timestamp) {
261
+        if ($timestamp > 0) {
262
+            return date($this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:time.detailed'), $timestamp);
263
+        } else {
264
+            return '';
265
+        }
266
+    }
267
+
268
+    /**
269
+     * Converts seconds into minutes
270
+     *
271
+     * @param int $seconds
272
+     * @return double
273
+     */
274
+    protected function asMinutes($seconds) {
275
+        return round($seconds / 60);
276
+    }
277
+
278
+    /**
279
+     * Returns the state icon for the current job
280
+     *
281
+     * @param string $state
282
+     * @return string icon
283
+     */
284
+    protected function getIconForState($state) {
285
+        switch($state) {
286
+            case 'running':
287
+                $icon = 'bullet_orange';
288
+                $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.running');
289
+                break;
290
+            case 'completed':
291
+                $icon = 'bullet_green';
292
+                $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.success');
293
+                break;
294
+            case 'cancelled':
295
+                $icon = 'bullet_red';
296
+                $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.cancelled');
297
+                break;
298
+        }
299
+
300
+        return $this->getIcon($icon, $title);
301
+    }
302
+
303
+    /**
304
+     * Returns a tag for the refresh icon
305
+     *
306
+     * @return string
307
+     */
308
+    protected function getRefreshIcon() {
309
+        return $this->getIcon('arrow_refresh');
310
+    }
311
+
312
+    /**
313
+     * Returns a tag for the refresh icon
314
+     *
315
+     * @return string
316
+     */
317
+    protected function getRefreshLink() {
318
+        return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess' . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />';
319
+    }
320
+
321
+    /**
322
+     * Returns an icon to stop all processes
323
+     *
324
+     * @return string html tag for stop icon
325
+     */
326
+    protected function getStopIcon() {
327
+        return $this->getIcon('stop');
328
+    }
329
+
330
+    /**
331
+     * Returns a link for the panel to enable or disable the crawler
332
+     *
333
+     * @return string
334
+     */
335
+    protected function getEnableDisableLink() {
336
+        if ($this->getIsCrawlerEnabled()) {
337
+            return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />';
338
+        } else {
339
+            return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />';
340
+        }
341
+    }
342
+
343
+    /**
344
+     * Get mode link
345
+     *
346
+     * @param void
347
+     * @return string a-tag
348
+     */
349
+    protected function getModeLink() {
350
+        if ($this->getMode() == 'detail') {
351
+            return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />';
352
+        } elseif ($this->getMode() == 'simple') {
353
+            return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />';
354
+        }
355
+    }
356
+
357
+    /**
358
+     * Get add link
359
+     *
360
+     * @param void
361
+     * @return string a-tag
362
+     */
363
+    protected function getAddLink() {
364
+        if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) {
365
+            return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />';
366
+        } else {
367
+            return '';
368
+        }
369
+    }
370
+
371
+    /**
372
+     * Returns the icon to add new crawler processes
373
+     *
374
+     * @return string html tag for image to add new processes
375
+     */
376
+    protected function getAddIcon() {
377
+        return $this->getIcon('add');
378
+    }
379
+
380
+    /**
381
+     * Returns an imagetag for an icon
382
+     *
383
+     * @param string $icon
384
+     * @return string html tag for icon
385
+     */
386
+    protected function getIcon($icon, $title='') {
387
+        if (!empty($title)) {
388
+            $title = ' title="'.$title.'"';
389
+        }
390
+        return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />';
391
+    }
392
+
393
+    /**
394
+     * Method to render the view.
395
+     *
396
+     * @return string html content
397
+     */
398
+    public function render() {
399
+        ob_start();
400
+        $this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
401
+        include($this->template);
402
+        $content = ob_get_contents();
403
+        ob_end_clean();
404
+        return $content;
405
+    }
406
+
407
+    /**
408
+     * retrieve locallanglabel from environment
409
+     * just a wrapper should be done in a cleaner way
410
+     * later on
411
+     *
412
+     * @param string $label
413
+     * @return string
414
+     */
415
+    protected function getLLLabel($label) {
416
+        return $GLOBALS['LANG']->sL($label);
417
+    }
418 418
 }
419 419
 
420 420
 ?>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return string icon
283 283
 	 */
284 284
 	protected function getIconForState($state) {
285
-		switch($state) {
285
+		switch ($state) {
286 286
 			case 'running':
287 287
 				$icon = 'bullet_orange';
288 288
 				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.running');
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @return string
316 316
 	 */
317 317
 	protected function getRefreshLink() {
318
-		return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess' . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />';
318
+		return '<input onclick="window.location=\''.\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info').'&SET[crawlaction]=multiprocess'.'\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_refresh.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh').'" />';
319 319
 	}
320 320
 
321 321
 	/**
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	protected function getEnableDisableLink() {
336 336
 		if ($this->getIsCrawlerEnabled()) {
337
-			return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />';
337
+			return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'control_stop_blue.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling').'" />';
338 338
 		} else {
339
-			return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />';
339
+			return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'control_play.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling').'" />';
340 340
 		}
341 341
 	}
342 342
 
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	protected function getModeLink() {
350 350
 		if ($this->getMode() == 'detail') {
351
-			return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />';
351
+			return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_in.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running').'" />';
352 352
 		} elseif ($this->getMode() == 'simple') {
353
-			return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />';
353
+			return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_out.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all').'" />';
354 354
 		}
355 355
 	}
356 356
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	protected function getAddLink() {
364 364
 		if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) {
365
-			return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />';
365
+			return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'add.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add').'" />';
366 366
 		} else {
367 367
 			return '';
368 368
 		}
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 	 * @param string $icon
384 384
 	 * @return string html tag for icon
385 385
 	 */
386
-	protected function getIcon($icon, $title='') {
386
+	protected function getIcon($icon, $title = '') {
387 387
 		if (!empty($title)) {
388 388
 			$title = ' title="'.$title.'"';
389 389
 		}
390
-		return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />';
390
+		return '<img src="'.$this->getIconPath().$icon.'.png" '.$title.' />';
391 391
 	}
392 392
 
393 393
 	/**
Please login to merge, or discard this patch.
Configuration/TCA/Overrides/tx_crawler_configuration.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
 
4 4
 // Compatibility with 6.2
5 5
 if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
6
-  $GLOBALS['TCA']['tx_crawler_configuration']['columns']['processing_instruction_filter']['config']['renderMode'] = 'checkbox';
6
+    $GLOBALS['TCA']['tx_crawler_configuration']['columns']['processing_instruction_filter']['config']['renderMode'] = 'checkbox';
7 7
 }
Please login to merge, or discard this patch.
Classes/Utility/SchedulerUtility.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,36 +42,36 @@
 block discarded – undo
42 42
     {
43 43
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerQueueTask'] = array(
44 44
             'extension'        => $extKey,
45
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.name',
46
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.description',
45
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.name',
46
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.description',
47 47
             'additionalFields' => 'AOE\\Crawler\\Task\\CrawlerQueueTaskAdditionalFieldProvider'
48 48
         );
49 49
 
50 50
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerTask'] = array(
51 51
             'extension'        => $extKey,
52
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.name',
53
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
52
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.name',
53
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
54 54
             'additionalFields' => 'AOE\\Crawler\\Task\\CrawlerTaskAdditionalFieldProvider'
55 55
         );
56 56
 
57 57
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlMultiProcessTask'] = array(
58 58
             'extension'        => $extKey,
59
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name',
60
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
59
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name',
60
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
61 61
             'additionalFields' => 'AOE\\Crawler\\Task\\CrawlMultiProcessTaskAdditionalFieldProvider'
62 62
         );
63 63
 
64 64
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\FlushQueueTask'] = array(
65 65
             'extension'        => $extKey,
66
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.name',
67
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.description',
66
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.name',
67
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.description',
68 68
             'additionalFields' => 'AOE\\Crawler\\Task\\FlushQueueTaskAdditionalFieldProvider'
69 69
         );
70 70
 
71 71
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\ProcessCleanupTask'] = array(
72 72
             'extension'        => $extKey,
73
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name',
74
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description',
73
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name',
74
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description',
75 75
         );
76 76
     }
77 77
 }
Please login to merge, or discard this patch.