Changeset 6fd857ae18691442649d201cc1db549a7a348834

Show
Ignore:
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:
8 modified
10 moved

Legend:

Unmodified
Added
Removed
  • OWR/CLI/Controller.php

    r5fedee r6fd857  
    5454    OWR\DAO as DAO, 
    5555    OWR\DB as DB, 
    56     OWR\Logic as Logic, 
     56    OWR\Model as Model, 
    5757    OWR\Threads as Threads, 
    5858    OWR\View\Utilities as Utilities; 
     
    236236    protected function do_checkStreamsAvailability() 
    237237    { 
    238         Logic::getCachedLogic('streams')->checkAvailability($this->_request); 
     238        Model::getCachedModel('streams')->checkAvailability($this->_request); 
    239239        $this->processResponse($this->_request->getResponse()); 
    240240        return $this; 
     
    253253    protected function do_manageFavicons() 
    254254    { 
    255         Logic::getCachedLogic('streams')->manageFavicons($this->_request); 
     255        Model::getCachedModel('streams')->manageFavicons($this->_request); 
    256256        $this->processResponse($this->_request->getResponse()); 
    257257        return $this; 
     
    267267    protected function do_refreshStream() 
    268268    { 
    269         Logic::getCachedLogic('streams')->refreshAll($this->_request); 
     269        Model::getCachedModel('streams')->refreshAll($this->_request); 
    270270        $this->processResponse($this->_request->getResponse()); 
    271271        return $this; 
  • OWR/Controller.php

    r5fedee r6fd857  
    3737namespace OWR; 
    3838use OWR\DB\Request as DBRequest, 
    39     OWR\Logic\Response as LogicResponse, 
     39    OWR\Model\Response as ModelResponse, 
    4040    OWR\View\Utilities; 
    4141if(!defined('INC_CONFIG')) die('Please include config file'); 
     
    584584 
    585585    /** 
    586      * Process the response of a Logic call 
     586     * Process the response of a Model call 
    587587     * 
    588588     * @author Pierre-Alain Mignot <contact@openwebreader.org> 
    589589     * @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) 
    593593    { 
    594594        $status = $response->getStatus(); 
     
    623623 
    624624            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); 
    626626                break; 
    627627        } 
     
    699699            case 'new_contents': 
    700700                $request = new Request(array('id' => $datas['id'])); 
    701                 Logic::getCachedLogic('news')->view($request); 
     701                Model::getCachedModel('news')->view($request); 
    702702                $response = $request->getResponse(); 
    703703                if('error' !== $response->getNext()) 
     
    727727                $datas['details'] = array(); 
    728728                $request = new Request(array('id' => $datas['id'])); 
    729                 Logic::getCachedLogic('news')->view($request); 
     729                Model::getCachedModel('news')->view($request); 
    730730                $response = $request->getResponse(); 
    731731                if('error' !== $response->getNext()) 
     
    783783                    $streams = array($streams); 
    784784                $request = new Request(array('id'=>null)); 
    785                 Logic::getCachedLogic('streams_groups')->view($request, array(), 'name'); 
     785                Model::getCachedModel('streams_groups')->view($request, array(), 'name'); 
    786786                $response = $request->getResponse(); 
    787787                $groups = array(); 
     
    803803                { 
    804804                    $request->id = $s->rssid; 
    805                     Logic::getCachedLogic('streams')->view($request); 
     805                    Model::getCachedModel('streams')->view($request); 
    806806                    $response = $request->getResponse(); 
    807807                    if('error' !== $response->getNext()) 
     
    856856            case 'news_tags_contents': 
    857857                $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'])); 
    859859                $response = $request->getResponse(); 
    860860                if('error' !== $response->getNext()) 
     
    886886            case 'menu_part_stream': 
    887887                $request = new Request(array('id' => $datas['id'])); 
    888                 Logic::getCachedLogic('streams')->view($request); 
     888                Model::getCachedModel('streams')->view($request); 
    889889                $response = $request->getResponse(); 
    890890                if('error' !== $response->getNext()) 
     
    950950                    } 
    951951                    $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); 
    953953                    $datas['nbNews'] = count($datas['id']); 
    954954                } 
     
    956956                { 
    957957                    $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); 
    959959                    $datas['nbNews'] = isset($this->_request->unreads[0]) ? $this->_request->unreads[0] : 0; 
    960960                } 
     
    962962                { // all news 
    963963                    $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); 
    965965                    $nb = DAO::getCachedDAO('news_relations')->count(array(), 'newsid'); 
    966966                    $datas['nbNews'] = $nb ? $nb->nb : 0; 
     
    989989                    if('streams' === $table) 
    990990                    { 
    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); 
    992992                        $nb = DAO::getCachedDAO('news_relations')->count(array('rssid' => $datas['id']), 'newsid'); 
    993993                        $datas['nbNews'] = $nb ? $nb->nb : 0; 
     
    995995                    elseif('streams_groups' === $table) 
    996996                    { 
    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); 
    998998                        $nb = DAO::getCachedDAO('news_relations')->count(array('gid' => $datas['id']), 'newsid'); 
    999999                        $datas['nbNews'] = $nb ? $nb->nb : 0; 
     
    10011001                    elseif('news_tags' === $table) 
    10021002                    { 
    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); 
    10041004                        $nb = DAO::getCachedDAO('news_relations_tags')->count(array('tid' => $datas['id']), 'newsid'); 
    10051005                        $datas['nbNews'] = $nb ? $nb->nb : 0; 
     
    10841084 
    10851085                $request = new Request(array('id'=>null)); 
    1086                 Logic::getCachedLogic('streams_groups')->view($request, array(), 'name'); 
     1086                Model::getCachedModel('streams_groups')->view($request, array(), 'name'); 
    10871087                $response = $request->getResponse(); 
    10881088                $groups = array(); 
     
    11651165            case 'menu_tags_contents': 
    11661166                $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'); 
    11681168                $response = $request->getResponse(); 
    11691169                if('error' !== $response->getNext()) 
     
    12121212                $datas['streams'] = array(); 
    12131213                $request = new Request(array('id'=>null)); 
    1214                 Logic::getCachedLogic('streams')->view($request); 
     1214                Model::getCachedModel('streams')->view($request); 
    12151215                $response = $request->getResponse(); 
    12161216                if('error' !== $response->getNext()) 
     
    12561256                $datas['timezones'] = $this->_user->getTimeZones(); 
    12571257                $datas['userrights'] = $this->_user->getRights(); 
    1258                 Logic::getCachedLogic('users')->view($request); 
     1258                Model::getCachedModel('users')->view($request); 
    12591259                $response = $request->getResponse(); 
    12601260                if('error' !== $response->getNext()) 
     
    12761276                $datas['users'] = array(); 
    12771277                $datas['nbusers'] = 0; 
    1278                 Logic::getCachedLogic('users')->view($request, array(), 'login'); 
     1278                Model::getCachedModel('users')->view($request, array(), 'login'); 
    12791279                $response = $request->getResponse(); 
    12801280                if('error' !== $response->getNext()) 
     
    13071307                    $args['rssid'] = $datas['id']; 
    13081308                $datas['news'] = $ids = array(); 
    1309                 Logic::getCachedLogic('news')->view($request, $args); 
     1309                Model::getCachedModel('news')->view($request, $args); 
    13101310                $response = $request->getResponse(); 
    13111311                if('error' !== $response->getNext()) 
     
    14211421 
    14221422    /** 
    1423      * Now functions that do not require a logic call 
     1423     * Now functions that do not require a model call 
    14241424     */ 
    14251425 
     
    20662066 
    20672067    /** 
    2068      * Requires a call to a logic from here 
     2068     * Requires a call to a model from here 
    20692069     */ 
    20702070 
     
    20782078    protected function do_changeLang() 
    20792079    { 
    2080         Logic::getCachedLogic('users')->changeLang($this->_request); 
     2080        Model::getCachedModel('users')->changeLang($this->_request); 
    20812081        $this->processResponse($this->_request->getResponse()); 
    20822082        return $this; 
     
    20922092    protected function do_stats() 
    20932093    { 
    2094         Logic::getCachedLogic('users')->stat($this->_request); 
     2094        Model::getCachedModel('users')->stat($this->_request); 
    20952095        $this->processResponse($this->_request->getResponse()); 
    20962096        return $this; 
     
    22732273    protected function do_move() 
    22742274    { 
    2275         Logic::getCachedLogic('streams')->move($this->_request); 
     2275        Model::getCachedModel('streams')->move($this->_request); 
    22762276        $this->processResponse($this->_request->getResponse()); 
    22772277        return $this; 
     
    22902290        if(!$this->_request->id) 
    22912291        { 
    2292             Logic::getCachedLogic('users')->deleteRelated($this->_request); 
     2292            Model::getCachedModel('users')->deleteRelated($this->_request); 
    22932293            if(!$this->processResponse($this->_request->getResponse())) return $this; 
    22942294        } 
     
    23002300            { 
    23012301                case 'users': 
    2302                     Logic::getCachedLogic('users')->delete($this->_request); 
     2302                    Model::getCachedModel('users')->delete($this->_request); 
    23032303                    if(!$this->processResponse($this->_request->getResponse())) return $this; 
    23042304                    $escape = true; 
     
    23092309                case 'streams_groups': 
    23102310                case 'news_tags': 
    2311                     Logic::getCachedLogic($type)->delete($this->_request); 
     2311                    Model::getCachedModel($type)->delete($this->_request); 
    23122312                    if(!$this->processResponse($this->_request->getResponse())) return $this; 
    23132313                    break; 
     
    23582358        $this->_request->escape = isset($url); 
    23592359 
    2360         Logic::getCachedLogic('streams')->edit($this->_request); 
     2360        Model::getCachedModel('streams')->edit($this->_request); 
    23612361        $this->processResponse($this->_request->getResponse()); 
    23622362 
     
    23782378        $this->_request->escape = isset($name); 
    23792379 
    2380         Logic::getCachedLogic('streams_groups')->edit($this->_request); 
     2380        Model::getCachedModel('streams_groups')->edit($this->_request); 
    23812381        if(!$this->processResponse($this->_request->getResponse())) return $this; 
    23822382 
     
    24092409        $this->_request->escape = isset($url); 
    24102410 
    2411         Logic::getCachedLogic('streams')->editOPML($this->_request); 
     2411        Model::getCachedModel('streams')->editOPML($this->_request); 
    24122412        if(!$this->processResponse($this->_request->getResponse())) return $this; 
    24132413 
     
    24982498    protected function do_refreshStream() 
    24992499    { 
    2500         Logic::getCachedLogic('streams')->refresh($this->_request); 
     2500        Model::getCachedModel('streams')->refresh($this->_request); 
    25012501        $this->processResponse($this->_request->getResponse()); 
    25022502 
     
    25132513    protected function do_upNew() 
    25142514    { 
    2515         Logic::getCachedLogic('news')->update($this->_request); 
     2515        Model::getCachedModel('news')->update($this->_request); 
    25162516        $this->processResponse($this->_request->getResponse()); 
    25172517 
     
    25282528    protected function do_clearStream() 
    25292529    { 
    2530         Logic::getCachedLogic('streams')->clear($this->_request); 
     2530        Model::getCachedModel('streams')->clear($this->_request); 
    25312531        $this->processResponse($this->_request->getResponse()); 
    25322532 
     
    25452545    protected function do_editUser() 
    25462546    { 
    2547         Logic::getCachedLogic('users')->edit($this->_request); 
     2547        Model::getCachedModel('users')->edit($this->_request); 
    25482548        $this->processResponse($this->_request->getResponse()); 
    25492549 
     
    25602560    protected function do_editTag() 
    25612561    { 
    2562         Logic::getCachedLogic('news_tags')->edit($this->_request); 
     2562        Model::getCachedModel('news_tags')->edit($this->_request); 
    25632563        $this->processResponse($this->_request->getResponse()); 
    25642564 
     
    25752575    protected function do_editTagsRelations() 
    25762576    { 
    2577         Logic::getCachedLogic('news_tags')->editRelations($this->_request); 
     2577        Model::getCachedModel('news_tags')->editRelations($this->_request); 
    25782578        $this->processResponse($this->_request->getResponse()); 
    25792579 
     
    25922592        if(!$this->_request->id) 
    25932593        { 
    2594             $this->processResponse(new LogicResponse(array( 
     2594            $this->processResponse(new ModelResponse(array( 
    25952595                'do'        => 'error', 
    25962596                'error'     => 'Invalid id', 
     
    26072607            case 'streams_groups': 
    26082608            case 'news_tags': 
    2609                 Logic::getCachedLogic($type)->rename($this->_request); 
     2609                Model::getCachedModel($type)->rename($this->_request); 
    26102610                if(!$this->processResponse($this->_request->getResponse())) return $this; 
    26112611                break; 
    26122612 
    26132613            default: 
    2614                 $this->processResponse(new LogicResponse(array( 
     2614                $this->processResponse(new ModelResponse(array( 
    26152615                    'do'        => 'error', 
    26162616                    'error'     => 'Invalid id', 
  • OWR/Interfaces/Model.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Interface for all logics 
     3 * Interface for all models 
    44 * 
    55 * PHP 5 
     
    4242 * @subpackage Interfaces 
    4343 */ 
    44 interface Logic 
     44interface Model 
    4545{ 
    4646    /** 
    47      * Returns the specified Logic object 
     47     * Returns the specified Model object 
    4848     * 
    4949     * @access public 
    5050     * @static 
    5151     * @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 
    5454     */ 
    55     static public function getLogic($logic); 
     55    static public function getModel($model); 
    5656 
    5757    /** 
    58      * Returns the specified Logic object from cache 
     58     * Returns the specified Model object from cache 
    5959     * 
    6060     * @access public 
    6161     * @static 
    6262     * @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 
    6565     */ 
    66     static public function getCachedLogic($logic); 
     66    static public function getCachedModel($model); 
    6767 
    6868    /** 
  • OWR/Interfaces/Model/Response.php

    r22257f r6fd857  
    11<?php 
    22/** 
    3  * Interface for all ResponseLogic 
     3 * Interface for all ResponseModel 
    44 * 
    55 * PHP 5 
     
    3535 * @subpackage Interfaces 
    3636 */ 
    37 namespace OWR\Interfaces\Logic; 
     37namespace OWR\Interfaces\Model; 
    3838/** 
    3939 * This class is used to declare public functions 
  • OWR/Model.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic Object base class 
     3 * Model Object base class 
    44 * 
    55 * PHP 5 
     
    3535 */ 
    3636namespace OWR; 
    37 use OWR\Interfaces\Logic as iLogic, 
     37use OWR\Interfaces\Model as iModel, 
    3838    OWR\User; 
    3939/** 
     
    4242 * 
    4343 * @abstract 
    44  * @uses OWR\Interfaces\Logic implements the Logic interface 
     44 * @uses OWR\Interfaces\Model implements the Model interface 
    4545 * @uses OWR\DB the database link 
    4646 * @uses OWR\Request a request sent to the database 
     
    5050 * @package OWR 
    5151 */ 
    52 abstract class Logic implements iLogic 
     52abstract class Model implements iModel 
    5353{ 
    5454    /** 
     
    7777 
    7878    /** 
    79     * @var array stored already processed logic names 
     79    * @var array stored already processed model names 
    8080    * @access private 
    8181    * @static 
    8282    */ 
    83     static private $_logics = array(); 
     83    static private $_models = array(); 
    8484 
    8585    /** 
    86     * @var array stored already processed logics objects 
     86    * @var array stored already processed models objects 
    8787    * @access private 
    8888    * @static 
    8989    */ 
    90     static private $_cachedLogics = array(); 
     90    static private $_cachedModels = array(); 
    9191 
    9292    /** 
     
    100100        $this->_db = DB::iGet(); // we assume here that the connexion has already been done, be carefull 
    101101        $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_'))); 
    103103        $this->_dao = DAO::getDAO($this->_name); 
    104104    } 
    105105 
    106106    /** 
    107      * Returns the specified Logic object 
     107     * Returns the specified Model object 
    108108     * 
    109109     * @access public 
    110110     * @static 
    111111     * @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 
    114114     */ 
    115     static public function getLogic($logic) 
     115    static public function getModel($model) 
    116116    { 
    117         if(!isset(self::$_logics[$logic])) 
     117        if(!isset(self::$_models[$model])) 
    118118        { 
    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; 
    121121        } 
    122         return new self::$_logics[$logic]; 
     122        return new self::$_models[$model]; 
    123123    } 
    124124 
    125125    /** 
    126      * Returns the specified Logic object from cache 
     126     * Returns the specified Model object from cache 
    127127     * 
    128128     * @access public 
    129129     * @static 
    130130     * @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 
    133133     */ 
    134     static public function getCachedLogic($logic) 
     134    static public function getCachedModel($model) 
    135135    { 
    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)); 
    138138 
    139         return self::$_cachedLogics[$logic]; 
     139        return self::$_cachedModels[$model]; 
    140140    } 
    141141} 
  • OWR/Model/News.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic for 'news' object 
     3 * Model for 'news' object 
    44 * 
    55 * PHP 5 
     
    3333 * @license http://www.gnu.org/copyleft/gpl.html 
    3434 * @package OWR 
    35  * @subpackage Logic 
     35 * @subpackage Model 
    3636 */ 
    37 namespace OWR\Logic; 
    38 use OWR\Logic, 
     37namespace OWR\Model; 
     38use OWR\Model, 
    3939    OWR\Request, 
    4040    OWR\Exception, 
     
    4646 * This class is used to add/edit/delete news 
    4747 * @package OWR 
    48  * @subpackage Logic 
    49  * @uses OWR\Logic extends the base class 
     48 * @subpackage Model 
     49 * @uses OWR\Model extends the base class 
    5050 * @uses OWR\Request the request 
    5151 * @uses OWR\Exception the exception handler 
    5252 * @uses OWR\DAO the DAO 
    5353 * @uses OWR\Logs the log object 
    54  * @subpackage Logic 
     54 * @subpackage Model 
    5555 */ 
    56 class News extends Logic 
     56class News extends Model 
    5757{ 
    5858    /** 
  • OWR/Model/News/Tags.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic for 'news_tags' object 
     3 * Model for 'news_tags' object 
    44 * 
    55 * PHP 5 
     
    3333 * @license http://www.gnu.org/copyleft/gpl.html 
    3434 * @package OWR 
    35  * @subpackage Logic 
     35 * @subpackage Model 
    3636 */ 
    37 namespace OWR\Logic\News; 
    38 use OWR\Logic, 
     37namespace OWR\Model\News; 
     38use OWR\Model, 
    3939    OWR\Request, 
    4040    OWR\Exception, 
    4141    OWR\DAO, 
    42     OWR\Logic\Response, 
     42    OWR\Model\Response, 
    4343    OWR\Config; 
    4444/** 
    4545 * This class is used to add/edit/delete tags 
    4646 * @package OWR 
    47  * @subpackage Logic 
    48  * @uses OWR\Logic extends the base class 
     47 * @subpackage Model 
     48 * @uses OWR\Model extends the base class 
    4949 * @uses OWR\Request the request 
    5050 * @uses OWR\Exception the exception handler 
    5151 * @uses OWR\DAO the DAO 
    52  * @subpackage Logic 
     52 * @subpackage Model 
    5353 */ 
    54 class Tags extends Logic 
     54class Tags extends Model 
    5555{ 
    5656    /** 
  • OWR/Model/Objects.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic for 'objects' object 
     3 * Model for 'objects' object 
    44 * 
    55 * PHP 5 
     
    3333 * @license http://www.gnu.org/copyleft/gpl.html 
    3434 * @package OWR 
    35  * @subpackage Logic 
     35 * @subpackage Model 
    3636 */ 
    37 namespace OWR\Logic; 
    38 use OWR\Logic, 
     37namespace OWR\Model; 
     38use OWR\Model, 
    3939    OWR\Request, 
    4040    OWR\Exception, 
     
    4343 * This class is used to add/delete objects 
    4444 * @package OWR 
    45  * @subpackage Logic 
    46  * @uses OWR\Logic extends the base class 
     45 * @subpackage Model 
     46 * @uses OWR\Model extends the base class 
    4747 * @uses OWR\Request the request 
    4848 * @uses OWR\Exception the exception handler 
    4949 * @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 
    5252 */ 
    53 class Objects extends Logic 
     53class Objects extends Model 
    5454{ 
    5555    /** 
     
    156156        { 
    157157            $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); 
    159159            $response = $r->getResponse(); 
    160160            if('error' !== $response->getNext()) 
  • OWR/Model/Response.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    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 
    66 * 
    77 * PHP 5 
     
    3535 * @license http://www.gnu.org/copyleft/gpl.html 
    3636 * @package OWR 
    37  * @subpackage Logic 
     37 * @subpackage Model 
    3838 */ 
    39 namespace OWR\Logic; 
    40 use OWR\Interfaces\Logic\Response as iResponse, 
     39namespace OWR\Model; 
     40use OWR\Interfaces\Model\Response as iResponse, 
    4141    OWR\Exception, 
    4242    OWR\View\Utilities as ViewUtilities; 
    4343/** 
    44  * This class is an object response of every logic call 
     44 * This class is an object response of every model call 
    4545 * @package OWR 
    46  * @subpackage Logic 
     46 * @subpackage Model 
    4747 */ 
    4848class Response implements iResponse 
     
    9494 
    9595    /** 
    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 
    9797     * @access protected 
    9898     */ 
     
    136136 
    137137                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); 
    139139                    break; 
    140140            } 
  • OWR/Model/Streams.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic for 'streams' object 
     3 * Model for 'streams' object 
    44 * 
    55 * PHP 5 
     
    3333 * @license http://www.gnu.org/copyleft/gpl.html 
    3434 * @package OWR 
    35  * @subpackage Logic 
     35 * @subpackage Model 
    3636 */ 
    37 namespace OWR\Logic; 
    38 use OWR\Logic, 
     37namespace OWR\Model; 
     38use OWR\Model, 
    3939    OWR\Request, 
    4040    OWR\Exception, 
     
    5353 * This class is used to add/edit/delete stream and his related tables 
    5454 * @package OWR 
    55  * @subpackage Logic 
    56  * @uses OWR\Logic extends the base class 
     55 * @subpackage Model 
     56 * @uses OWR\Model extends the base class 
    5757 * @uses OWR\Request the request 
    5858 * @uses OWR\Exception the exception handler 
     
    6262 * @uses OWR\Logs the logs object 
    6363 * @uses OWR\Cron add/modify crontab 
    64  * @subpackage Logic 
     64 * @subpackage Model 
    6565 */ 
    66 class Streams extends Logic 
     66class Streams extends Model 
    6767{ 
    6868    /** 
     
    8585        } 
    8686 
    87         parent::getCachedLogic('streams_groups')->checkGroupById($request); // fill gid and gname 
     87        parent::getCachedModel('streams_groups')->checkGroupById($request); // fill gid and gname 
    8888 
    8989        $request->url = html_entity_decode($request->url, ENT_COMPAT, 'UTF-8'); 
     
    150150                if(is_array($news)) 
    151151                { 
    152                     $logic = parent::getCachedLogic('news'); 
     152                    $model = parent::getCachedModel('news'); 
    153153 
    154154                    foreach($news as $new) 
    155155                    { 
    156156                        $r->id = $new->id; 
    157                         $logic->insertNewsRelations($r); 
     157                        $model->insertNewsRelations($r); 
    158158                        $response = $r->getResponse(); 
    159159                        if('error' === $response->getNext()) 
     
    165165                { 
    166166                    $r->id = $news->id; 
    167                     parent::getCachedLogic('news')->insertNewsRelations($r); 
     167                    parent::getCachedModel('news')->insertNewsRelations($r); 
    168168                    $response = $r->getResponse(); 
    169169                    if('error' === $response->getNext()) 
     
    408408        if(empty($request->escapeNews)) 
    409409        { // save the news 
    410             $logic = parent::getCachedLogic('news'); 
     410            $model = parent::getCachedModel('news'); 
    411411            $r = clone($request); 
    412412            $r->streamid = $request->id; 
     
    416416                try 
    417417                { 
    418                     $logic->edit($r); 
     418                    $model->edit($r); 
    419419                    $response = $r->getResponse(); 
    420420                    if('error' === $response->getNext()) 
     
    618618        } 
    619619 
    620         parent::getCachedLogic('streams_groups')->checkGroupById($request); 
     620        parent::getCachedModel('streams_groups')->checkGroupById($request); 
    621621 
    622622        $stream->gid = $request->gid; 
     
    732732 
    733733        $r = clone($request); 
    734         $logic = parent::getCachedLogic('news'); 
     734        $model = parent::getCachedModel('news'); 
    735735        $ids = array(); 
    736736        while($r->item = $stream->get('item')) 
     
    739739            { 
    740740                $r->streamid = $request->id; 
    741                 $logic->edit($r); 
     741                $model->edit($r); 
    742742                $ids[] = $r->id; 
    743743                $response = $r->getResponse(); 
     
    14231423        User::iGet()->checkToken(); 
    14241424 
    1425         parent::getCachedLogic('streams_groups')->checkGroupById($request); 
     1425        parent::getCachedModel('streams_groups')->checkGroupById($request); 
    14261426        $erase = false; 
    14271427 
     
    14771477        $r = clone($request); 
    14781478        $r->gid = 0; 
    1479         parent::getCachedLogic('streams_groups')->checkGroupById($r); 
     1479        parent::getCachedModel('streams_groups')->checkGroupById($r); 
    14801480        $gidRoot = $r->gid; 
    14811481        unset($r); 
     
    14851485        $ids = array(); 
    14861486 
    1487         $streamsGroupsLogic = parent::getCachedLogic('streams_groups'); 
     1487        $streamsGroupsModel = parent::getCachedModel('streams_groups'); 
    14881488        $r = clone($request); 
    14891489        $sr = clone($request); 
     
    15191519                            $r->id = 0; 
    15201520                            $r->name = $stream['folder']; 
    1521                             $streamsGroupsLogic->edit($r); 
     1521                            $streamsGroupsModel->edit($r); 
    15221522                            $response = $r->getResponse(); 
    15231523                            if('error' === $response->getNext()) 
  • OWR/Model/Streams/Groups.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic for 'streams_groups' object 
     3 * Model for 'streams_groups' object 
    44 * 
    55 * PHP 5 
     
    3333 * @license http://www.gnu.org/copyleft/gpl.html 
    3434 * @package OWR 
    35  * @subpackage Logic 
     35 * @subpackage Model 
    3636 */ 
    37 namespace OWR\Logic\Streams; 
    38 use OWR\Logic, 
     37namespace OWR\Model\Streams; 
     38use OWR\Model, 
    3939    OWR\Request, 
    4040    OWR\Exception, 
    4141    OWR\DAO, 
    42     OWR\Logic\Response, 
     42    OWR\Model\Response, 
    4343    OWR\Config; 
    4444/** 
    4545 * This class is used to add/edit/delete groups 
    4646 * @package OWR 
    47  * @subpackage Logic 
    48  * @uses OWR\Logic extends the base class 
     47 * @subpackage Model 
     48 * @uses OWR\Model extends the base class 
    4949 * @uses OWR\Request the request 
    5050 * @uses OWR\Exception the exception handler 
    5151 * @uses OWR\DAO the DAO 
    52  * @subpackage Logic 
     52 * @subpackage Model 
    5353 */ 
    54 class Groups extends Logic 
     54class Groups extends Model 
    5555{ 
    5656    /** 
     
    147147                if(is_array($streamids)) 
    148148                { 
    149                     $logic = parent::getCachedLogic('streams'); 
     149                    $model = parent::getCachedModel('streams'); 
    150150                    foreach($streamids as $rss) 
    151151                    { 
    152152                        $r->id = $rss->rssid; 
    153                         $logic->delete($r); 
     153                        $model->delete($r); 
    154154                        $response = $r->getResponse(); 
    155155                        if('error' === $response->getNext()) 
     
    160160                { 
    161161                    $r->id = $streamids->rssid; 
    162                     parent::getCachedLogic('streams')->delete($r); 
     162                    parent::getCachedModel('streams')->delete($r); 
    163163                    $response = $r->getResponse(); 
    164164                    if('error' === $response->getNext()) 
  • OWR/Model/Users.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic for 'users' object 
     3 * Model for 'users' object 
    44 * 
    55 * PHP 5 
     
    3333 * @license http://www.gnu.org/copyleft/gpl.html 
    3434 * @package OWR 
    35  * @subpackage Logic 
     35 * @subpackage Model 
    3636 */ 
    37 namespace OWR\Logic; 
    38 use OWR\Logic, 
     37namespace OWR\Model; 
     38use OWR\Model, 
    3939    OWR\Request, 
    4040    OWR\Exception, 
     
    4646 * This class is used to add/edit/delete users and his related tables () 
    4747 * @package OWR 
    48  * @uses OWR\Logic extends the base class 
     48 * @uses OWR\Model extends the base class 
    4949 * @uses OWR\Request the request 
    5050 * @uses OWR\Exception the exception handler 
     
    5353 * @uses OWR\DB\Request a request sent to DB 
    5454 * @uses OWR\Object transforms an object to an array 
    55  * @subpackage Logic 
     55 * @subpackage Model 
    5656 */ 
    57 class Users extends Logic 
     57class Users extends Model 
    5858{ 
    5959    /** 
  • OWR/REST/Controller.php

    rb65617 r6fd857  
    5050    OWR\DAO, 
    5151    OWR\XML, 
    52     OWR\Logic\Response as LogicResponse, 
     52    OWR\Model\Response as ModelResponse, 
    5353    OWR\Cron, 
    54     OWR\Logic; 
     54    OWR\Model; 
    5555if(!defined('INC_CONFIG')) die('Please include config file'); 
    5656/** 
     
    7070 * @uses OWR\XML serialize/unserialize XML datas 
    7171 * @uses OWR\Cron adds/modify crontab 
    72  * @uses OWR\Logic the main Logic object 
     72 * @uses OWR\Model the main Model object 
    7373 * @package OWR 
    7474 * @subpackage Rest 
     
    258258 
    259259    /** 
    260      * Process the response of a Logic call 
     260     * Process the response of a Model call 
    261261     * 
    262262     * @author Pierre-Alain Mignot <contact@openwebreader.org> 
    263263     * @access public 
    264      * @param mixed LogicResponse the response of the 
     264     * @param mixed ModelResponse the response of the 
    265265     */ 
    266     public function processResponse(LogicResponse $response = null) 
     266    public function processResponse(ModelResponse $response = null) 
    267267    { 
    268268        $status = $response->getStatus(); 
     
    311311 
    312312            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); 
    314314                break; 
    315315        } 
     
    445445            case 'new_contents': 
    446446                $request = new Request($datas); 
    447                 Logic::getCachedLogic('news')->view($request); 
     447                Model::getCachedModel('news')->view($request); 
    448448                $response = $request->getResponse(); 
    449449                if('error' !== $response->getNext()) 
     
    462462                $page['details'] = array(); 
    463463                $request = new Request($datas); 
    464                 Logic::getCachedLogic('news')->view($request); 
     464                Model::getCachedModel('news')->view($request); 
    465465                $response = $request->getResponse(); 
    466466                if('error' !== $response->getNext()) 
     
    517517                    $streams = array($streams); 
    518518                $request = new Request(array('id'=>null)); 
    519                 Logic::getCachedLogic('streams_groups')->view($request); 
     519                Model::getCachedModel('streams_groups')->view($request); 
    520520                $response = $request->getResponse(); 
    521521                $groups = array(); 
     
    540540                { 
    541541                    $request->id = $s->rssid; 
    542                     Logic::getCachedLogic('streams')->view($request); 
     542                    Model::getCachedModel('streams')->view($request); 
    543543                    $response = $request->getResponse(); 
    544544                    if('error' !== $response->getNext()) 
     
    565565            case 'menu_part_stream': 
    566566                $request = new Request($datas); 
    567                 Logic::getCachedLogic('streams')->view($request); 
     567                Model::getCachedModel('streams')->view($request); 
    568568                $response = $request->getResponse(); 
    569569                if('error' !== $response->getNext()) 
     
    624624                    } 
    625625                    $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); 
    627627                    $page['nbNews'] = count($datas['id']); 
    628628                } 
     
    630630                { 
    631631                    $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); 
    633633                    $page['nbNews'] = $this->_request->unreads[0]; 
    634634                } 
     
    656656                    if('streams' === $table) 
    657657                    { 
    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); 
    659659                        $nb = DAO::getCachedDAO('news_relations')->count(array('rssid' => $datas['id']), 'newsid'); 
    660660                        $page['nbNews'] = $nb ? $nb->nb : 0; 
     
    662662                    elseif('streams_groups' === $table) 
    663663                    { 
    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); 
    665665                        $nb = DAO::getCachedDAO('news_relations')->count(array('streams_relations.gid' => $datas['id']), 'newsid'); 
    666666                        $page['nbNews'] = $nb ? $nb->nb : 0; 
     
    743743                $page['userrights'] = $this->_user->getRights(); 
    744744                $cacheTime = 0; 
    745                 Logic::getCachedLogic('users')->view($request); 
     745                Model::getCachedModel('users')->view($request); 
    746746                $response = $request->getResponse(); 
    747747                if('error' !== $response->getNext()) 
     
    761761                $cacheTime = 0; 
    762762                $datas['surl'] = $this->_cfg->get('surl'); 
    763                 Logic::getCachedLogic('users')->view($request, array(), 'login'); 
     763                Model::getCachedModel('users')->view($request, array(), 'login'); 
    764764                $response = $request->getResponse(); 
    765765                if('error' !== $response->getNext()) 
     
    863863        } 
    864864 
    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); 
    866866        $this->processResponse($this->_request->getResponse()); 
    867867 
  • OWR/Request.php

    r386fa0 r6fd857  
    3636 */ 
    3737namespace OWR; 
    38 use OWR\Logic\Response as LogicResponse; 
     38use OWR\Model\Response as ModelResponse; 
    3939/** 
    4040 * This object is sent to the Controller to be executed 
     
    5252 
    5353    /** 
    54     * @var mixed the Logic\Response instance 
     54    * @var mixed the Model\Response instance 
    5555    * @access protected 
    5656    */ 
     
    282282 
    283283    /** 
    284      * Sets the response of a Logic call 
     284     * Sets the response of a Model call 
    285285     * 
    286286     * @access public 
    287287     * @static 
    288288     * @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) 
    292292    { 
    293293        $this->_response = $response; 
     
    295295 
    296296    /** 
    297      * Returns the response of a Logic call 
     297     * Returns the response of a Model call 
    298298     * 
    299299     * @access public 
    300300     * @static 
    301301     * @author Pierre-Alain Mignot <contact@openwebreader.org> 
    302      * @return mixed $response the Logic\Response instance 
     302     * @return mixed $response the Model\Response instance 
    303303     */ 
    304304    public function getResponse() 
  • OWR/locale/en_US/LC_MESSAGES/messages.po

    ra9d1ca r6fd857  
    2727"Report-Msgid-Bugs-To: pierre-alain@openwebreader.org\n" 
    2828"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" 
    3030"Last-Translator: Pierre-Alain Mignot <pierre-alain@openwebreader.org>\n" 
    3131"Language-Team: en_US\n" 
     
    424424msgstr "Invalid action \"%s\"" 
    425425 
    426 msgid "Invalid return from Logic" 
    427 msgstr "Invalid return from Logic" 
     426msgid "Invalid return from Model" 
     427msgstr "Invalid return from Model" 
    428428 
    429429msgid "Missing id" 
  • OWR/locale/fr_FR/LC_MESSAGES/messages.po

    ra9d1ca r6fd857  
    2727"Report-Msgid-Bugs-To: pierre-alain@openwebreader.org\n" 
    2828"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" 
    3030"Last-Translator: Pierre-Alain Mignot <pierre-alain@openwebreader.org>\n" 
    3131"Language-Team: fr_FR\n" 
     
    424424msgstr "Action \"%s\" invalide" 
    425425 
    426 msgid "Invalid return from Logic" 
    427 msgstr "Retour de la Logic invalide" 
     426msgid "Invalid return from Model" 
     427msgstr "Retour du modèle invalide" 
    428428 
    429429msgid "Missing id"