@@ 1242-1267 (lines=26) @@ | ||
1239 | * |
|
1240 | * @return array |
|
1241 | */ |
|
1242 | public function created_on($row) |
|
1243 | { |
|
1244 | if (empty($row['fields'])) |
|
1245 | { |
|
1246 | return null; |
|
1247 | } |
|
1248 | ||
1249 | $row = $row['fields']; |
|
1250 | ||
1251 | // Created_on |
|
1252 | if (! array_key_exists($this->created_field, $row)) |
|
1253 | { |
|
1254 | $row[$this->created_field] = $this->set_date(); |
|
1255 | } |
|
1256 | ||
1257 | // Created by |
|
1258 | if ($this->log_user && ! array_key_exists($this->created_by_field, $row) && is_object($this->authenticate)) |
|
1259 | { |
|
1260 | // If you're here because of an error with $this->authenticate |
|
1261 | // not being available, it's likely due to you not using |
|
1262 | // the AuthTrait and/or setting log_user after model is instantiated. |
|
1263 | $row[$this->created_by_field] = (int)$this->authenticate->id(); |
|
1264 | } |
|
1265 | ||
1266 | return $row; |
|
1267 | } // end created_on() |
|
1268 | ||
1269 | //-------------------------------------------------------------------- |
|
1270 | ||
@@ 1279-1303 (lines=25) @@ | ||
1276 | * |
|
1277 | * @return array |
|
1278 | */ |
|
1279 | public function modified_on($row) |
|
1280 | { |
|
1281 | if (empty($row['fields'])) |
|
1282 | { |
|
1283 | return null; |
|
1284 | } |
|
1285 | ||
1286 | $row = $row['fields']; |
|
1287 | ||
1288 | if (is_array($row) && ! array_key_exists($this->modified_field, $row)) |
|
1289 | { |
|
1290 | $row[$this->modified_field] = $this->set_date(); |
|
1291 | } |
|
1292 | ||
1293 | // Modified by |
|
1294 | if ($this->log_user && ! array_key_exists($this->modified_by_field, $row) && is_object($this->authenticate)) |
|
1295 | { |
|
1296 | // If you're here because of an error with $this->authenticate |
|
1297 | // not being available, it's likely due to you not using |
|
1298 | // the AuthTrait and/or setting log_user after model is instantiated. |
|
1299 | $row[$this->modified_by_field] = $this->authenticate->id(); |
|
1300 | } |
|
1301 | ||
1302 | return $row; |
|
1303 | } |
|
1304 | ||
1305 | //-------------------------------------------------------------------- |
|
1306 |