1 | <?php |
||
21 | abstract class Nav |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var int Used to determine the initial column |
||
26 | */ |
||
27 | protected $columnInitial; |
||
28 | |||
29 | /** |
||
30 | * @var int Used to determine the initial row |
||
31 | */ |
||
32 | protected $rowInitial; |
||
33 | |||
34 | /** |
||
35 | * @var int Tracks the column to go to when the user resets |
||
36 | */ |
||
37 | protected $columnSetStart; |
||
38 | |||
39 | /** |
||
40 | * @var int Tracks the row to go to when the user resets |
||
41 | */ |
||
42 | protected $rowSetStart; |
||
43 | |||
44 | /** |
||
45 | * @var int Head column |
||
46 | */ |
||
47 | protected $columnCurrent; |
||
48 | |||
49 | /** |
||
50 | * @var int Head row |
||
51 | */ |
||
52 | protected $rowCurrent; |
||
53 | |||
54 | protected $status = 'initial'; |
||
55 | |||
56 | protected $columnCount = 0; |
||
57 | |||
58 | /** |
||
59 | * @param int $columnInitial Determine the starting column to use |
||
60 | * @param int $rowInitial Determine the starting row to use |
||
61 | */ |
||
62 | public function __construct($columnInitial = 2, $rowInitial = 3) |
||
68 | |||
69 | /** |
||
70 | * Move the cursor position to the starting area for the next data point or |
||
71 | * later depending on the argument passed |
||
72 | * |
||
73 | * @param integer $count |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function movePointerAlong($count = 1) |
||
87 | |||
88 | /** |
||
89 | * @return string Get the current coordinates in an excel friendly manner |
||
90 | */ |
||
91 | public function __toString() |
||
95 | |||
96 | /** |
||
97 | * Move the pointer up x (default 1) amount of places. |
||
98 | * |
||
99 | * @param int $placesToMove |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function up($placesToMove = 1) |
||
112 | |||
113 | /** |
||
114 | * Move the pointer right x (default 1) amount of places. |
||
115 | * |
||
116 | * @param int $placesToMove |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function right($placesToMove = 1) |
||
125 | |||
126 | /** |
||
127 | * Move the pointer down x (default 1) amount of places. |
||
128 | * |
||
129 | * @param int $placesToMove |
||
130 | * |
||
131 | * @return $this |
||
132 | */ |
||
133 | public function down($placesToMove = 1) |
||
139 | |||
140 | /** |
||
141 | * Move the pointer left x (default 1) amount of places. |
||
142 | * |
||
143 | * @param int $placesToMove |
||
144 | * |
||
145 | * @return $this |
||
146 | */ |
||
147 | public function left($placesToMove = 1) |
||
157 | |||
158 | /** |
||
159 | * Reset the row pointer to starting area of either spreadsheet or set |
||
160 | * |
||
161 | * @param string $type |
||
162 | * @return $this |
||
163 | */ |
||
164 | public function rowReset($type = 'initial') |
||
181 | |||
182 | /** |
||
183 | * Reset the column pointer to starting area of either spreadsheet or set |
||
184 | * |
||
185 | * @param string $type |
||
186 | * @return $this |
||
187 | */ |
||
188 | public function columnReset($type = 'initial') |
||
205 | |||
206 | /** |
||
207 | * Reset both the and column pointer to either spreadsheet or set |
||
208 | * |
||
209 | * @param string $type The human friendly syntax for what position to use |
||
210 | * @return $this |
||
211 | */ |
||
212 | public function reset($type = 'intitial') |
||
219 | |||
220 | /** |
||
221 | * Update the current entry for what is considered the starting column. |
||
222 | * |
||
223 | * @return $this |
||
224 | */ |
||
225 | public function setStartColumn() |
||
231 | |||
232 | /** |
||
233 | * Get the spreadsheet object coord from a numeric value |
||
234 | * If no parameters are used, the context coord will be returned. |
||
235 | * |
||
236 | * @param string|integer $column Either integer index or human friendly syntax |
||
237 | * @param string|integer $row Either integer index or human friendly syntax |
||
238 | * |
||
239 | * @return string|interger [description] |
||
240 | */ |
||
241 | public function coord($column = false, $row = false) |
||
255 | |||
256 | /** |
||
257 | * Parse a number in to letter format. |
||
258 | * |
||
259 | * @param int $num |
||
260 | * |
||
261 | * @return string |
||
262 | */ |
||
263 | public function nmbToClm($num) |
||
274 | |||
275 | /** |
||
276 | * A helper function for returning numerical coordinates. |
||
277 | * |
||
278 | * @param string $input |
||
279 | * @param string $axis |
||
280 | * |
||
281 | * @return integer |
||
282 | */ |
||
283 | public function parseNavReference($input = '', $axis = 'column') |
||
309 | |||
310 | /** |
||
311 | * Return the column value according to various criteria, defaulting to |
||
312 | * current. |
||
313 | * |
||
314 | * @param string $type |
||
315 | * @param bool $asLetter |
||
316 | * |
||
317 | * @return string|integer The column pointer as either index or letter |
||
318 | */ |
||
319 | public function column($type = 'current', $asLetter = false) |
||
333 | |||
334 | /** |
||
335 | * Return the row value according to various criteria, defaulting to current. |
||
336 | * |
||
337 | * @param string $type |
||
338 | * |
||
339 | * @return int The row index |
||
340 | */ |
||
341 | public function row($type = 'current') |
||
345 | } |
||
346 |