if ($this->bits['supportedtag']) { $supported = $rt->checkTagUsage($this->bits['supportedtag'], $resource->id); } $xtra = ''; if ($params->get('show_audience')) { include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'audience.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'audiencelevel.php'; $ra = new \Components\Resources\Tables\Audience($database); $audience = $ra->getAudience($resource->id, 0, 1, 4); $view = $this->view('_audience', 'view')->set('audience', $audience)->set('showtips', 0)->set('numlevels', 4)->set('audiencelink', $params->get('audiencelink')); $xtra .= $view->loadTemplate(); } if ($this->bits['supportedtag'] && $supported) { include_once PATH_CORE . DS . 'components' . DS . 'com_tags' . DS . 'helpers' . DS . 'handler.php'; $tag = new \Components\Tags\Tables\Tag($database); $tag->loadTag($config->get('supportedtag')); $sl = $config->get('supportedlink'); if ($sl) { $link = $sl; } else { $link = Route::url('index.php?option=com_tags&tag=' . $tag->tag); } $xtra .= '<p class="supported"><a href="' . $link . '">' . $tag->raw_tag . '</a></p>'; } if ($params->get('show_metadata')) { $view = $this->view('_metadata', 'view'); $view->option = 'com_resources'; $view->sections = $sections; $view->model = \Components\Resources\Models\Resource::getInstance($resource->id); $html .= $view->loadTemplate(); }
</dl> <?php } if ($this->model->params->get('show_audience')) { include_once PATH_CORE . DS . 'components' . DS . $this->option . DS . 'tables' . DS . 'audience.php'; include_once PATH_CORE . DS . 'components' . DS . $this->option . DS . 'tables' . DS . 'audiencelevel.php'; $ra = new \Components\Resources\Tables\Audience($database); $audience = $ra->getAudience($this->model->resource->id, $versionid = 0, $getlabels = 1, $numlevels = 4); $this->view('_audience', 'view')->set('audience', $audience)->set('showtips', 1)->set('numlevels', 4)->set('audiencelink', $this->model->params->get('audiencelink'))->display(); } if ($this->model->params->get('supportedtag')) { $rt = new \Components\Resources\Helpers\Tags($this->model->resource->id); if ($rt->checkTagUsage($this->model->params->get('supportedtag'), $this->model->resource->id)) { include_once PATH_CORE . DS . 'components' . DS . 'com_tags' . DS . 'helpers' . DS . 'handler.php'; $tag = new \Components\Tags\Tables\Tag($database); $tag->loadTag($this->model->params->get('supportedtag')); ?> <p class="supported"> <a href="<?php echo $this->model->params->get('supportedlink', Route::url('index.php?option=com_tags&tag=' . $tag->tag)); ?> "><?php echo $this->escape(stripslashes($tag->raw_tag)); ?> </a> </p> <?php } } echo $data; ?>
<p id="viewalltools"><a href="<?php echo Route::url('index.php?option=' . $this->option . '&type=' . $this->filters['type']); ?> "><?php echo Lang::txt('COM_RESOURCES_VIEW_MORE'); ?> </a></p> <div class="clear"></div> <?php if ($this->supportedtag) { $database = App::get('db'); include_once Component::path('com_tags') . DS . 'models' . DS . 'cloud.php'; $tag = new \Components\Tags\Tables\Tag($database); $tag->loadTag($this->supportedtag); if ($sl = $this->config->get('supportedlink')) { $link = $sl; } else { $link = Route::url('index.php?option=com_tags&tag=' . $tag->tag); } ?> <p class="supported"> <?php echo Lang::txt('COM_RESOURCES_WHATS_THIS'); ?> <a href="<?php echo $link; ?> "><?php echo Lang::txt('COM_RESOURCES_ABOUT_TAG', $tag->raw_tag);
Ranking is calculated from a formula comprised of <a href="<?php echo Route::url('index.php?option=' . $this->option . '&id=' . $this->publication->id . '&active=reviews'); ?> ">user reviews</a> and usage statistics. <a href="about/ranking/">Learn more ›</a> </p> <div></div> </dd> </dl> <?php } // Supported publication? $rt = new \Components\Publications\Helpers\Tags($database); $supported = $rt->checkTagUsage($this->config->get('supportedtag'), $this->publication->id); if ($supported) { $tag = new \Components\Tags\Tables\Tag($database); $tag->loadTag($this->config->get('supportedtag')); $sl = $this->config->get('supportedlink'); if ($sl) { $link = $sl; } else { $link = Route::url('index.php?option=com_tags&tag=' . $tag->tag); } echo '<p class="supported"><a href="' . $link . '">' . $tag->raw_tag . '</a></p>'; } // Show audience if ($this->params->get('show_audience')) { $ra = new \Components\Publications\Tables\Audience($database); $audience = $ra->getAudience($this->publication->id, $this->publication->version_id, $getlabels = 1, $numlevels = 4); $this->view('_audience', 'view')->set('audience', $audience)->set('showtips', true)->set('numlevels', 4)->set('audiencelink', $this->params->get('audiencelink'))->display(); } // Archive version?
/** * Get the ID of a normalized tag * * @param string $tag Normalized tag * @return mixed False if errors, integer on success */ public function get_tag_id($tag) { if (!isset($tag)) { $this->setError('get_tag_id argument missing'); return false; } $t = new \Components\Tags\Tables\Tag($this->_db); $t->loadTag($t->normalize($tag)); return $t->id; }
/** * Save a type * * @return void */ public function saveTask() { // Check for request forgeries Request::checkToken(); // Initiate extended database class $fields = Request::getVar('fields', array(), 'post', 'none', 2); $fields = array_map('trim', $fields); $row = new \Plugins\Resources\Sponsors\Tables\Sponsor($this->database); if (!$row->bind($fields)) { $this->setError($row->getError()); return $this->editTask($row); } // Check content if (!$row->check()) { $this->setError($row->getError()); return $this->editTask($row); } // Store new content if (!$row->store()) { $this->setError($row->getError()); return $this->editTask($row); } require_once PATH_CORE . DS . 'components' . DS . 'com_tags' . DS . 'tables' . DS . 'tag.php'; $t = new \Components\Tags\Tables\Tag($this->database); $t->loadTag($row->alias); if (!$t->id) { // Add new tag! $t->tag = $row->alias; $t->raw_tag = addslashes($row->title); if (!$t->store()) { $this->setError($t->getError()); } } // Redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=manage&plugin=sponsors', false), Lang::txt('PLG_RESOURCES_SPONSORS_ITEM_SAVED')); }