function plugin(&$link, $attr = null) { global $Itemid, $mtconf; $database =& JFactory::getDBO(); # Load Parameters $params =& new JParameter($link->attribs); $params->def('show_claim', $mtconf->get('show_claim')); $owner = new JTableUser($database); $owner->load($link->user_id); if ($params->get('show_claim') == 1 && strpos(strtolower($owner->usertype), 'administrator') !== false) { $html = ''; // $html = '<img src="images/M_images/indent1.png" width="9" height="9" />'; $html .= '<a href="'; $html .= JRoute::_('index.php?option=com_mtree&task=claim&link_id=' . $link->link_id); $html .= '"'; # Insert attributes if (is_array($attr)) { // from array foreach ($attr as $key => $val) { $key = htmlspecialchars($key); $val = htmlspecialchars($val); $html .= " {$key}=\"{$val}\""; } } elseif (!is_null($attr)) { // from scalar $html .= " {$attr}"; } $html .= '>' . JText::_('Claim') . "</a>"; # Return the claim listing link return $html; } }
public function testGetRowData() { $db = JFactory::getDbo(); $db->setQuery('SELECT * FROM ' . $db->quoteName('#__users') . ' WHERE ' . $db->quoteName('id') . ' = ' . (int) 42); $arrayFromQuery = $db->loadAssoc(); $testTable = new JTableUser(self::$driver); $testTable->load(42); $arrayFromMethod = $this->object->getRowData($testTable); $this->assertEquals($arrayFromQuery, $arrayFromMethod); }