本文整理匯總了PHP中JAccess::getUsersByGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP JAccess::getUsersByGroup方法的具體用法?PHP JAccess::getUsersByGroup怎麽用?PHP JAccess::getUsersByGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JAccess
的用法示例。
在下文中一共展示了JAccess::getUsersByGroup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: before
/**
* Load user list.
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$config = KunenaConfig::getInstance();
if ($config->userlist_allowed && JFactory::getUser()->guest) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
}
require_once KPATH_SITE . '/models/user.php';
$this->model = new KunenaModelUser(array(), $this->input);
$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
$this->state = $this->model->getState();
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaConfig::getInstance();
$start = $this->state->get('list.start');
$limit = $this->state->get('list.limit');
// Get list of super admins to exclude or not in filter by configuration.
$filter = JAccess::getUsersByGroup(8);
$finder = new KunenaUserFinder();
$finder->filterByConfiguration($filter)->filterByName($this->state->get('list.search'));
$this->total = $finder->count();
$this->pagination = new KunenaPagination($this->total, $start, $limit);
$alias = 'ku';
$aliasList = array('id', 'name', 'username', 'email', 'block', 'registerDate', 'lastvisitDate');
if (in_array($this->state->get('list.ordering'), $aliasList)) {
$alias = 'a';
}
$this->users = $finder->order($this->state->get('list.ordering'), $this->state->get('list.direction') == 'asc' ? 1 : -1, $alias)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
}
示例2: members
public function members()
{
// Check for request forgeries.
if (!JSession::checkToken('get')) {
echo new JResponseJson(null, 'Invalid Token', true);
jexit();
}
$app = JFactory::getApplication();
$jinput = $app->input;
$groups = $jinput->get('groups', null);
if ($groups == null) {
echo new JResponseJson(null, 'No given group', true);
JFactory::getApplication()->close();
}
try {
//TODO: move this on ImcHelper so as to be used besides json
$members = array();
$groupIds = explode('-', $groups);
foreach ($groupIds as $groupId) {
$membersIds = JAccess::getUsersByGroup($groupId);
//getUsersByGroup($groupId, true) recursively
foreach ($membersIds as $userId) {
$user = JFactory::getUser($userId);
array_push($members, array('name' => $user->name, 'email' => $user->email));
}
}
echo new JResponseJson($members);
} catch (Exception $e) {
echo new JResponseJson($e);
}
}
示例3: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
// Must load admin language files
$lang = JFactory::getLanguage();
$lang->load("com_jevents", JPATH_ADMINISTRATOR);
$db = JFactory::getDBO();
$class = $node->attributes('class');
if (!$class) {
$class = "inputbox";
}
//jimport("joomla.html.html.list");
$params = JComponentHelper::getParams("com_jevents");
$db = JFactory::getDBO();
$rules = JAccess::getAssetRules("com_jevents", true);
$creatorgroups = $rules->getData();
if (strpos($name, "jevadmin") === 0) {
$action = "core.admin";
} else {
if (strpos($name, "jeveditor") === 0) {
$action = "core.edit";
} else {
if (strpos($name, "jevpublisher") === 0) {
$action = "core.edit.state";
} else {
if (strpos($name, "admin") === 0) {
$action = "core.edit.state";
} else {
$action = "core.create";
}
}
}
}
// need to merge the arrays because of stupid way Joomla checks super user permissions
//$creatorgroups = array_merge($creatorgroups["core.admin"]->getData(), $creatorgroups[$action]->getData());
// use union orf arrays sincee getData no longer has string keys in the resultant array
//$creatorgroups = $creatorgroups["core.admin"]->getData()+ $creatorgroups["core.create"]->getData();
// use union orf arrays sincee getData no longer has string keys in the resultant array
$creatorgroupsdata = $creatorgroups["core.admin"]->getData();
// take the higher permission setting
foreach ($creatorgroups[$action]->getData() as $creatorgroup => $permission) {
if ($permission) {
$creatorgroupsdata[$creatorgroup] = $permission;
}
}
$users = array(0);
foreach ($creatorgroupsdata as $creatorgroup => $permission) {
if ($permission == 1) {
$users = array_merge(JAccess::getUsersByGroup($creatorgroup, true), $users);
}
}
$sql = "SELECT id AS value, name AS text FROM #__users where id IN (" . implode(",", array_values($users)) . ") ORDER BY name asc";
$db->setQuery($sql);
$users = $db->loadObjectList();
$users2[] = JHTML::_('select.option', '0', '- ' . JText::_('SELECT_USER') . ' -');
$users2 = array_merge($users2, $users);
$users = JHTML::_('select.genericlist', $users2, $control_name . '[' . $name . ']', 'class="' . $class . '" size="1" ', 'value', 'text', $value);
return $users;
}
示例4: edit
function edit($tpl = null)
{
$document =& JFactory::getDocument();
// this already includes administrator
$livesite = JURI::base();
if (JVersion::isCompatible("1.6.0")) {
JEVHelper::stylesheet('eventsadmin16.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/');
} else {
$document->addStyleSheet($livesite . 'components/' . JEV_COM_COMPONENT . '/assets/css/eventsadmin.css');
}
$document->setTitle(JText::_('JEVENTS') . ' :: ' . JText::_('JEVENTS'));
// Set toolbar items for the page
JToolBarHelper::title(JText::_('JEV_EDIT_USER'), 'jevents');
JToolBarHelper::save("user.save");
JToolBarHelper::cancel("user.overview");
//JToolBarHelper::help( 'edit.user', true);
$option = JRequest::getCmd('option', JEV_COM_COMPONENT);
$db =& JFactory::getDBO();
$params =& JComponentHelper::getParams(JEV_COM_COMPONENT);
if (JVersion::isCompatible("1.6.0")) {
$rules = JAccess::getAssetRules("com_jevents", true);
$creatorgroups = $rules->getData();
$creatorgroups = array_merge($creatorgroups["core.admin"]->getData(), $creatorgroups["core.create"]->getData());
$users = array(0);
foreach ($creatorgroups as $creatorgroup => $permission) {
if ($permission == 1) {
$users = array_merge(JAccess::getUsersByGroup($creatorgroup, true), $users);
}
}
$sql = "SELECT * FROM #__users where id IN (" . implode(",", array_values($users)) . ") ORDER BY name asc";
$db->setQuery($sql);
$users = $db->loadObjectList();
} else {
$minaccess = $params->getValue("jevcreator_level", 19);
// get users AUTHORS and above
$sql = "SELECT * FROM #__users where gid>=" . $minaccess;
$db->setQuery($sql);
$users = $db->loadObjectList();
}
$userOptions[] = JHTML::_('select.option', '-1', 'Select User');
foreach ($users as $user) {
$userOptions[] = JHTML::_('select.option', $user->id, $user->name . " ({$user->username})");
}
$jevuser =& $this->get('user');
$userlist = JHTML::_('select.genericlist', $userOptions, 'user_id', 'class="inputbox" size="1" ', 'value', 'text', $jevuser->user_id);
JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php");
$categories = JEventsCategory::categoriesTree();
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'categories[]', 'multiple="multiple" size="15"', 'value', 'text', explode("|", $jevuser->categories));
// get calendars
$sql = "SELECT label as text, ics_id as value FROM #__jevents_icsfile where icaltype=2";
$db->setQuery($sql);
$calendars = $db->loadObjectList();
$lists['calendars'] = JHTML::_('select.genericlist', $calendars, 'calendars[]', 'multiple="multiple" size="15"', 'value', 'text', explode("|", $jevuser->calendars));
$this->assignRef('lists', $lists);
$this->assignRef("users", $userlist);
$this->assignRef('jevuser', $jevuser);
JHTML::_('behavior.tooltip');
}
示例5: edit
function edit($tpl = null)
{
$document = JFactory::getDocument();
// this already includes administrator
$document->setTitle(JText::_('JEVENTS') . ' :: ' . JText::_('JEVENTS'));
// Set toolbar items for the page
JToolBarHelper::title(JText::_('JEV_EDIT_USER'), 'jevents');
JToolBarHelper::save("user.save");
JToolBarHelper::cancel("user.overview");
//JToolBarHelper::help( 'edit.user', true);
$option = JRequest::getCmd('option', JEV_COM_COMPONENT);
$db = JFactory::getDBO();
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$rules = JAccess::getAssetRules("com_jevents", true);
$data = $rules->getData();
$creatorgroups = $data["core.create"]->getData();
foreach ($data["core.admin"]->getData() as $creatorgroup => $permission) {
if ($permission == 1) {
$creatorgroups[$creatorgroup] = $permission;
}
}
// array_merge does a re-indexing !!
//$creatorgroups = array_merge($creatorgroups["core.admin"]->getData(), $creatorgroups["core.create"]->getData());
$users = array(0);
foreach ($creatorgroups as $creatorgroup => $permission) {
if ($permission == 1) {
$users = array_merge(JAccess::getUsersByGroup($creatorgroup, true), $users);
}
}
$sql = "SELECT * FROM #__users where id IN (" . implode(",", array_values($users)) . ") ORDER BY name asc";
$db->setQuery($sql);
$users = $db->loadObjectList();
$userOptions[] = JHTML::_('select.option', '-1', JText::_('SELECT_USER'));
foreach ($users as $user) {
$userOptions[] = JHTML::_('select.option', $user->id, $user->name . " ({$user->username})");
}
$jevuser = $this->get('user');
$userlist = JHTML::_('select.genericlist', $userOptions, 'user_id', 'class="inputbox" size="1" ', 'value', 'text', $jevuser->user_id);
JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php");
$categories = JEventsCategory::categoriesTree();
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'categories[]', 'multiple="multiple" size="15"', 'value', 'text', explode("|", $jevuser->categories));
// get calendars
$sql = "SELECT label as text, ics_id as value FROM #__jevents_icsfile where icaltype=2";
$db->setQuery($sql);
$calendars = $db->loadObjectList();
$lists['calendars'] = JHTML::_('select.genericlist', $calendars, 'calendars[]', 'multiple="multiple" size="15"', 'value', 'text', explode("|", $jevuser->calendars));
$this->assignRef('lists', $lists);
$this->assignRef("users", $userlist);
$this->assignRef('jevuser', $jevuser);
JHTML::_('behavior.tooltip');
if (JevJoomlaVersion::isCompatible("3.0")) {
$this->setLayout("edit");
} else {
$this->setLayout("edit16");
}
}
示例6: getOptions
public function getOptions()
{
$params = JComponentHelper::getParams("com_jevents");
$db = JFactory::getDBO();
$rules = JAccess::getAssetRules("com_jevents", true);
$creatorgroups = $rules->getData();
if (strpos($this->name, "jevadmin") === 0) {
$action = "core.admin";
} else {
if (strpos($this->name, "jeveditor") === 0) {
$action = "core.edit";
} else {
if (strpos($this->name, "jevpublisher") === 0) {
$action = "core.edit.state";
} else {
if (strpos($this->name, "admin") === 0) {
$action = "core.edit.state";
} else {
$action = "core.create";
}
}
}
}
// need to merge the arrays because of stupid way Joomla checks super user permissions
//$creatorgroups = array_merge($creatorgroups["core.admin"]->getData(), $creatorgroups[$action]->getData());
// use union orf arrays sincee getData no longer has string keys in the resultant array
//$creatorgroups = $creatorgroups["core.admin"]->getData()+ $creatorgroups["core.create"]->getData();
// use union orf arrays sincee getData no longer has string keys in the resultant array
$creatorgroupsdata = $creatorgroups["core.admin"]->getData();
// take the higher permission setting
foreach ($creatorgroups[$action]->getData() as $creatorgroup => $permission) {
if ($permission) {
$creatorgroupsdata[$creatorgroup] = $permission;
}
}
$users = array(0);
foreach ($creatorgroupsdata as $creatorgroup => $permission) {
if ($permission == 1) {
$users = array_merge(JAccess::getUsersByGroup($creatorgroup, true), $users);
}
}
$sql = "SELECT id AS value, name AS text , sendEmail FROM #__users where id IN (" . implode(",", array_values($users)) . ") ORDER BY name asc";
$db->setQuery($sql);
$users = $db->loadObjectList();
$nulluser = new stdClass();
$nulluser->value = 0;
$nulluser->sendEmail = 0;
$nulluser->text = JText::_("SELECT_ADMIN");
array_unshift($users, $nulluser);
return $users;
}
示例7: _sendOrderConfirmationMail
/**
* @param EventgalleryLibraryOrder $order
*
* @return mixed|string
*/
protected function _sendOrderConfirmationMail($order)
{
$config = JFactory::getConfig();
$params = JComponentHelper::getParams('com_eventgallery');
$sitename = $config->get('sitename');
$view = $this->getView('Mail', 'html', 'EventgalleryView', array('layout' => 'confirm'));
$view->set('order', $order);
$view->set('params', $params);
$body = $view->loadTemplate();
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$subject = JText::sprintf('COM_EVENTGALLERY_CART_CHECKOUT_ORDER_MAIL_CONFIRMATION_SUBJECT', $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName(), $order->getLineItemsTotalCount(), $order->getLineItemsCount());
$mailer->setSubject("{$sitename} - " . $subject);
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setBody($body);
// Customer Mail
$sender = array($config->get('mailfrom'), $config->get('fromname'));
$mailer->setSender($sender);
$mailer->addRecipient($order->getEMail(), $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName());
$send = $mailer->Send();
if ($send !== true) {
return $mailer->ErrorInfo;
}
// Admin Mail
$mailer->ClearAllRecipients();
$sender = array($order->getEMail(), $order->getBillingAddress()->getFirstName() . ' ' . $order->getBillingAddress()->getLastName());
$mailer->setSender($sender);
$userids = JAccess::getUsersByGroup($params->get('admin_usergroup'));
foreach ($userids as $userid) {
$user = JUser::getInstance($userid);
if ($user->sendEmail == 1) {
$mailadresses = JMailHelper::cleanAddress($user->email);
$mailer->addRecipient($mailadresses);
}
}
$send = $mailer->Send();
if ($send !== true) {
return $mailer->ErrorInfo;
}
return $send;
}
示例8: getAdminUsers
public static function getAdminUsers()
{
if (!is_array(self::$users)) {
self::$users = array();
if ($groups = self::getAdminGroups()) {
$ids = array();
foreach ($groups as $group) {
$ids = array_merge($ids, JAccess::getUsersByGroup($group, true));
}
$ids = array_unique($ids);
if ($ids) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('u.*')->from('#__users u')->where('u.id IN (' . implode(',', $ids) . ')')->order('u.username ASC');
$db->setQuery($query);
self::$users = $db->loadObjectList();
}
}
}
return self::$users;
}
示例9: notificationManagerEmail
function notificationManagerEmail($eventid, $title, $menuid, $u_id)
{
// Load iCagenda Global Options
$iCparams = JComponentHelper::getParams('com_icagenda');
// Load Joomla Config
$config = JFactory::getConfig();
// Get the site name
if (version_compare(JVERSION, '3.0', 'ge')) {
$sitename = $config->get('sitename');
} else {
$sitename = $config->getValue('config.sitename');
}
// Get Global Joomla Contact Infos
if (version_compare(JVERSION, '3.0', 'ge')) {
$mailfrom = $config->get('mailfrom');
$fromname = $config->get('fromname');
} else {
$mailfrom = $config->getValue('config.mailfrom');
$fromname = $config->getValue('config.fromname');
}
$siteURL = JURI::base();
$siteURL = rtrim($siteURL, '/');
//$iCmenuitem=$params->get('iCmenuitem');
$iCmenuitem = false;
// Itemid Request (automatic detection of the first iCagenda menu-link, by menuID, and depending of current language)
if (version_compare(JVERSION, '3.0', 'ge')) {
$langdefault = $config->get('language');
} else {
$langdefault = $config->getValue('config.language');
}
$langFrontend = $langdefault;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id AS idm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '{$langFrontend}')");
$db->setQuery($query);
$idm = $db->loadResult();
$mItemid = $idm;
if ($mItemid == NULL) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id AS noidm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '*')");
$db->setQuery($query);
$noidm = $db->loadResult();
}
$nolink = '';
if ($noidm == NULL && $mItemid == NULL) {
$nolink = 1;
}
if (is_numeric($iCmenuitem)) {
$lien = $iCmenuitem;
} else {
if ($mItemid == NULL) {
$lien = $noidm;
} else {
$lien = $mItemid;
}
}
// Set Notification Email to each User groups allowed to approve event submitted
$groupid = $iCparams->get('approvalGroups', array("8"));
// Load Global Option for Autologin
$autologin = $iCparams->get('auto_login', 1);
jimport('joomla.access.access');
$adminUsersArray = array();
foreach ($groupid as $gp) {
$adminUsers = JAccess::getUsersByGroup($gp, False);
// if($adminUsers->block == '0' && empty($adminUsers->activation)){
// if($adminUsers->block == '0'){
$adminUsersArray = array_merge($adminUsersArray, $adminUsers);
// } else {
// $adminUsersArray = JAccess::getUsersByGroup(8, False);
// }
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
if ($u_id == NULL) {
$u_id = 0;
}
if (!in_array($u_id, $adminUsersArray)) {
$matches = implode(',', $adminUsersArray);
$query->select('ui.username AS username, ui.email AS email, ui.password AS passw, ui.block AS block, ui.activation AS activation')->from('#__users AS ui')->where("ui.id IN ({$matches}) ");
} else {
$matches = $u_id;
$query->select('ui.username AS username, ui.email AS email, ui.password AS passw, ui.block AS block, ui.activation AS activation')->from('#__users AS ui')->where("ui.id = {$matches} ");
}
$db->setQuery($query);
$managers = $db->loadObjectList();
foreach ($managers as $manager) {
if (!in_array($u_id, $adminUsersArray)) {
$type = 'approval';
} else {
$type = 'confirmation';
}
// Create Admin Mailer
$adminmailer = JFactory::getMailer();
// Set Sender of Notification Email
$adminmailer->setSender(array($mailfrom, $fromname));
$username = $manager->username;
$passw = $manager->passw;
$email = $manager->email;
// Set Recipient of Notification Email
//.........這裏部分代碼省略.........
示例10: getSAUsersIds
function getSAUsersIds()
{
$db = DBHelper::db();
$query = 'SELECT a.`id`, a.`title`';
$query .= ' FROM `#__usergroups` AS a';
$query .= ' LEFT JOIN `#__usergroups` AS b ON a.lft > b.lft AND a.rgt < b.rgt';
$query .= ' GROUP BY a.id';
$query .= ' ORDER BY a.lft ASC';
$db->setQuery($query);
$result = $db->loadObjectList();
$saGroup = array();
foreach ($result as $group) {
if (JAccess::checkGroup($group->id, 'core.admin')) {
$saGroup[] = $group;
}
}
//now we got all the SA groups. Time to get the users
$saUsers = array();
if (count($saGroup) > 0) {
foreach ($saGroup as $sag) {
$userArr = JAccess::getUsersByGroup($sag->id);
if (count($userArr) > 0) {
foreach ($userArr as $user) {
$saUsers[] = $user;
}
}
}
}
return $saUsers;
}
示例11: saveEvent
//.........這裏部分代碼省略.........
}
if (!$rect->store()) {
throw new Exception($rect->getError(), 42);
}
} else {
// Insert date into recurring table
// Add recurring date
MatukioHelperRecurring::saveRecurringDateForEvent($row);
}
}
// Trigger plugin event
$results = $dispatcher->trigger('onAfterSaveRecurring', $row);
}
// Ausgabe der Kurse
$fehlerzahl = array_unique($fehler);
if (count($fehlerzahl) > 1) {
$fehler = array_unique($fehler);
if ($fehler[0] == "") {
$fehler = array_slice($fehler, 1);
}
$fehler = implode("<br />", $fehler);
JFactory::getApplication()->enqueueMessage($fehler, 'Warning');
}
// Notify Admin BCC of event creation
if (MatukioHelperSettings::getSettings('sendmail_operator', '') != '' && $isNew && $speichern) {
$mailer = JFactory::getMailer();
$mainframe = JFactory::getApplication();
$sender = $mainframe->getCfg('fromname');
$from = $mainframe->getCfg('mailfrom');
$user = JFactory::getUser($row->publisher);
$replyname = $user->name;
$replyto = $user->email;
$subject = JText::_("COM_MATUKIO_NEW_EVENT_CREATED");
$body = JText::_("COM_MATUKIO_NEW_EVENT_CREATED") . "\n\n";
$body .= JText::_("COM_MATUKIO_EVENT_DETAILS") . ":\n\n";
$body .= JText::_("COM_MATUKIO_TITLE") . ":\t\t" . $row->title . "\n";
$body .= JText::_("COM_MATUKIO_RECURRING_SEMNUM") . ":\t\t" . $row->semnum . "\n";
$body .= JText::_("COM_MATUKIO_BEGIN") . ":\t\t" . $row->begin . "\n";
$body .= JText::_("COM_MATUKIO_END") . ":\t\t" . $row->end . "\n";
$body .= JText::_("COM_MATUKIO_EVENT_DEFAULT_PLACE") . ":\t\t" . $row->place . "\n";
$body .= JText::_("COM_MATUKIO_EVENT_DEFAULT_SHORT_DESCRIPTION") . ":\t\t" . $row->shortdesc . "\n";
$body .= JText::_("COM_MATUKIO_PUBLISHER") . ":\t\t" . $user->name . "\n";
$success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null, $replyto, $replyname);
}
// Send an notification email to all users with new event details @since 4.3.0
if (MatukioHelperSettings::getSettings('sendmail_newevent', 1) && $isNew && $speichern) {
// We send an notification of the new event to all users / user group
if (MatukioHelperSettings::_("sendmail_newevent_group", 0)) {
// Filter users to the given group if not 0 (all) given
jimport('joomla.access.access');
$ids = JAccess::getUsersByGroup(MatukioHelperSettings::_("sendmail_newevent_group", 0));
$query = "SELECT * FROM #__users WHERE block = 0 AND id IN (" . implode(",", $ids) . ")";
$db->setQuery($query);
$users = $db->loadObjectList();
} else {
// Get all users
$query = "SELECT * FROM #__users WHERE block = 0";
$db->setQuery($query);
$users = $db->loadObjectList();
}
$mailer = JFactory::getMailer();
// Set an empty category here - TODO query it from #__category table
$row->category = "";
$tmpl = MatukioHelperTemplates::getEmailBody("mail_newevent", $row, null);
// Use HTML or text E-Mail
if (MatukioHelperSettings::getSettings('email_html', 1)) {
// Start html output
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
$body .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
$body .= "<head>\n";
$body .= "</head>\n";
$body .= "<body>\n";
$body .= $tmpl->value;
$body .= "</body>\n</html>";
} else {
$body = $tmpl->value_text;
}
$subject = $tmpl->subject;
$mainframe = JFactory::getApplication();
$sender = $mainframe->getCfg('fromname');
$from = $mainframe->getCfg('mailfrom');
// Loop and sent mail
foreach ($users as $u) {
$success = $mailer->sendMail($from, $sender, $u->email, $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null);
$mailer->ClearAllRecipients();
}
// E-Mail to Admin / Operator etc.
if (MatukioHelperSettings::getSettings('sendmail_operator', '') != "") {
$success = $mailer->sendMail($from, $sender, explode(",", MatukioHelperSettings::getSettings('sendmail_operator', '')), $subject, $body, MatukioHelperSettings::getSettings('email_html', 1), null, null, null);
$mailer->ClearAllRecipients();
}
}
$obj = new StdClass();
$obj->id = $row->id;
$obj->error = $row->fehler;
$obj->error_count = count($fehlerzahl);
$obj->saved = $speichern;
$obj->event = $row;
return $obj;
}
示例12: count_Events
/**
*
* ALL EVENTS DISPLAY
*
*/
public function count_Events()
{
// Get Params Menu
$app = JFactory::getApplication();
$iCmenuParams = $app->getParams();
// Get Data
$db = Jfactory::getDbo();
$query = $db->getQuery(true);
$query->select('count(e.id) AS nbevents')->from('#__icagenda_events AS e');
// Adding Filter if State Published
$where = "(e.state = 1)";
// Adding Filter per Category in Navigation
$mcatid = $iCmenuParams->get('mcatid');
if (is_array($mcatid)) {
$selcat = implode(', ', $mcatid);
if (!in_array('0', $mcatid)) {
$where .= " AND (e.catid IN ({$selcat}))";
}
}
// UTC datetime is converted in joomla config time zone
// Get a date object based on UTC.
$config = JFactory::getConfig();
if (version_compare(JVERSION, '3.0', 'ge')) {
$offset = $config->get('offset');
} else {
$offset = $config->getValue('config.offset');
}
$joomlaTZ_datetime = JFactory::getDate('now', $offset);
$joomlaTZ_date = date('Y-m-d', strtotime($joomlaTZ_datetime));
// Adding Filter per Time in Navigation
$filter_time = $iCmenuParams->get('time');
// if($filter_time==1) $where.=' AND e.next >= (CURDATE())';
// if($filter_time==2) $where.=' AND e.next < (CURDATE())';
// if($filter_time==3) $where.=' AND e.next >= (NOW())';
// if($filter_time==4) $where.=' AND (e.next >= (CURDATE()) AND (e.next < (CURDATE() + INTERVAL 1 DAY)))';
if ($filter_time == 1) {
$where .= ' AND ' . $db->qn('e.next') . ' >= ' . $db->q($joomlaTZ_date) . '';
}
// COM_ICAGENDA_OPTION_TODAY_AND_UPCOMING
if ($filter_time == 2) {
$where .= ' AND ' . $db->qn('e.next') . ' < ' . $db->q($joomlaTZ_date) . '';
}
// COM_ICAGENDA_OPTION_PAST
if ($filter_time == 3) {
$where .= ' AND ' . $db->qn('e.next') . ' > ' . $db->q($joomlaTZ_datetime) . '';
}
// COM_ICAGENDA_OPTION_FUTURE
if ($filter_time == 4) {
$where .= ' AND (' . $db->qn('e.next') . ' >= ' . $db->q($joomlaTZ_date) . '';
$where .= ' AND (' . $db->qn('e.next') . ' < (' . $db->q($joomlaTZ_date) . ' + INTERVAL 1 DAY)))';
}
// Language Control
$lang = JFactory::getLanguage();
$langcur = $lang->getTag();
$langcurrent = $langcur;
$where .= " AND ((e.language = '{$langcurrent}') OR (e.language = '*') OR (e.language = NULL) OR (e.language = ''))";
// Access Control
$user = JFactory::getUser();
$userID = $user->id;
$userLevels = $user->getAuthorisedViewLevels();
if (version_compare(JVERSION, '3.0', 'lt')) {
$userGroups = $user->getAuthorisedGroups();
} else {
$userGroups = $user->groups;
}
$groupid = JComponentHelper::getParams('com_icagenda')->get('approvalGroups', array("8"));
jimport('joomla.access.access');
$adminUsersArray = array();
foreach ($groupid as $gp) {
$adminUsers = JAccess::getUsersByGroup($gp, False);
$adminUsersArray = array_merge($adminUsersArray, $adminUsers);
}
// Test if user has Access Permissions
if (!in_array('8', $userGroups)) {
$useraccess = implode(', ', $userLevels);
$where .= ' AND e.access IN (' . $useraccess . ')';
}
// Test if user logged-in has Approval Rights
if (!in_array($userID, $adminUsersArray) and !in_array('8', $userGroups)) {
$where .= ' AND e.approval <> 1';
} else {
$where .= ' AND e.approval < 2';
}
$query->where($where);
$db->setQuery($query);
$result = $db->loadObject()->nbevents;
return $result;
}
示例13: get_admin_emails
public function get_admin_emails($groupId)
{
if (!$groupId) {
return false;
}
$userids = JAccess::getUsersByGroup($groupId);
if (empty($userids)) {
return false;
}
$query = 'select email from #__users where id in (' . implode(',', $userids) . ')';
$this->_db->setQuery($query);
$users = $this->_db->loadColumn();
return $users;
}
示例14: onContentAfterSave
public function onContentAfterSave($context, &$article, $isNew)
{
$ruleID = $article->id;
$ruleState = $article->state;
$jgroup_id = $article->jgroup_id;
$jsgroup_id = $article->jsgroup_id;
//if the sync rule is disabled, take no action and exit
if (!$ruleState) {
return true;
}
//if we are not in the right context, exit
if (!in_array($context, array('com_jomsocialgroupsync.synchronizationrule', 'com_jomsocialgroupsync.synchronizationrules'))) {
return true;
}
//include Joomla files
jimport('joomla.user.helper');
jimport('joomla.access.access');
// Instantiate JomSocial
require_once JPATH_ROOT . '/administrator/components/com_community/defines.php';
require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
//update Joomla groups
$model = CFactory::getModel('Groups');
$members = $model->getMembers($jsgroup_id);
foreach ($members as $member) {
//add to Joomla group
JUserHelper::addUserToGroup($member->id, $jgroup_id);
}
// update JomSocial groups
$group =& JTable::getInstance('Group', 'CTable');
$data = new stdClass();
$data->approved = 1;
$data->permissions = 0;
$data->groupid = $jsgroup_id;
$jGroupUsers = JAccess::getUsersByGroup($jgroup_id);
foreach ($jGroupUsers as $userid) {
//add to JomSocial group
$data->memberid = $userid;
if (!$model->isMember($data->memberid, $data->groupid)) {
$group->addMember($data);
}
}
return true;
}
示例15: notificationNewEvent
function notificationNewEvent($eventid, $title, $description, $venue, $date, $image, $new_event)
{
// Load iCagenda Global Options
$iCparams = JComponentHelper::getParams('com_icagenda');
// Load Joomla Config
$config = JFactory::getConfig();
if (version_compare(JVERSION, '3.0', 'ge')) {
// Get the site name
$sitename = $config->get('sitename');
// Get Global Joomla Contact Infos
$mailfrom = $config->get('mailfrom');
$fromname = $config->get('fromname');
// Get default language
$langdefault = $config->get('language');
} else {
// Get the site name
$sitename = $config->getValue('config.sitename');
// Get Global Joomla Contact Infos
$mailfrom = $config->getValue('config.mailfrom');
$fromname = $config->getValue('config.fromname');
// Get default language
$langdefault = $config->getValue('config.language');
}
$siteURL = JURI::base();
$siteURL = rtrim($siteURL, '/');
$iCmenuitem = false;
// Itemid Request (automatic detection of the first iCagenda menu-link, by menuID, and depending of current language)
$langFrontend = $langdefault;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id AS idm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '{$langFrontend}')");
$db->setQuery($query);
$idm = $db->loadResult();
$mItemid = $idm;
if ($mItemid == NULL) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id AS noidm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '*')");
$db->setQuery($query);
$noidm = $db->loadResult();
}
$nolink = '';
if ($noidm == NULL && $mItemid == NULL) {
$nolink = 1;
}
if (is_numeric($iCmenuitem)) {
$lien = $iCmenuitem;
} else {
if ($mItemid == NULL) {
$lien = $noidm;
} else {
$lien = $mItemid;
}
}
// Set Notification Email to each User groups allowed to receive a notification email when a new event created
$groupid = $iCparams->get('newevent_Groups', array("8"));
// Load Global Option for Autologin
// $autologin = $iCparams->get('auto_login', 1);
jimport('joomla.access.access');
$newevent_Groups_Array = array();
foreach ($groupid as $gp) {
$GroupUsers = JAccess::getUsersByGroup($gp, False);
$newevent_Groups_Array = array_merge($newevent_Groups_Array, $GroupUsers);
}
// if ($u_id == NULL) {
// $u_id = 0;
// }
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// if (!in_array($u_id, $newevent_Groups_Array)) {
// $matches = implode(',', $adminUsersArray);
// $query->select('ui.username AS username, ui.email AS email, ui.password AS passw, ui.block AS block, ui.activation AS activation')
// ->from('#__users AS ui')
// ->where( "ui.id IN ($matches) ");
// } else {
// $matches = $u_id;
$matches = implode(',', $newevent_Groups_Array);
$query->select('ui.username AS username, ui.email AS email, ui.password AS passw, ui.block AS block, ui.activation AS activation')->from('#__users AS ui')->where("ui.id IN ({$matches}) ");
// ->where( "ui.id = $matches ");
// }
$db->setQuery($query);
$users = $db->loadObjectList();
// Get all users email and group except for senders
// $db = JFactory::getDbo();
// $query = $db->getQuery(true)
// ->select('email')
// ->from('#__users');
// ->where('id != '.(int) $user->get('id'));
// if ($grp !== 0)
// {
// if (empty($to))
// {
// $query->where('0');
// } else {
// $query->where('id IN (' . implode(',', $to) . ')');
// }
// }
// if ($disabled == 0){
// $query->where("block = 0");
// }
//.........這裏部分代碼省略.........