Hi!
I am developing a cb tab plugin. On this plugin I need to list on the backend text params that would reflect #__comprofiler_fields fields.
I am trying to find a way to get this field dynamically using:
[code:1]
<!--XML FILE-->
<url addpath="/elements">
<param name="cbfields" type="cbfields" class="JElementCbfields" default="" label="Select fields : " description="Select fields For profile completeness bar" />
</url>[/code:1]
[code:1]
//PHP CLASS
class JElementCbfields extends JElement {
var $_name = 'cbfields';
function fetchElement($name, $value, &$node, $control_name) {
$db = &JFactory::getDBO();
$query = "SELECT name, CONCAT(description,' - ','#__comprofiler.',name,' (set zero to skip field)') as description
FROM #__comprofiler_fields
WHERE published = 1
AND type IN ('text','multiselect','predefined','image')";
$db->setQuery($query);
$rows = $db->loadObjectList();
$xml = "";
foreach ( $rows as $row ) {
$xml .= "<param name=\"".$row->name."\" type=\"text\" default=\"0\" label=\"".$row->name."\" description=\"".$row->description."\" size=\"2\" />";
}
return $xml;
}
}
[/code:1]
It is a big deal that I have to give value to each field param, because I use it on my plugin.
What I need as result is something similar to the attached image.
Errors the I got on backend:
Notice: Use of undefined constant _HANDLER - assumed '_HANDLER' in /administrator/components/com_comprofiler/library/cb/cb.params.php on line 1244
Post edited by: sohoprospecting, at: 2010/07/30 01:23
Post edited by: sohoprospecting, at: 2010/07/30 01:39