| Current Path : /var/www/html/plugins/community/jvld/ |
| Current File : /var/www/html/plugins/community/jvld/jvld.php |
<?php
/**
* @version $Id$
* @package JV-LinkDirectory
* @subpackage com_jvld
* @copyright Copyright 2008-2013 JV-Extensions. All rights reserved
* @license GNU General Public License version 3 or later
* @author JV-Extensions
* @link http://www.jv-extensions.com
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
require_once(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_community'.DIRECTORY_SEPARATOR.'libraries'.DIRECTORY_SEPARATOR.'core.php');
if ((!class_exists('plgCommunityJvld')) && (defined('_JVLD_INSTALLED')))
{
class plgCommunityJvld extends CApplications
{
var $name = "My Listings";
var $_name = "mylistings";
function onProfileDisplay()
{
JvldPostinit::loadLanguageFile();
JvldPostinit::loadStyleSheet('style', _JVLD_LIVESITE.'plugins/community/jvld/jvld');
if ($this->params->get('position') == 'content')
{
return JvldCommunity::getUserLinksForProfileDisplay(CFactory::getRequestUser()->id);
}
else
{
$links = JvldCommunity::getUserLinksForProfileDisplay(CFactory::getRequestUser()->id, 1);
$html = '';
$html .= ' <div class="joms-app--jvld">';
if (count($links))
{
$html .= ' <ul class="joms-list">';
foreach ($links as $link)
{
$obj = JvldDb::getRow("select partner_title, link_published_on from #__jvld_links where id = ".(int)$link->LID);
$html .= ' <li>
<a target="_blank" href="'.JvldPostinit::getRoute("detailpageurl", $link->LID).'" title="'.htmlspecialchars($obj->partner_title).'">'.htmlspecialchars($obj->partner_title).'</a>
<span class="joms-block joms-text--small joms-text--light">'.JvldDate::getDateForDisplay($obj->link_published_on).'</span>
</li>';
}
$html .= ' </ul>';
}
else
{
$html .= ' <p class="alert alert-warning">'.JText::_("COM_JVLD_NO_LISTINGS").'</p>';
}
$html .= '</div>';
return $html;
}
}
public function onCommunityStreamRender($act)
{
JvldPostinit::loadLanguageFile();
JvldInit::loadCSS();
$actor = CFactory::getUser($act->actor);
$actorLink = '<a class="cStream-Author" href="' .CUrlHelper::userLink($actor->id).'">'.$actor->getDisplayName().'</a>';
$stream = new stdClass();
$stream->actor = $actor;
$title = \Joomla\String\StringHelper::str_ireplace("{actor}", $actorLink, $act->title);
$stream->headline = JvldPostinit::processUrlForFrontend($title);
JFactory::getDocument()->addStyleDeclaration('
div.stream-jvld {
border: 1px solid #ccc;
padding: 8px 8px;
border-radius: 3px;
}
');
$stream->message = '';
if ($act->content != '')
$stream->message = '<div class="stream-jvld">'.JvldPostinit::processUrlForFrontend($act->content).'</div>';
return $stream;
}
public function onSystemStart()
{
JvldPostinit::loadLanguageFile();
$toolbar = CFactory::getToolbar();
$toolbar->addGroup('JVLD', JText::_("COM_JVLD_LINKS"));
$toolbar->addItem('JVLD', 'DIRECTORY', JText::_("COM_JVLD_COMMUNITY_VISIT_DIR"), JvldPostinit::getRoute('home'));
$cfg = JvldCfg::getInstance();
if (JvldPostinit::isComponentActionAllowed('core.addlink'))
{
$toolbar->addItem('JVLD', 'NEW_LISTING', JText::_("COM_JVLD_ADDLINK"), JvldPostinit::getRoute('addlink'));
}
}
}
}