function newMessage($option, $user, $subject) { global $database, $mainframe, $my, $acl; // get available backend user groups $gid = $acl->get_group_id('Public Backend', 'ARO'); $gids = $acl->get_group_children($gid, 'ARO', 'RECURSE'); $gids = implode(',', $gids); // get list of usernames $recipients = array(mosHTML::makeOption('0', '- Select User -')); $database->setQuery("SELECT id AS value, username AS text FROM #__users" . "\n WHERE gid IN ({$gids})" . "\n ORDER BY name"); $recipients = array_merge($recipients, $database->loadObjectList()); $recipientslist = mosHTML::selectList($recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $user); HTML_messages::newMessage($option, $recipientslist, $subject); }
function newMessage($option, $user, $subject) { $db =& JFactory::getDBO(); $acl =& JFactory::getACL(); // get available backend user groups $gid = $acl->get_group_id('Public Backend', 'ARO'); $gids = $acl->get_group_children($gid, 'ARO', 'RECURSE'); JArrayHelper::toInteger($gids, array(0)); $gids = implode(',', $gids); // get list of usernames $recipients = array(JHTML::_('select.option', '0', '- ' . JText::_('Select User') . ' -')); $query = 'SELECT id AS value, username AS text FROM #__users' . ' WHERE gid IN ( ' . $gids . ' )' . ' ORDER BY name'; $db->setQuery($query); $recipients = array_merge($recipients, $db->loadObjectList()); $recipientslist = JHTML::_('select.genericlist', $recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $user); HTML_messages::newMessage($option, $recipientslist, $subject); }
function newMessage($option) { global $database, $acl; $user = intval(mosGetParam($_REQUEST, 'userid', 0)); $subject = stripslashes(strval(mosGetParam($_REQUEST, 'subject', ''))); // get available backend user groups $gid = $acl->get_group_id('Public Backend', 'ARO'); $gids = $acl->get_group_children($gid, 'ARO', 'RECURSE'); // get list of usernames $recipients = array(mosHTML::makeOption('0', '- Select User -')); mosArrayToInts($gids); $gids = 'gid=' . implode(' OR gid=', $gids); $query = "SELECT id AS value, name AS text FROM #__users" . "\n WHERE ( {$gids} )" . "\n ORDER BY name"; $database->setQuery($query); $recipients = array_merge($recipients, $database->loadObjectList()); $recipientslist = mosHTML::selectList($recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $user); HTML_messages::newMessage($option, $recipientslist, $subject); }