Changeset 6fd857ae18691442649d201cc1db549a7a348834
- Timestamp:
- 07/10/10 14:23:07 (23 months ago)
- Author:
- pierre-alain <pierre-alain@…>
- Parents:
- b65617dfb78dbab5bbde209f510df899295f4b8f
- Children:
- 91feee5fac0d14e679f6d7d780772e59897fb8b4
- git-committer:
- pierre-alain <pierre-alain@openwebreader.org> / 2010-07-10T14:23:07Z+0200
- Message:
-
conventions renaming
- Location:
- OWR
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5fedee
|
r6fd857
|
|
| 54 | 54 | OWR\DAO as DAO, |
| 55 | 55 | OWR\DB as DB, |
| 56 | | OWR\Logic as Logic, |
| | 56 | OWR\Model as Model, |
| 57 | 57 | OWR\Threads as Threads, |
| 58 | 58 | OWR\View\Utilities as Utilities; |
| … |
… |
|
| 236 | 236 | protected function do_checkStreamsAvailability() |
| 237 | 237 | { |
| 238 | | Logic::getCachedLogic('streams')->checkAvailability($this->_request); |
| | 238 | Model::getCachedModel('streams')->checkAvailability($this->_request); |
| 239 | 239 | $this->processResponse($this->_request->getResponse()); |
| 240 | 240 | return $this; |
| … |
… |
|
| 253 | 253 | protected function do_manageFavicons() |
| 254 | 254 | { |
| 255 | | Logic::getCachedLogic('streams')->manageFavicons($this->_request); |
| | 255 | Model::getCachedModel('streams')->manageFavicons($this->_request); |
| 256 | 256 | $this->processResponse($this->_request->getResponse()); |
| 257 | 257 | return $this; |
| … |
… |
|
| 267 | 267 | protected function do_refreshStream() |
| 268 | 268 | { |
| 269 | | Logic::getCachedLogic('streams')->refreshAll($this->_request); |
| | 269 | Model::getCachedModel('streams')->refreshAll($this->_request); |
| 270 | 270 | $this->processResponse($this->_request->getResponse()); |
| 271 | 271 | return $this; |
-
|
r5fedee
|
r6fd857
|
|
| 37 | 37 | namespace OWR; |
| 38 | 38 | use OWR\DB\Request as DBRequest, |
| 39 | | OWR\Logic\Response as LogicResponse, |
| | 39 | OWR\Model\Response as ModelResponse, |
| 40 | 40 | OWR\View\Utilities; |
| 41 | 41 | if(!defined('INC_CONFIG')) die('Please include config file'); |
| … |
… |
|
| 584 | 584 | |
| 585 | 585 | /** |
| 586 | | * Process the response of a Logic call |
| | 586 | * Process the response of a Model call |
| 587 | 587 | * |
| 588 | 588 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 589 | 589 | * @access public |
| 590 | | * @param mixed LogicResponse the response of the |
| 591 | | */ |
| 592 | | public function processResponse(LogicResponse $response) |
| | 590 | * @param mixed ModelResponse the response of the |
| | 591 | */ |
| | 592 | public function processResponse(ModelResponse $response) |
| 593 | 593 | { |
| 594 | 594 | $status = $response->getStatus(); |
| … |
… |
|
| 623 | 623 | |
| 624 | 624 | default: |
| 625 | | throw new Exception('Invalid return from Logic', Exception::E_OWR_DIE); |
| | 625 | throw new Exception('Invalid return from Model', Exception::E_OWR_DIE); |
| 626 | 626 | break; |
| 627 | 627 | } |
| … |
… |
|
| 699 | 699 | case 'new_contents': |
| 700 | 700 | $request = new Request(array('id' => $datas['id'])); |
| 701 | | Logic::getCachedLogic('news')->view($request); |
| | 701 | Model::getCachedModel('news')->view($request); |
| 702 | 702 | $response = $request->getResponse(); |
| 703 | 703 | if('error' !== $response->getNext()) |
| … |
… |
|
| 727 | 727 | $datas['details'] = array(); |
| 728 | 728 | $request = new Request(array('id' => $datas['id'])); |
| 729 | | Logic::getCachedLogic('news')->view($request); |
| | 729 | Model::getCachedModel('news')->view($request); |
| 730 | 730 | $response = $request->getResponse(); |
| 731 | 731 | if('error' !== $response->getNext()) |
| … |
… |
|
| 783 | 783 | $streams = array($streams); |
| 784 | 784 | $request = new Request(array('id'=>null)); |
| 785 | | Logic::getCachedLogic('streams_groups')->view($request, array(), 'name'); |
| | 785 | Model::getCachedModel('streams_groups')->view($request, array(), 'name'); |
| 786 | 786 | $response = $request->getResponse(); |
| 787 | 787 | $groups = array(); |
| … |
… |
|
| 803 | 803 | { |
| 804 | 804 | $request->id = $s->rssid; |
| 805 | | Logic::getCachedLogic('streams')->view($request); |
| | 805 | Model::getCachedModel('streams')->view($request); |
| 806 | 806 | $response = $request->getResponse(); |
| 807 | 807 | if('error' !== $response->getNext()) |
| … |
… |
|
| 856 | 856 | case 'news_tags_contents': |
| 857 | 857 | $request = new Request(array(), true); |
| 858 | | Logic::getCachedLogic('news_tags')->view($request, array('newsid' => $datas['id'])); |
| | 858 | Model::getCachedModel('news_tags')->view($request, array('newsid' => $datas['id'])); |
| 859 | 859 | $response = $request->getResponse(); |
| 860 | 860 | if('error' !== $response->getNext()) |
| … |
… |
|
| 886 | 886 | case 'menu_part_stream': |
| 887 | 887 | $request = new Request(array('id' => $datas['id'])); |
| 888 | | Logic::getCachedLogic('streams')->view($request); |
| | 888 | Model::getCachedModel('streams')->view($request); |
| 889 | 889 | $response = $request->getResponse(); |
| 890 | 890 | if('error' !== $response->getNext()) |
| … |
… |
|
| 950 | 950 | } |
| 951 | 951 | $request = new Request(array('ids' => $datas['id'], 'getContents' => $datas['abstract'])); |
| 952 | | Logic::getCachedLogic('news')->view($request, array(), $order, 'news.id', $offset); |
| | 952 | Model::getCachedModel('news')->view($request, array(), $order, 'news.id', $offset); |
| 953 | 953 | $datas['nbNews'] = count($datas['id']); |
| 954 | 954 | } |
| … |
… |
|
| 956 | 956 | { |
| 957 | 957 | $request = new Request(array('id' => null, 'getContents' => $datas['abstract'])); |
| 958 | | Logic::getCachedLogic('news')->view($request, array('status' => 1), $order, 'news.id', $offset); |
| | 958 | Model::getCachedModel('news')->view($request, array('status' => 1), $order, 'news.id', $offset); |
| 959 | 959 | $datas['nbNews'] = isset($this->_request->unreads[0]) ? $this->_request->unreads[0] : 0; |
| 960 | 960 | } |
| … |
… |
|
| 962 | 962 | { // all news |
| 963 | 963 | $request = new Request(array('id' => null, 'getContents' => $datas['abstract'])); |
| 964 | | Logic::getCachedLogic('news')->view($request, array(), $order, 'news.id', $offset); |
| | 964 | Model::getCachedModel('news')->view($request, array(), $order, 'news.id', $offset); |
| 965 | 965 | $nb = DAO::getCachedDAO('news_relations')->count(array(), 'newsid'); |
| 966 | 966 | $datas['nbNews'] = $nb ? $nb->nb : 0; |
| … |
… |
|
| 989 | 989 | if('streams' === $table) |
| 990 | 990 | { |
| 991 | | Logic::getCachedLogic('news')->view($request, array('rssid' => $datas['id']), $order, 'news.id', $offset); |
| | 991 | Model::getCachedModel('news')->view($request, array('rssid' => $datas['id']), $order, 'news.id', $offset); |
| 992 | 992 | $nb = DAO::getCachedDAO('news_relations')->count(array('rssid' => $datas['id']), 'newsid'); |
| 993 | 993 | $datas['nbNews'] = $nb ? $nb->nb : 0; |
| … |
… |
|
| 995 | 995 | elseif('streams_groups' === $table) |
| 996 | 996 | { |
| 997 | | Logic::getCachedLogic('news')->view($request, array('gid' => $datas['id']), $order, 'news.id', $offset); |
| | 997 | Model::getCachedModel('news')->view($request, array('gid' => $datas['id']), $order, 'news.id', $offset); |
| 998 | 998 | $nb = DAO::getCachedDAO('news_relations')->count(array('gid' => $datas['id']), 'newsid'); |
| 999 | 999 | $datas['nbNews'] = $nb ? $nb->nb : 0; |
| … |
… |
|
| 1001 | 1001 | elseif('news_tags' === $table) |
| 1002 | 1002 | { |
| 1003 | | Logic::getCachedLogic('news')->view($request, array('tid' => $datas['id']), $order, 'news.id', $offset); |
| | 1003 | Model::getCachedModel('news')->view($request, array('tid' => $datas['id']), $order, 'news.id', $offset); |
| 1004 | 1004 | $nb = DAO::getCachedDAO('news_relations_tags')->count(array('tid' => $datas['id']), 'newsid'); |
| 1005 | 1005 | $datas['nbNews'] = $nb ? $nb->nb : 0; |
| … |
… |
|
| 1084 | 1084 | |
| 1085 | 1085 | $request = new Request(array('id'=>null)); |
| 1086 | | Logic::getCachedLogic('streams_groups')->view($request, array(), 'name'); |
| | 1086 | Model::getCachedModel('streams_groups')->view($request, array(), 'name'); |
| 1087 | 1087 | $response = $request->getResponse(); |
| 1088 | 1088 | $groups = array(); |
| … |
… |
|
| 1165 | 1165 | case 'menu_tags_contents': |
| 1166 | 1166 | $request = new Request(array('id' => isset($datas['id']) ? $datas['id'] : null, 'ids' => isset($datas['ids']) ? $datas['ids'] : null)); |
| 1167 | | Logic::getCachedLogic('news_tags')->view($request, array(), 'name'); |
| | 1167 | Model::getCachedModel('news_tags')->view($request, array(), 'name'); |
| 1168 | 1168 | $response = $request->getResponse(); |
| 1169 | 1169 | if('error' !== $response->getNext()) |
| … |
… |
|
| 1212 | 1212 | $datas['streams'] = array(); |
| 1213 | 1213 | $request = new Request(array('id'=>null)); |
| 1214 | | Logic::getCachedLogic('streams')->view($request); |
| | 1214 | Model::getCachedModel('streams')->view($request); |
| 1215 | 1215 | $response = $request->getResponse(); |
| 1216 | 1216 | if('error' !== $response->getNext()) |
| … |
… |
|
| 1256 | 1256 | $datas['timezones'] = $this->_user->getTimeZones(); |
| 1257 | 1257 | $datas['userrights'] = $this->_user->getRights(); |
| 1258 | | Logic::getCachedLogic('users')->view($request); |
| | 1258 | Model::getCachedModel('users')->view($request); |
| 1259 | 1259 | $response = $request->getResponse(); |
| 1260 | 1260 | if('error' !== $response->getNext()) |
| … |
… |
|
| 1276 | 1276 | $datas['users'] = array(); |
| 1277 | 1277 | $datas['nbusers'] = 0; |
| 1278 | | Logic::getCachedLogic('users')->view($request, array(), 'login'); |
| | 1278 | Model::getCachedModel('users')->view($request, array(), 'login'); |
| 1279 | 1279 | $response = $request->getResponse(); |
| 1280 | 1280 | if('error' !== $response->getNext()) |
| … |
… |
|
| 1307 | 1307 | $args['rssid'] = $datas['id']; |
| 1308 | 1308 | $datas['news'] = $ids = array(); |
| 1309 | | Logic::getCachedLogic('news')->view($request, $args); |
| | 1309 | Model::getCachedModel('news')->view($request, $args); |
| 1310 | 1310 | $response = $request->getResponse(); |
| 1311 | 1311 | if('error' !== $response->getNext()) |
| … |
… |
|
| 1421 | 1421 | |
| 1422 | 1422 | /** |
| 1423 | | * Now functions that do not require a logic call |
| | 1423 | * Now functions that do not require a model call |
| 1424 | 1424 | */ |
| 1425 | 1425 | |
| … |
… |
|
| 2066 | 2066 | |
| 2067 | 2067 | /** |
| 2068 | | * Requires a call to a logic from here |
| | 2068 | * Requires a call to a model from here |
| 2069 | 2069 | */ |
| 2070 | 2070 | |
| … |
… |
|
| 2078 | 2078 | protected function do_changeLang() |
| 2079 | 2079 | { |
| 2080 | | Logic::getCachedLogic('users')->changeLang($this->_request); |
| | 2080 | Model::getCachedModel('users')->changeLang($this->_request); |
| 2081 | 2081 | $this->processResponse($this->_request->getResponse()); |
| 2082 | 2082 | return $this; |
| … |
… |
|
| 2092 | 2092 | protected function do_stats() |
| 2093 | 2093 | { |
| 2094 | | Logic::getCachedLogic('users')->stat($this->_request); |
| | 2094 | Model::getCachedModel('users')->stat($this->_request); |
| 2095 | 2095 | $this->processResponse($this->_request->getResponse()); |
| 2096 | 2096 | return $this; |
| … |
… |
|
| 2273 | 2273 | protected function do_move() |
| 2274 | 2274 | { |
| 2275 | | Logic::getCachedLogic('streams')->move($this->_request); |
| | 2275 | Model::getCachedModel('streams')->move($this->_request); |
| 2276 | 2276 | $this->processResponse($this->_request->getResponse()); |
| 2277 | 2277 | return $this; |
| … |
… |
|
| 2290 | 2290 | if(!$this->_request->id) |
| 2291 | 2291 | { |
| 2292 | | Logic::getCachedLogic('users')->deleteRelated($this->_request); |
| | 2292 | Model::getCachedModel('users')->deleteRelated($this->_request); |
| 2293 | 2293 | if(!$this->processResponse($this->_request->getResponse())) return $this; |
| 2294 | 2294 | } |
| … |
… |
|
| 2300 | 2300 | { |
| 2301 | 2301 | case 'users': |
| 2302 | | Logic::getCachedLogic('users')->delete($this->_request); |
| | 2302 | Model::getCachedModel('users')->delete($this->_request); |
| 2303 | 2303 | if(!$this->processResponse($this->_request->getResponse())) return $this; |
| 2304 | 2304 | $escape = true; |
| … |
… |
|
| 2309 | 2309 | case 'streams_groups': |
| 2310 | 2310 | case 'news_tags': |
| 2311 | | Logic::getCachedLogic($type)->delete($this->_request); |
| | 2311 | Model::getCachedModel($type)->delete($this->_request); |
| 2312 | 2312 | if(!$this->processResponse($this->_request->getResponse())) return $this; |
| 2313 | 2313 | break; |
| … |
… |
|
| 2358 | 2358 | $this->_request->escape = isset($url); |
| 2359 | 2359 | |
| 2360 | | Logic::getCachedLogic('streams')->edit($this->_request); |
| | 2360 | Model::getCachedModel('streams')->edit($this->_request); |
| 2361 | 2361 | $this->processResponse($this->_request->getResponse()); |
| 2362 | 2362 | |
| … |
… |
|
| 2378 | 2378 | $this->_request->escape = isset($name); |
| 2379 | 2379 | |
| 2380 | | Logic::getCachedLogic('streams_groups')->edit($this->_request); |
| | 2380 | Model::getCachedModel('streams_groups')->edit($this->_request); |
| 2381 | 2381 | if(!$this->processResponse($this->_request->getResponse())) return $this; |
| 2382 | 2382 | |
| … |
… |
|
| 2409 | 2409 | $this->_request->escape = isset($url); |
| 2410 | 2410 | |
| 2411 | | Logic::getCachedLogic('streams')->editOPML($this->_request); |
| | 2411 | Model::getCachedModel('streams')->editOPML($this->_request); |
| 2412 | 2412 | if(!$this->processResponse($this->_request->getResponse())) return $this; |
| 2413 | 2413 | |
| … |
… |
|
| 2498 | 2498 | protected function do_refreshStream() |
| 2499 | 2499 | { |
| 2500 | | Logic::getCachedLogic('streams')->refresh($this->_request); |
| | 2500 | Model::getCachedModel('streams')->refresh($this->_request); |
| 2501 | 2501 | $this->processResponse($this->_request->getResponse()); |
| 2502 | 2502 | |
| … |
… |
|
| 2513 | 2513 | protected function do_upNew() |
| 2514 | 2514 | { |
| 2515 | | Logic::getCachedLogic('news')->update($this->_request); |
| | 2515 | Model::getCachedModel('news')->update($this->_request); |
| 2516 | 2516 | $this->processResponse($this->_request->getResponse()); |
| 2517 | 2517 | |
| … |
… |
|
| 2528 | 2528 | protected function do_clearStream() |
| 2529 | 2529 | { |
| 2530 | | Logic::getCachedLogic('streams')->clear($this->_request); |
| | 2530 | Model::getCachedModel('streams')->clear($this->_request); |
| 2531 | 2531 | $this->processResponse($this->_request->getResponse()); |
| 2532 | 2532 | |
| … |
… |
|
| 2545 | 2545 | protected function do_editUser() |
| 2546 | 2546 | { |
| 2547 | | Logic::getCachedLogic('users')->edit($this->_request); |
| | 2547 | Model::getCachedModel('users')->edit($this->_request); |
| 2548 | 2548 | $this->processResponse($this->_request->getResponse()); |
| 2549 | 2549 | |
| … |
… |
|
| 2560 | 2560 | protected function do_editTag() |
| 2561 | 2561 | { |
| 2562 | | Logic::getCachedLogic('news_tags')->edit($this->_request); |
| | 2562 | Model::getCachedModel('news_tags')->edit($this->_request); |
| 2563 | 2563 | $this->processResponse($this->_request->getResponse()); |
| 2564 | 2564 | |
| … |
… |
|
| 2575 | 2575 | protected function do_editTagsRelations() |
| 2576 | 2576 | { |
| 2577 | | Logic::getCachedLogic('news_tags')->editRelations($this->_request); |
| | 2577 | Model::getCachedModel('news_tags')->editRelations($this->_request); |
| 2578 | 2578 | $this->processResponse($this->_request->getResponse()); |
| 2579 | 2579 | |
| … |
… |
|
| 2592 | 2592 | if(!$this->_request->id) |
| 2593 | 2593 | { |
| 2594 | | $this->processResponse(new LogicResponse(array( |
| | 2594 | $this->processResponse(new ModelResponse(array( |
| 2595 | 2595 | 'do' => 'error', |
| 2596 | 2596 | 'error' => 'Invalid id', |
| … |
… |
|
| 2607 | 2607 | case 'streams_groups': |
| 2608 | 2608 | case 'news_tags': |
| 2609 | | Logic::getCachedLogic($type)->rename($this->_request); |
| | 2609 | Model::getCachedModel($type)->rename($this->_request); |
| 2610 | 2610 | if(!$this->processResponse($this->_request->getResponse())) return $this; |
| 2611 | 2611 | break; |
| 2612 | 2612 | |
| 2613 | 2613 | default: |
| 2614 | | $this->processResponse(new LogicResponse(array( |
| | 2614 | $this->processResponse(new ModelResponse(array( |
| 2615 | 2615 | 'do' => 'error', |
| 2616 | 2616 | 'error' => 'Invalid id', |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Interface for all logics |
| | 3 | * Interface for all models |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 42 | 42 | * @subpackage Interfaces |
| 43 | 43 | */ |
| 44 | | interface Logic |
| | 44 | interface Model |
| 45 | 45 | { |
| 46 | 46 | /** |
| 47 | | * Returns the specified Logic object |
| | 47 | * Returns the specified Model object |
| 48 | 48 | * |
| 49 | 49 | * @access public |
| 50 | 50 | * @static |
| 51 | 51 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 52 | | * @param string $logic the name of the Logic |
| 53 | | * @return mixed the Logic object |
| | 52 | * @param string $model the name of the Model |
| | 53 | * @return mixed the Model object |
| 54 | 54 | */ |
| 55 | | static public function getLogic($logic); |
| | 55 | static public function getModel($model); |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | | * Returns the specified Logic object from cache |
| | 58 | * Returns the specified Model object from cache |
| 59 | 59 | * |
| 60 | 60 | * @access public |
| 61 | 61 | * @static |
| 62 | 62 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 63 | | * @param string $logic the name of the Logic |
| 64 | | * @return mixed the Logic object |
| | 63 | * @param string $model the name of the Model |
| | 64 | * @return mixed the Model object |
| 65 | 65 | */ |
| 66 | | static public function getCachedLogic($logic); |
| | 66 | static public function getCachedModel($model); |
| 67 | 67 | |
| 68 | 68 | /** |
-
|
r22257f
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Interface for all ResponseLogic |
| | 3 | * Interface for all ResponseModel |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 35 | 35 | * @subpackage Interfaces |
| 36 | 36 | */ |
| 37 | | namespace OWR\Interfaces\Logic; |
| | 37 | namespace OWR\Interfaces\Model; |
| 38 | 38 | /** |
| 39 | 39 | * This class is used to declare public functions |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic Object base class |
| | 3 | * Model Object base class |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 35 | 35 | */ |
| 36 | 36 | namespace OWR; |
| 37 | | use OWR\Interfaces\Logic as iLogic, |
| | 37 | use OWR\Interfaces\Model as iModel, |
| 38 | 38 | OWR\User; |
| 39 | 39 | /** |
| … |
… |
|
| 42 | 42 | * |
| 43 | 43 | * @abstract |
| 44 | | * @uses OWR\Interfaces\Logic implements the Logic interface |
| | 44 | * @uses OWR\Interfaces\Model implements the Model interface |
| 45 | 45 | * @uses OWR\DB the database link |
| 46 | 46 | * @uses OWR\Request a request sent to the database |
| … |
… |
|
| 50 | 50 | * @package OWR |
| 51 | 51 | */ |
| 52 | | abstract class Logic implements iLogic |
| | 52 | abstract class Model implements iModel |
| 53 | 53 | { |
| 54 | 54 | /** |
| … |
… |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | | * @var array stored already processed logic names |
| | 79 | * @var array stored already processed model names |
| 80 | 80 | * @access private |
| 81 | 81 | * @static |
| 82 | 82 | */ |
| 83 | | static private $_logics = array(); |
| | 83 | static private $_models = array(); |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | | * @var array stored already processed logics objects |
| | 86 | * @var array stored already processed models objects |
| 87 | 87 | * @access private |
| 88 | 88 | * @static |
| 89 | 89 | */ |
| 90 | | static private $_cachedLogics = array(); |
| | 90 | static private $_cachedModels = array(); |
| 91 | 91 | |
| 92 | 92 | /** |
| … |
… |
|
| 100 | 100 | $this->_db = DB::iGet(); // we assume here that the connexion has already been done, be carefull |
| 101 | 101 | $this->_fullName = get_called_class(); |
| 102 | | $this->_name = str_replace('\\', '_', substr($this->_fullName, strlen(__NAMESPACE__.'_Logic_'))); |
| | 102 | $this->_name = str_replace('\\', '_', substr($this->_fullName, strlen(__NAMESPACE__.'_Model_'))); |
| 103 | 103 | $this->_dao = DAO::getDAO($this->_name); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | | * Returns the specified Logic object |
| | 107 | * Returns the specified Model object |
| 108 | 108 | * |
| 109 | 109 | * @access public |
| 110 | 110 | * @static |
| 111 | 111 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 112 | | * @param string $logic the name of the Logic |
| 113 | | * @return mixed the Logic object |
| | 112 | * @param string $model the name of the Model |
| | 113 | * @return mixed the Model object |
| 114 | 114 | */ |
| 115 | | static public function getLogic($logic) |
| | 115 | static public function getModel($model) |
| 116 | 116 | { |
| 117 | | if(!isset(self::$_logics[$logic])) |
| | 117 | if(!isset(self::$_models[$model])) |
| 118 | 118 | { |
| 119 | | $c = __NAMESPACE__.'\Logic\\'.join('\\', array_map('ucfirst', explode('_', (string) $logic)));; |
| 120 | | self::$_logics[$logic] = $c; |
| | 119 | $c = __NAMESPACE__.'\Model\\'.join('\\', array_map('ucfirst', explode('_', (string) $model)));; |
| | 120 | self::$_models[$model] = $c; |
| 121 | 121 | } |
| 122 | | return new self::$_logics[$logic]; |
| | 122 | return new self::$_models[$model]; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | | * Returns the specified Logic object from cache |
| | 126 | * Returns the specified Model object from cache |
| 127 | 127 | * |
| 128 | 128 | * @access public |
| 129 | 129 | * @static |
| 130 | 130 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 131 | | * @param string $logic the name of the Logic |
| 132 | | * @return mixed the Logic object |
| | 131 | * @param string $model the name of the Model |
| | 132 | * @return mixed the Model object |
| 133 | 133 | */ |
| 134 | | static public function getCachedLogic($logic) |
| | 134 | static public function getCachedModel($model) |
| 135 | 135 | { |
| 136 | | $logic = ucfirst((string) $logic); |
| 137 | | isset(self::$_cachedLogics[$logic]) || (self::$_cachedLogics[$logic] = self::getLogic($logic)); |
| | 136 | $model = ucfirst((string) $model); |
| | 137 | isset(self::$_cachedModels[$model]) || (self::$_cachedModels[$model] = self::getModel($model)); |
| 138 | 138 | |
| 139 | | return self::$_cachedLogics[$logic]; |
| | 139 | return self::$_cachedModels[$model]; |
| 140 | 140 | } |
| 141 | 141 | } |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic for 'news' object |
| | 3 | * Model for 'news' object |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 33 | 33 | * @license http://www.gnu.org/copyleft/gpl.html |
| 34 | 34 | * @package OWR |
| 35 | | * @subpackage Logic |
| | 35 | * @subpackage Model |
| 36 | 36 | */ |
| 37 | | namespace OWR\Logic; |
| 38 | | use OWR\Logic, |
| | 37 | namespace OWR\Model; |
| | 38 | use OWR\Model, |
| 39 | 39 | OWR\Request, |
| 40 | 40 | OWR\Exception, |
| … |
… |
|
| 46 | 46 | * This class is used to add/edit/delete news |
| 47 | 47 | * @package OWR |
| 48 | | * @subpackage Logic |
| 49 | | * @uses OWR\Logic extends the base class |
| | 48 | * @subpackage Model |
| | 49 | * @uses OWR\Model extends the base class |
| 50 | 50 | * @uses OWR\Request the request |
| 51 | 51 | * @uses OWR\Exception the exception handler |
| 52 | 52 | * @uses OWR\DAO the DAO |
| 53 | 53 | * @uses OWR\Logs the log object |
| 54 | | * @subpackage Logic |
| | 54 | * @subpackage Model |
| 55 | 55 | */ |
| 56 | | class News extends Logic |
| | 56 | class News extends Model |
| 57 | 57 | { |
| 58 | 58 | /** |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic for 'news_tags' object |
| | 3 | * Model for 'news_tags' object |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 33 | 33 | * @license http://www.gnu.org/copyleft/gpl.html |
| 34 | 34 | * @package OWR |
| 35 | | * @subpackage Logic |
| | 35 | * @subpackage Model |
| 36 | 36 | */ |
| 37 | | namespace OWR\Logic\News; |
| 38 | | use OWR\Logic, |
| | 37 | namespace OWR\Model\News; |
| | 38 | use OWR\Model, |
| 39 | 39 | OWR\Request, |
| 40 | 40 | OWR\Exception, |
| 41 | 41 | OWR\DAO, |
| 42 | | OWR\Logic\Response, |
| | 42 | OWR\Model\Response, |
| 43 | 43 | OWR\Config; |
| 44 | 44 | /** |
| 45 | 45 | * This class is used to add/edit/delete tags |
| 46 | 46 | * @package OWR |
| 47 | | * @subpackage Logic |
| 48 | | * @uses OWR\Logic extends the base class |
| | 47 | * @subpackage Model |
| | 48 | * @uses OWR\Model extends the base class |
| 49 | 49 | * @uses OWR\Request the request |
| 50 | 50 | * @uses OWR\Exception the exception handler |
| 51 | 51 | * @uses OWR\DAO the DAO |
| 52 | | * @subpackage Logic |
| | 52 | * @subpackage Model |
| 53 | 53 | */ |
| 54 | | class Tags extends Logic |
| | 54 | class Tags extends Model |
| 55 | 55 | { |
| 56 | 56 | /** |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic for 'objects' object |
| | 3 | * Model for 'objects' object |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 33 | 33 | * @license http://www.gnu.org/copyleft/gpl.html |
| 34 | 34 | * @package OWR |
| 35 | | * @subpackage Logic |
| | 35 | * @subpackage Model |
| 36 | 36 | */ |
| 37 | | namespace OWR\Logic; |
| 38 | | use OWR\Logic, |
| | 37 | namespace OWR\Model; |
| | 38 | use OWR\Model, |
| 39 | 39 | OWR\Request, |
| 40 | 40 | OWR\Exception, |
| … |
… |
|
| 43 | 43 | * This class is used to add/delete objects |
| 44 | 44 | * @package OWR |
| 45 | | * @subpackage Logic |
| 46 | | * @uses OWR\Logic extends the base class |
| | 45 | * @subpackage Model |
| | 46 | * @uses OWR\Model extends the base class |
| 47 | 47 | * @uses OWR\Request the request |
| 48 | 48 | * @uses OWR\Exception the exception handler |
| 49 | 49 | * @uses OWR\DAO the DAO |
| 50 | | * @uses OWR\Request a request sent to the logic |
| 51 | | * @subpackage Logic |
| | 50 | * @uses OWR\Request a request sent to the model |
| | 51 | * @subpackage Model |
| 52 | 52 | */ |
| 53 | | class Objects extends Logic |
| | 53 | class Objects extends Model |
| 54 | 54 | { |
| 55 | 55 | /** |
| … |
… |
|
| 156 | 156 | { |
| 157 | 157 | $r->id = $type['id']; |
| 158 | | parent::getCachedLogic($type['type'])->view($r, $args, $order, $groupby, 1); |
| | 158 | parent::getCachedModel($type['type'])->view($r, $args, $order, $groupby, 1); |
| 159 | 159 | $response = $r->getResponse(); |
| 160 | 160 | if('error' !== $response->getNext()) |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Class representing a response from every call to a Logic |
| 4 | | * If we a logic returns this object, it means that no blocking errors have been encountered |
| 5 | | * Else the Logic will throw an Exception |
| | 3 | * Class representing a response from every call to a Model |
| | 4 | * If we a model returns this object, it means that no blocking errors have been encountered |
| | 5 | * Else the Model will throw an Exception |
| 6 | 6 | * |
| 7 | 7 | * PHP 5 |
| … |
… |
|
| 35 | 35 | * @license http://www.gnu.org/copyleft/gpl.html |
| 36 | 36 | * @package OWR |
| 37 | | * @subpackage Logic |
| | 37 | * @subpackage Model |
| 38 | 38 | */ |
| 39 | | namespace OWR\Logic; |
| 40 | | use OWR\Interfaces\Logic\Response as iResponse, |
| | 39 | namespace OWR\Model; |
| | 40 | use OWR\Interfaces\Model\Response as iResponse, |
| 41 | 41 | OWR\Exception, |
| 42 | 42 | OWR\View\Utilities as ViewUtilities; |
| 43 | 43 | /** |
| 44 | | * This class is an object response of every logic call |
| | 44 | * This class is an object response of every model call |
| 45 | 45 | * @package OWR |
| 46 | | * @subpackage Logic |
| | 46 | * @subpackage Model |
| 47 | 47 | */ |
| 48 | 48 | class Response implements iResponse |
| … |
… |
|
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | | * @var boolean true if the logic returns datas and if it contains more than one row |
| | 96 | * @var boolean true if the model returns datas and if it contains more than one row |
| 97 | 97 | * @access protected |
| 98 | 98 | */ |
| … |
… |
|
| 136 | 136 | |
| 137 | 137 | default: |
| 138 | | throw new Exception('Invalid return from Logic', Exception::E_OWR_DIE); |
| | 138 | throw new Exception('Invalid return from Model', Exception::E_OWR_DIE); |
| 139 | 139 | break; |
| 140 | 140 | } |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic for 'streams' object |
| | 3 | * Model for 'streams' object |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 33 | 33 | * @license http://www.gnu.org/copyleft/gpl.html |
| 34 | 34 | * @package OWR |
| 35 | | * @subpackage Logic |
| | 35 | * @subpackage Model |
| 36 | 36 | */ |
| 37 | | namespace OWR\Logic; |
| 38 | | use OWR\Logic, |
| | 37 | namespace OWR\Model; |
| | 38 | use OWR\Model, |
| 39 | 39 | OWR\Request, |
| 40 | 40 | OWR\Exception, |
| … |
… |
|
| 53 | 53 | * This class is used to add/edit/delete stream and his related tables |
| 54 | 54 | * @package OWR |
| 55 | | * @subpackage Logic |
| 56 | | * @uses OWR\Logic extends the base class |
| | 55 | * @subpackage Model |
| | 56 | * @uses OWR\Model extends the base class |
| 57 | 57 | * @uses OWR\Request the request |
| 58 | 58 | * @uses OWR\Exception the exception handler |
| … |
… |
|
| 62 | 62 | * @uses OWR\Logs the logs object |
| 63 | 63 | * @uses OWR\Cron add/modify crontab |
| 64 | | * @subpackage Logic |
| | 64 | * @subpackage Model |
| 65 | 65 | */ |
| 66 | | class Streams extends Logic |
| | 66 | class Streams extends Model |
| 67 | 67 | { |
| 68 | 68 | /** |
| … |
… |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | | parent::getCachedLogic('streams_groups')->checkGroupById($request); // fill gid and gname |
| | 87 | parent::getCachedModel('streams_groups')->checkGroupById($request); // fill gid and gname |
| 88 | 88 | |
| 89 | 89 | $request->url = html_entity_decode($request->url, ENT_COMPAT, 'UTF-8'); |
| … |
… |
|
| 150 | 150 | if(is_array($news)) |
| 151 | 151 | { |
| 152 | | $logic = parent::getCachedLogic('news'); |
| | 152 | $model = parent::getCachedModel('news'); |
| 153 | 153 | |
| 154 | 154 | foreach($news as $new) |
| 155 | 155 | { |
| 156 | 156 | $r->id = $new->id; |
| 157 | | $logic->insertNewsRelations($r); |
| | 157 | $model->insertNewsRelations($r); |
| 158 | 158 | $response = $r->getResponse(); |
| 159 | 159 | if('error' === $response->getNext()) |
| … |
… |
|
| 165 | 165 | { |
| 166 | 166 | $r->id = $news->id; |
| 167 | | parent::getCachedLogic('news')->insertNewsRelations($r); |
| | 167 | parent::getCachedModel('news')->insertNewsRelations($r); |
| 168 | 168 | $response = $r->getResponse(); |
| 169 | 169 | if('error' === $response->getNext()) |
| … |
… |
|
| 408 | 408 | if(empty($request->escapeNews)) |
| 409 | 409 | { // save the news |
| 410 | | $logic = parent::getCachedLogic('news'); |
| | 410 | $model = parent::getCachedModel('news'); |
| 411 | 411 | $r = clone($request); |
| 412 | 412 | $r->streamid = $request->id; |
| … |
… |
|
| 416 | 416 | try |
| 417 | 417 | { |
| 418 | | $logic->edit($r); |
| | 418 | $model->edit($r); |
| 419 | 419 | $response = $r->getResponse(); |
| 420 | 420 | if('error' === $response->getNext()) |
| … |
… |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | | parent::getCachedLogic('streams_groups')->checkGroupById($request); |
| | 620 | parent::getCachedModel('streams_groups')->checkGroupById($request); |
| 621 | 621 | |
| 622 | 622 | $stream->gid = $request->gid; |
| … |
… |
|
| 732 | 732 | |
| 733 | 733 | $r = clone($request); |
| 734 | | $logic = parent::getCachedLogic('news'); |
| | 734 | $model = parent::getCachedModel('news'); |
| 735 | 735 | $ids = array(); |
| 736 | 736 | while($r->item = $stream->get('item')) |
| … |
… |
|
| 739 | 739 | { |
| 740 | 740 | $r->streamid = $request->id; |
| 741 | | $logic->edit($r); |
| | 741 | $model->edit($r); |
| 742 | 742 | $ids[] = $r->id; |
| 743 | 743 | $response = $r->getResponse(); |
| … |
… |
|
| 1423 | 1423 | User::iGet()->checkToken(); |
| 1424 | 1424 | |
| 1425 | | parent::getCachedLogic('streams_groups')->checkGroupById($request); |
| | 1425 | parent::getCachedModel('streams_groups')->checkGroupById($request); |
| 1426 | 1426 | $erase = false; |
| 1427 | 1427 | |
| … |
… |
|
| 1477 | 1477 | $r = clone($request); |
| 1478 | 1478 | $r->gid = 0; |
| 1479 | | parent::getCachedLogic('streams_groups')->checkGroupById($r); |
| | 1479 | parent::getCachedModel('streams_groups')->checkGroupById($r); |
| 1480 | 1480 | $gidRoot = $r->gid; |
| 1481 | 1481 | unset($r); |
| … |
… |
|
| 1485 | 1485 | $ids = array(); |
| 1486 | 1486 | |
| 1487 | | $streamsGroupsLogic = parent::getCachedLogic('streams_groups'); |
| | 1487 | $streamsGroupsModel = parent::getCachedModel('streams_groups'); |
| 1488 | 1488 | $r = clone($request); |
| 1489 | 1489 | $sr = clone($request); |
| … |
… |
|
| 1519 | 1519 | $r->id = 0; |
| 1520 | 1520 | $r->name = $stream['folder']; |
| 1521 | | $streamsGroupsLogic->edit($r); |
| | 1521 | $streamsGroupsModel->edit($r); |
| 1522 | 1522 | $response = $r->getResponse(); |
| 1523 | 1523 | if('error' === $response->getNext()) |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic for 'streams_groups' object |
| | 3 | * Model for 'streams_groups' object |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 33 | 33 | * @license http://www.gnu.org/copyleft/gpl.html |
| 34 | 34 | * @package OWR |
| 35 | | * @subpackage Logic |
| | 35 | * @subpackage Model |
| 36 | 36 | */ |
| 37 | | namespace OWR\Logic\Streams; |
| 38 | | use OWR\Logic, |
| | 37 | namespace OWR\Model\Streams; |
| | 38 | use OWR\Model, |
| 39 | 39 | OWR\Request, |
| 40 | 40 | OWR\Exception, |
| 41 | 41 | OWR\DAO, |
| 42 | | OWR\Logic\Response, |
| | 42 | OWR\Model\Response, |
| 43 | 43 | OWR\Config; |
| 44 | 44 | /** |
| 45 | 45 | * This class is used to add/edit/delete groups |
| 46 | 46 | * @package OWR |
| 47 | | * @subpackage Logic |
| 48 | | * @uses OWR\Logic extends the base class |
| | 47 | * @subpackage Model |
| | 48 | * @uses OWR\Model extends the base class |
| 49 | 49 | * @uses OWR\Request the request |
| 50 | 50 | * @uses OWR\Exception the exception handler |
| 51 | 51 | * @uses OWR\DAO the DAO |
| 52 | | * @subpackage Logic |
| | 52 | * @subpackage Model |
| 53 | 53 | */ |
| 54 | | class Groups extends Logic |
| | 54 | class Groups extends Model |
| 55 | 55 | { |
| 56 | 56 | /** |
| … |
… |
|
| 147 | 147 | if(is_array($streamids)) |
| 148 | 148 | { |
| 149 | | $logic = parent::getCachedLogic('streams'); |
| | 149 | $model = parent::getCachedModel('streams'); |
| 150 | 150 | foreach($streamids as $rss) |
| 151 | 151 | { |
| 152 | 152 | $r->id = $rss->rssid; |
| 153 | | $logic->delete($r); |
| | 153 | $model->delete($r); |
| 154 | 154 | $response = $r->getResponse(); |
| 155 | 155 | if('error' === $response->getNext()) |
| … |
… |
|
| 160 | 160 | { |
| 161 | 161 | $r->id = $streamids->rssid; |
| 162 | | parent::getCachedLogic('streams')->delete($r); |
| | 162 | parent::getCachedModel('streams')->delete($r); |
| 163 | 163 | $response = $r->getResponse(); |
| 164 | 164 | if('error' === $response->getNext()) |
-
|
rb65617
|
r6fd857
|
|
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | | * Logic for 'users' object |
| | 3 | * Model for 'users' object |
| 4 | 4 | * |
| 5 | 5 | * PHP 5 |
| … |
… |
|
| 33 | 33 | * @license http://www.gnu.org/copyleft/gpl.html |
| 34 | 34 | * @package OWR |
| 35 | | * @subpackage Logic |
| | 35 | * @subpackage Model |
| 36 | 36 | */ |
| 37 | | namespace OWR\Logic; |
| 38 | | use OWR\Logic, |
| | 37 | namespace OWR\Model; |
| | 38 | use OWR\Model, |
| 39 | 39 | OWR\Request, |
| 40 | 40 | OWR\Exception, |
| … |
… |
|
| 46 | 46 | * This class is used to add/edit/delete users and his related tables () |
| 47 | 47 | * @package OWR |
| 48 | | * @uses OWR\Logic extends the base class |
| | 48 | * @uses OWR\Model extends the base class |
| 49 | 49 | * @uses OWR\Request the request |
| 50 | 50 | * @uses OWR\Exception the exception handler |
| … |
… |
|
| 53 | 53 | * @uses OWR\DB\Request a request sent to DB |
| 54 | 54 | * @uses OWR\Object transforms an object to an array |
| 55 | | * @subpackage Logic |
| | 55 | * @subpackage Model |
| 56 | 56 | */ |
| 57 | | class Users extends Logic |
| | 57 | class Users extends Model |
| 58 | 58 | { |
| 59 | 59 | /** |
-
|
rb65617
|
r6fd857
|
|
| 50 | 50 | OWR\DAO, |
| 51 | 51 | OWR\XML, |
| 52 | | OWR\Logic\Response as LogicResponse, |
| | 52 | OWR\Model\Response as ModelResponse, |
| 53 | 53 | OWR\Cron, |
| 54 | | OWR\Logic; |
| | 54 | OWR\Model; |
| 55 | 55 | if(!defined('INC_CONFIG')) die('Please include config file'); |
| 56 | 56 | /** |
| … |
… |
|
| 70 | 70 | * @uses OWR\XML serialize/unserialize XML datas |
| 71 | 71 | * @uses OWR\Cron adds/modify crontab |
| 72 | | * @uses OWR\Logic the main Logic object |
| | 72 | * @uses OWR\Model the main Model object |
| 73 | 73 | * @package OWR |
| 74 | 74 | * @subpackage Rest |
| … |
… |
|
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | | * Process the response of a Logic call |
| | 260 | * Process the response of a Model call |
| 261 | 261 | * |
| 262 | 262 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 263 | 263 | * @access public |
| 264 | | * @param mixed LogicResponse the response of the |
| | 264 | * @param mixed ModelResponse the response of the |
| 265 | 265 | */ |
| 266 | | public function processResponse(LogicResponse $response = null) |
| | 266 | public function processResponse(ModelResponse $response = null) |
| 267 | 267 | { |
| 268 | 268 | $status = $response->getStatus(); |
| … |
… |
|
| 311 | 311 | |
| 312 | 312 | default: |
| 313 | | throw new Exception('Invalid return from Logic', Exception::E_OWR_DIE); |
| | 313 | throw new Exception('Invalid return from Model', Exception::E_OWR_DIE); |
| 314 | 314 | break; |
| 315 | 315 | } |
| … |
… |
|
| 445 | 445 | case 'new_contents': |
| 446 | 446 | $request = new Request($datas); |
| 447 | | Logic::getCachedLogic('news')->view($request); |
| | 447 | Model::getCachedModel('news')->view($request); |
| 448 | 448 | $response = $request->getResponse(); |
| 449 | 449 | if('error' !== $response->getNext()) |
| … |
… |
|
| 462 | 462 | $page['details'] = array(); |
| 463 | 463 | $request = new Request($datas); |
| 464 | | Logic::getCachedLogic('news')->view($request); |
| | 464 | Model::getCachedModel('news')->view($request); |
| 465 | 465 | $response = $request->getResponse(); |
| 466 | 466 | if('error' !== $response->getNext()) |
| … |
… |
|
| 517 | 517 | $streams = array($streams); |
| 518 | 518 | $request = new Request(array('id'=>null)); |
| 519 | | Logic::getCachedLogic('streams_groups')->view($request); |
| | 519 | Model::getCachedModel('streams_groups')->view($request); |
| 520 | 520 | $response = $request->getResponse(); |
| 521 | 521 | $groups = array(); |
| … |
… |
|
| 540 | 540 | { |
| 541 | 541 | $request->id = $s->rssid; |
| 542 | | Logic::getCachedLogic('streams')->view($request); |
| | 542 | Model::getCachedModel('streams')->view($request); |
| 543 | 543 | $response = $request->getResponse(); |
| 544 | 544 | if('error' !== $response->getNext()) |
| … |
… |
|
| 565 | 565 | case 'menu_part_stream': |
| 566 | 566 | $request = new Request($datas); |
| 567 | | Logic::getCachedLogic('streams')->view($request); |
| | 567 | Model::getCachedModel('streams')->view($request); |
| 568 | 568 | $response = $request->getResponse(); |
| 569 | 569 | if('error' !== $response->getNext()) |
| … |
… |
|
| 624 | 624 | } |
| 625 | 625 | $request = new Request(array('ids' => $datas['id'])); |
| 626 | | Logic::getCachedLogic('news')->view($request, array(), $order, 'news.id', $offset); |
| | 626 | Model::getCachedModel('news')->view($request, array(), $order, 'news.id', $offset); |
| 627 | 627 | $page['nbNews'] = count($datas['id']); |
| 628 | 628 | } |
| … |
… |
|
| 630 | 630 | { |
| 631 | 631 | $request = new Request(array('id' => null)); |
| 632 | | Logic::getCachedLogic('news')->view($request, array('status' => 1), $order, 'news.id', $offset); |
| | 632 | Model::getCachedModel('news')->view($request, array('status' => 1), $order, 'news.id', $offset); |
| 633 | 633 | $page['nbNews'] = $this->_request->unreads[0]; |
| 634 | 634 | } |
| … |
… |
|
| 656 | 656 | if('streams' === $table) |
| 657 | 657 | { |
| 658 | | Logic::getCachedLogic('news')->view($request, array('rssid' => $datas['id']), $order, 'news.id', $offset); |
| | 658 | Model::getCachedModel('news')->view($request, array('rssid' => $datas['id']), $order, 'news.id', $offset); |
| 659 | 659 | $nb = DAO::getCachedDAO('news_relations')->count(array('rssid' => $datas['id']), 'newsid'); |
| 660 | 660 | $page['nbNews'] = $nb ? $nb->nb : 0; |
| … |
… |
|
| 662 | 662 | elseif('streams_groups' === $table) |
| 663 | 663 | { |
| 664 | | Logic::getCachedLogic('news')->view($request, array('gid' => $datas['id']), $order, 'news.id', $offset); |
| | 664 | Model::getCachedModel('news')->view($request, array('gid' => $datas['id']), $order, 'news.id', $offset); |
| 665 | 665 | $nb = DAO::getCachedDAO('news_relations')->count(array('streams_relations.gid' => $datas['id']), 'newsid'); |
| 666 | 666 | $page['nbNews'] = $nb ? $nb->nb : 0; |
| … |
… |
|
| 743 | 743 | $page['userrights'] = $this->_user->getRights(); |
| 744 | 744 | $cacheTime = 0; |
| 745 | | Logic::getCachedLogic('users')->view($request); |
| | 745 | Model::getCachedModel('users')->view($request); |
| 746 | 746 | $response = $request->getResponse(); |
| 747 | 747 | if('error' !== $response->getNext()) |
| … |
… |
|
| 761 | 761 | $cacheTime = 0; |
| 762 | 762 | $datas['surl'] = $this->_cfg->get('surl'); |
| 763 | | Logic::getCachedLogic('users')->view($request, array(), 'login'); |
| | 763 | Model::getCachedModel('users')->view($request, array(), 'login'); |
| 764 | 764 | $response = $request->getResponse(); |
| 765 | 765 | if('error' !== $response->getNext()) |
| … |
… |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | | $this->_request->page = Logic::getCachedLogic($type)->view($this->_request, array(), $order, '', $offset); |
| | 865 | $this->_request->page = Model::getCachedModel($type)->view($this->_request, array(), $order, '', $offset); |
| 866 | 866 | $this->processResponse($this->_request->getResponse()); |
| 867 | 867 | |
-
|
r386fa0
|
r6fd857
|
|
| 36 | 36 | */ |
| 37 | 37 | namespace OWR; |
| 38 | | use OWR\Logic\Response as LogicResponse; |
| | 38 | use OWR\Model\Response as ModelResponse; |
| 39 | 39 | /** |
| 40 | 40 | * This object is sent to the Controller to be executed |
| … |
… |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | | * @var mixed the Logic\Response instance |
| | 54 | * @var mixed the Model\Response instance |
| 55 | 55 | * @access protected |
| 56 | 56 | */ |
| … |
… |
|
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | | * Sets the response of a Logic call |
| | 284 | * Sets the response of a Model call |
| 285 | 285 | * |
| 286 | 286 | * @access public |
| 287 | 287 | * @static |
| 288 | 288 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 289 | | * @param mixed $response the Logic\Response instance |
| 290 | | */ |
| 291 | | public function setResponse(LogicResponse $response) |
| | 289 | * @param mixed $response the Model\Response instance |
| | 290 | */ |
| | 291 | public function setResponse(ModelResponse $response) |
| 292 | 292 | { |
| 293 | 293 | $this->_response = $response; |
| … |
… |
|
| 295 | 295 | |
| 296 | 296 | /** |
| 297 | | * Returns the response of a Logic call |
| | 297 | * Returns the response of a Model call |
| 298 | 298 | * |
| 299 | 299 | * @access public |
| 300 | 300 | * @static |
| 301 | 301 | * @author Pierre-Alain Mignot <contact@openwebreader.org> |
| 302 | | * @return mixed $response the Logic\Response instance |
| | 302 | * @return mixed $response the Model\Response instance |
| 303 | 303 | */ |
| 304 | 304 | public function getResponse() |
-
|
ra9d1ca
|
r6fd857
|
|
| 27 | 27 | "Report-Msgid-Bugs-To: pierre-alain@openwebreader.org\n" |
| 28 | 28 | "POT-Creation-Date: 2009-03-21 17:52+0100\n" |
| 29 | | "PO-Revision-Date: 2010-06-05 13:22+0100\n" |
| | 29 | "PO-Revision-Date: 2010-07-10 14:11+0100\n" |
| 30 | 30 | "Last-Translator: Pierre-Alain Mignot <pierre-alain@openwebreader.org>\n" |
| 31 | 31 | "Language-Team: en_US\n" |
| … |
… |
|
| 424 | 424 | msgstr "Invalid action \"%s\"" |
| 425 | 425 | |
| 426 | | msgid "Invalid return from Logic" |
| 427 | | msgstr "Invalid return from Logic" |
| | 426 | msgid "Invalid return from Model" |
| | 427 | msgstr "Invalid return from Model" |
| 428 | 428 | |
| 429 | 429 | msgid "Missing id" |
-
|
ra9d1ca
|
r6fd857
|
|
| 27 | 27 | "Report-Msgid-Bugs-To: pierre-alain@openwebreader.org\n" |
| 28 | 28 | "POT-Creation-Date: 2009-03-21 17:52+0100\n" |
| 29 | | "PO-Revision-Date: 2010-06-05 13:22+0100\n" |
| | 29 | "PO-Revision-Date: 2010-07-10 14:11+0100\n" |
| 30 | 30 | "Last-Translator: Pierre-Alain Mignot <pierre-alain@openwebreader.org>\n" |
| 31 | 31 | "Language-Team: fr_FR\n" |
| … |
… |
|
| 424 | 424 | msgstr "Action \"%s\" invalide" |
| 425 | 425 | |
| 426 | | msgid "Invalid return from Logic" |
| 427 | | msgstr "Retour de la Logic invalide" |
| | 426 | msgid "Invalid return from Model" |
| | 427 | msgstr "Retour du modèle invalide" |
| 428 | 428 | |
| 429 | 429 | msgid "Missing id" |