Exemplo n.º 1
0
 public function onAfterDJClassifiedsDisplayProfile(&$profile, $params, $view)
 {
     $app = JFactory::getApplication();
     if (!$profile['id']) {
         return false;
     }
     $group_id = $this->params->get('rating_group_author', false);
     if (!$group_id) {
         return false;
     }
     require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php');
     require_once JPath::clean(JPATH_ROOT . '/administrator/components/com_djclassifieds/lib/djseo.php');
     $uid_slug = $profile['id'] . ':' . DJClassifiedsSEO::getAliasName($profile['name']);
     $name = $profile['name'] ? $profile['name'] : $profile['id'];
     $review = DJReviewsAPI::getInstance(array('group' => $group_id, 'type' => 'com_djclassifieds.author', 'name' => $name, 'link' => 'index.php?option=com_djclassifieds&view=profile&uid=' . $uid_slug, 'id' => $profile['id']));
     return $review->getFullReview();
 }
Exemplo n.º 2
0
 /**
  * Should return everything - Full rating, list of reviews and add review form
  *
  * @param object $row DJ-Catalog2 Object
  * @param JRegistry $params
  * @param int $page
  * @return boolean|Ambigous <boolean, string>
  */
 public function onAfterDJCatalog2DisplayContent(&$row, &$params, $page = 0, $context = 'item')
 {
     $app = JFactory::getApplication();
     $view = $app->input->get('view');
     if ($view != 'item') {
         return false;
     }
     $excluded_categories = $this->params->get('exclude_categories', array());
     if (in_array($row->cat_id, $excluded_categories)) {
         return false;
     }
     $excluded_products = explode(',', $this->params->get('exclude_items', ''));
     if (in_array($row->id, $excluded_products)) {
         return false;
     }
     $group_id = $this->params->get('rating_group', false);
     if (!$group_id) {
         return false;
     }
     require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php');
     require_once JPath::clean(JPATH_ROOT . '/components/com_djcatalog2/helpers/route.php');
     $review = DJReviewsAPI::getInstance(array('group' => $group_id, 'type' => 'com_djcatalog2.item', 'name' => $row->name, 'link' => DJCatalogHelperRoute::getItemRoute($row->slug, $row->catslug), 'id' => $row->id));
     return $review->getFullReview();
 }
Exemplo n.º 3
0
 /**
  * Should return everything - Full rating, list of reviews and add review form
  *
  * @param object $row DJ-Catalog2 Object
  * @param JRegistry $params
  * @param int $page
  * @return boolean|Ambigous <boolean, string>
  */
 public function onContentAfterDisplay($context, &$item, $params, $offset = 0)
 {
     if (!in_array($context, array('com_content.article', 'com_content.category', 'com_content.featured'))) {
         return false;
     }
     $app = JFactory::getApplication();
     $view = $app->input->get('view');
     if ($view != 'article' && !($view == 'featured' && $app->input->getInt('id', false))) {
         return false;
     }
     $excluded_categories = $this->params->get('exclude_categories', array());
     if (in_array($item->catid, $excluded_categories)) {
         return false;
     }
     $excluded_articles = explode(',', $this->params->get('exclude_articles', ''));
     if (in_array($item->id, $excluded_articles)) {
         return false;
     }
     $group_id = $this->params->get('rating_group', false);
     if (!$group_id) {
         return false;
     }
     require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php');
     require_once JPath::clean(JPATH_ROOT . '/components/com_content/helpers/route.php');
     $review = DJReviewsAPI::getInstance(array('group' => $group_id, 'type' => 'com_content.article', 'name' => $item->title, 'link' => ContentHelperRoute::getArticleRoute($item->id . ':' . $item->alias, $item->catid . ':' . $item->category_alias), 'id' => $item->id));
     return $review->getFullReview();
 }