Joomlacomment plugin

TheShark

New Member
Hello i have download joomlacomment plugin for dummy (is a plugin base for create joomlacomment plugins for components),i want use this plugin for integrate comments and reviews for fabrik tables,anyone for help me?
 
This is a file class for this plugin:
Code:
<?php
defined('_VALID_MOS') or die('Restricted access');

/*
 * if you need it :  
 *     defined('_JOSC_J15') will be true if joomla release >= 1.5
 */
 
class JOSC_com_REPLACEnewplugin extends JOSC_component {
//    var $_component='';     /* JOSC_component */
//    var    $_id=0;             /* JOSC_component */
    /* specific properties of REPLACEnewplugin if needed */
//    var _specific_data;

    function JOSC_com_REPLACEnewplugin($component,&$row,&$list)
    {
        $id    = isset($row->REPLACEid) ? $row->REPLACEid : 0; /* document id */

        $this->setRowDatas($row); /* get specific properties */
                    
        $this->JOSC_component($component,0,$id);
    }

    /*
     * Set specific properties
     * will be called also in admin.html.php manage comments during row loop
     */
    function setRowDatas(&$row)
    {
        /* for optimization reason, do not save row. save just needed parameters */

        //$this->_specific_data    = isset($row->specific) ? $row->specific : '';
    }
        
    /*
     * This function is executed to check 
     * if section/category of the row are authorized or not (exclude/include from the setting)
     * return : true for authorized / false for excluded
     */    
    function checkSectionCategory(&$row, $include, $sections=array(), $catids=array(), $contentids=array())
    {
            /* doc id excluded ? */
               if (in_array((($row->REPLACEid == 0) ? -1 : $row->REPLACEid), $contentids))
                   return false;         

            /* category included or excluded ? */
            $result = in_array((($row->REPLACEcatid == 0) ? -1 : $row->REPLACEcatid), $sections);
            if (($include && !$result) || (!$include && $result))  
                return false; /* include and not found OR exclude and found */
        
            return true;
    }

    /*
     * Condition to active or not the display of the post and input form
     * If the return is false, show readon will be executed.
     */
    function checkVisual($contentId=0)
    {    
        global $option, $task;
        
        return  (        $option == 'com_REPLACEnewplugin' 
                    &&     $task == 'REPLACEdoc_details' 
               &nbsp;);    
    }
    
    /*
     * This function will active or deactivate the show readon display 
     */    
    function setShowReadon( &$row, &$params, &$config )
    {
        $show_readon     = $config->_show_readon;

        return $show_readon;  
    }
    
    /*
     * construct the link to the content item  
     * (and also direct to the comment if commentId set)
     */
    function linkToContent($contentId, $commentId='')
    {
        global $mosConfig_live_site, $mainframe, $Itemid;

        //$Itemid = $mainframe->getItemid( $contentId, 0, 0 );
        if (!$Itemid) $Itemid = '99999999';
                
        $sefRelToAbs = function_exists('sefRelToAbs'); /* does not exist in admin part */  
        
        $url = $mosConfig_live_site."/index.php?option=com_REPLACEnewplugin&task=REPLACEdoc_details&REPLACEgid=$contentId" . ( $Itemid ? "&Itemid=$Itemid" : "" ) . ($commentId ? "#josc$commentId" : "") ;
        return ($sefRelToAbs ? sefRelToAbs($url) : $url);
    }

    /*
     * clean the cache of the component when comments are inserted/modified...
     * (if cache is active) 
     */
    function cleanComponentCache() {
            mosCache::cleanCache( 'com_REPLACEnewplugin' );
    }

    /*----------------------------------------------------------------------------------
     *  F U N C T I O N S   F O R   A D M I N   P A R T 
     *----------------------------------------------------------------------------------
     */
     
    /*
     * section option list used to display the include/exclude section list in setting 
     * must return an array of objects (id,title)
     */
    function getSectionsIdOption() 
    {    
        global $database;
        
        $sectoptions = array();
        $query     = "SELECT id, title"
                . "\n FROM #__categories"
                . "\n WHERE published = 1"
                . "\n AND section = 'com_REPLACEnewplugin' "
//                . "\n AND access >= 0"    
                . "\n ORDER BY ordering"
                ;
        $database->setQuery( $query );
        $sectoptions = $database->loadObjectList();
        
        return $sectoptions;
    }

    /*
     * categories option list used to display the include/exclude category list in setting 
     * must return an array of objects (id,title)
     */
    function getCategoriesIdOption() 
    {    
        global $database;
        
        $catoptions = array();
        
        return $catoptions;
    }

    /*
     * content items list (or single) for new and edit comment
     * must return an array of objects (id,title)
     */
    function getObjectIdOption($id=0, $select=true)
    {
        global $database;
        
        $content = array();
        $query     = "SELECT REPLACEid AS id, REPLACEtitle AS title"
                . "\n FROM #__REPLACEcontent "
                . ($id ? "\n WHERE REPLACEid = $id":"")
                . "\n ORDER BY REPLACEordering"
                ;
        $database->setQuery( $query );
        $content = $database->loadObjectList();
        if (!$id && $select && count($content)>0) { 
            array_unshift( $content, mosHTML::makeOption( '0', '-- Select REPLACEContent Item --', 'id', 'title' ) );
        }

        return $content;        
    }
    function getViewTitleField()
    { 
       $title = 'REPLACEtitle';
       return($title);
    }
    function getViewJoinQuery($alias, $contentid)
    {
        $leftjoin    = "\n LEFT JOIN #__REPLACEcontent  AS $alias ON $alias.REPLACEid = $contentid ";
        return $leftjoin;
    }

