/** * Generate and return various links to the entry * Link will vary depending upon action desired, such as edit, delete, etc. * * @param string $type The type of link to return * @return string */ public function link($type = '') { if (!isset($this->_base)) { if (!$this->get('question_id')) { $answer = Response::getInstance($this->get('item_id')); $this->set('question_id', $answer->get('question_id')); } $this->_base = 'index.php?option=com_answers&task=question&id=' . $this->get('question_id'); } $link = $this->_base; // If it doesn't exist or isn't published switch (strtolower($type)) { case 'edit': $link .= '&action=edit&comment=' . $this->get('id'); break; case 'delete': $link .= '&action=delete&comment=' . $this->get('id'); break; case 'reply': $link .= '&reply=' . $this->get('id') . '#c' . $this->get('id'); break; case 'report': $link = 'index.php?option=com_support&task=reportabuse&category=itemcomment&id=' . $this->get('id') . '&parent=' . $this->get('question_id'); break; case 'permalink': default: $link .= '#c' . $this->get('id'); break; } return $link; }