Questions and Answers

How do I collect points?

  • +4
    Chosen as best answer
  • +1
    Posted answer
  • +1
    Posted question
  • +1
    Thumb up
  • -1
    Thumb down
2

by David in Coding about July 26, 2013 open - report

New Module with comments

I created a new module for Social Engine. I need to access the module and the comments are public, but you must be registered to comment.

I have created:

my_new_root_model:
    - Model:
        - DbTable:
            -my_new_models -> extends Engine_Db_Table
        - my_new_model -> extends Core_Model_Item_Abstract
            - comments(): return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('comments', 'core'));
            - likes(): return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('likes', 'core'));
            - tags(): return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('tags', 'core'));
    - controllers:
        - my_new_model_controller -> extends Core_Controller_Action_Standard
            init:
                public function init()
                {
                    // Get subject
                    $mynewmodel = null;
                    $mynewmodel_id = $this->_getParam('mynewmodel_id', $this->_getParam('id', null));
                    
                    if(!$mynewmodel_id)
                        $mynewmodel = DEFAULT_VALUE;
                    
                    if( !$this->_helper->requireAuth()->setAuthParams('mynewrootmodel_mynewmodel', null, 'view')->isValid() ) return;
                    
                    $mynewmodel = Engine_Api::_()->getItem('mynewrootmodel_mynewmodel', $mynewmodel);
                    if( $mynewmodel ) {
                        Engine_Api::_()->core()->setSubject($mynewmodel);
                    }
                    
                    // Require subject
                    if( !$this->_helper->requireSubject()->isValid() ) {
                      return;
                    }
                }
    - views:
        - scripts:
            - mynewmodel:
                - mynewmodel.tpl
                    <?php echo $this->action("list", "comment", "core", array("type"=>"mynewrootmodel_mynewmodel", "id"=>$this->mynewmodel->mynewmodel_id)) ?>
                    
                    
En Base de datos he puesto:

- engine4_authorization_permissions:
    __level_id    type                        name        value    params__
    __5            mynewrootmodel_mynewmodel    view        1        NULL__
    __5            mynewrootmodel_mynewmodel    comment        1        NULL__
    
- engine4_authorization_allow:
    __resource_type                resource_id    action    role        role_id        value    params__
    __mynewrootmodel_mynewmodel    *id*        view    everyone    5            1        NULL__
    __mynewrootmodel_mynewmodel    *id*        comment    everyone    5            1        NULL__
    
    
If I'm not registered, I can see only the information in my new module, but not the comments.
If I am registered, I can not see anything.

I need to know what steps I'm doing wrong. I've got the information of modules as Album, Photo and Video

Thanks

Answer: 1  •  Score 0  •  Views: 1495

1 Answer
Browse by
  • 2

    by David about July 26, 2013

    I changed the values ​​in the tables engine4_authorization_permissions engine4_authorization_allow and copy/paste the Album module (with minor tweaks) and now I see the comments in my module. :) . But I do not know exactly what it means each column. Does anyone know?

    • Score: 0
You must login to post an answer.