    /*----------------------------------------------------------------------------------
     *  F U N C T I O N S   F O R   MOD_COMMENTS   M O D U L E 
     *----------------------------------------------------------------------------------
     */
    function mod_commentsGetMostCommentedQuery($secids, $catids, $maxlines)
    {
        global $database;

        $component = $this->_component;
        
        $limit = $maxlines>=0 ? " limit $maxlines " : "";

        $where = array();
        if ($secids)
            $where[] = "REPLACEcat.id IN ($secids)";

        /* 
         * Count comment id group by contentid 
             * TODO: restrict according to user rights, dates and category/secitons published and dates...
         */
        $query     =      "SELECT COUNT(c.id) AS countid, ct.id, ct.REPLACEtitle AS title "
                .    "\n FROM `#__comment`    AS c "
                .      "\n INNER JOIN `#__REPLACEcontent`  AS ct  ON ct.id = c.contentid "
                   .      "REPLACE\n INNER JOIN `#__categories` AS cat ON cat.id = ct.catid "
                .      "\n WHERE c.published='1' "
                .    "\n   AND c.component='$component' "
                .      "\n ". (count($where) ? (" AND ".implode(" AND ", $where)) : "")
                .    "\n GROUP BY c.contentid"
                .    "\n ORDER BY countid DESC"
                .    "\n $limit"
                ;
        $database->SetQuery($query);
        $rows = $database->loadAssocList();

        return $rows;        
    }
    
    function mod_commentsGetOthersQuery($secids, $catids, $maxlines, $orderby)
    {
        global $database;

        $component = $this->_component;
        
        $limit = $maxlines>=0 ? " limit $maxlines " : "";

        $where = array();
        if ($secids)
            $where[] = "cat.id IN ($secids)";

        if ($orderby=='mostrated') {
            $mostrated =  ", (c.voting_yes-c.voting_no)/2 AS mostrated";
            $where[]  = "(c.voting_yes > 0 OR c.voting_no > 0)";
        } else {
            $mostrated = "";
            $orderby = "c.$orderby";
        }

        /*
             * TODO: restrict according to user rights, dates and category/secitons published and dates...
             */
        $query     =  "SELECT c.*, ct.REPLACEtitle AS ctitle $mostrated "
                .  "\n FROM `#__comment`    AS c "
                .  "\n INNER JOIN `#__REPLACEcontent`    AS ct  ON ct.id = c.contentid "
                .  "REPLACE\n INNER JOIN `#__categories` AS cat ON cat.id = ct.catid "
                .  "\n WHERE c.published='1' "
                .    "\n  AND c.component='$component' "
                .  "\n ". (count($where) ? (" AND ".implode(" AND ", $where)) : "")
                .  "\n ORDER BY $orderby DESC "
                .  "\n $limit"
                ;
        $database->SetQuery($query);
        $rows = $database->loadAssocList();
        
        return $rows;
    }
        
}
?>
 
I'm just not sure what you mean by 'integrate' into Fabrik. Integration covers an awful lot of ground!

Can you write a detailed explanation in your native language of what you want to do, focusing on how you want the user interface to look. I can then either Google translate it, or find someone else to help translate.

-- hugh
 
Ok i write into my language(italian)
Vorrei fare in modo che in ogni tabella creata con Fabrik ci sia la possibilita' di inserire i commenti e i voti usando Joomlacomment.Ti faccio un esempio: Joomlacomment ha un plugin con il quale ? possibile inserire i commenti in Docman,il file che ho incollato qui sopra e' la versione base del plugin per crearne di nuovi,io vorrei solo sapere se secondo voi ,modificando quel file e le rispettive query e' possibile avere la possibilita' di aggiungere e integrare Joomlacomment come si puo' fare con altri componenti.
 
OK, google did a pretty good job of translating that.

So, you want to take a Fabrik form submission, and insert some or all of the form content into a docman page? Or into regular com_content articles?

-- hugh
 
I hate to jump in where I don't belong, but do you mean JomComment extenstion from Azrul? :)

If so, you can set JomComment to compile comments for any content item, so you could simply display your tables you want to allow people to comment on as content (using the Fabrik plugins) and JomComment would show up at the bottom, if that makes sense. :confused:

In short, create a new article, use the fabrik table plugin to show the respective table in that article, and JomComment will add the comments to the article, thereby adding a comment section to your table display, per se.

If that's not what you meant, disregard my stupidity. ;)
 
I have request this because i have used Fabrik for table personalization,and this tables are not into content sections of joomla,and joomlacomment allow to insert comment only for content of joomla.
I want create this with fabrik(vote and comments) but i search help in another post of this forum but anyone have respond me http://fabrikar.com/forums/showthread.php?t=8298 ,if i have mode for create this with fabrik i don't want use joomlacomment.
 
I have request this because i have used Fabrik for table personalization,and this tables are not into content sections of joomla,and joomlacomment allow to insert comment only for content of joomla.


...but you could use the table plugins TO insert these tables into content sections, then use JoomlaComment.

If you create a new content item and use {fabrik view=table id=xx} as the content, it should show your table and since it's within an article/content, joomlacomment would also show at the bottom...no?
 
Ahhhh, to add comments to every one of those IDs, not just to table id=14, is above my pay grade....will have to yield back to Hugh or someone else, sorry. :)
 
Shark - can you look at that other thread and tell me if I'm understanding what you want to do there?

I'm still a little confused where JomContent is involved. Whether Fabrik is supposed to insert comments in JomComment, or vice versa.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top