Exemple #1
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     JToolbarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('user.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('user.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::divider();
         JToolbarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
         JToolbarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
         JToolbarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'users.delete');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_users');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_USERS_USER_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_users&view=users');
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_STATE'), 'filter_state', JHtml::_('select.options', UsersHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_ACTIVE'), 'filter_active', JHtml::_('select.options', UsersHelper::getActiveOptions(), 'value', 'text', $this->state->get('filter.active')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_USERGROUP'), 'filter_group_id', JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_FILTER_DATE'), 'filter_range', JHtml::_('select.options', Usershelper::getRangeOptions(), 'value', 'text', $this->state->get('filter.range')));
 }
Exemple #2
0
 public function prepareValueForDisplay($value, $field)
 {
     $value = (array) $value;
     JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php');
     $texts = array();
     foreach (UsersHelper::getGroups() as $group) {
         if (in_array($group->value, $value)) {
             $texts[] = parent::prepareValueForDisplay(trim($group->text, '- '), $field);
         }
     }
     return parent::prepareValueForDisplay($texts, $field);
 }
Exemple #3
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('user.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('user.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::divider();
         JToolbarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
         JToolbarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
         JToolbarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'users.delete');
         JToolbarHelper::divider();
     }
     // Add a batch button
     if ($canDo->get('core.edit')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">\n\t\t\t<i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\n\t\t\t{$title}</button>";
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_users');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_USERS_USER_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_users&view=users');
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_STATE'), 'filter_state', JHtml::_('select.options', UsersHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_ACTIVE'), 'filter_active', JHtml::_('select.options', UsersHelper::getActiveOptions(), 'value', 'text', $this->state->get('filter.active')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_USERGROUP'), 'filter_group_id', JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_FILTER_DATE'), 'filter_range', JHtml::_('select.options', Usershelper::getRangeOptions(), 'value', 'text', $this->state->get('filter.range')));
 }
Exemple #4
0
echo JHtml::_('select.options', UsersHelper::getActiveOptions(), 'value', 'text', $this->state->get('filter.active'));
?>
			</select>

			<label class="selectlabel" for="filter_group_id">
				<?php 
echo JText::_('COM_USERS_FILTER_USERGROUP');
?>
			</label>
			<select name="filter_group_id" id="filter_group_id">
				<option value=""><?php 
echo JText::_('COM_USERS_FILTER_USERGROUP');
?>
</option>
				<?php 
echo JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id'));
?>
			</select>

			<label class="selectlabel" for="filter_lastvisitrange">
				<?php 
echo JText::_('COM_USERS_OPTION_FILTER_LAST_VISIT_DATE');
?>
			</label>
			<select name="filter_lastvisitrange" id="filter_lastvisitrange" >
				<option value=""><?php 
echo JText::_('COM_USERS_OPTION_FILTER_LAST_VISIT_DATE');
?>
</option>
				<?php 
echo JHtml::_('select.options', Usershelper::getRangeOptions(), 'value', 'text', $this->state->get('filter.lastvisitrange'));
Exemple #5
0
                            <div class="row-fluid">
                                <div class="control-group">
                                    <label class="control-label" for="teacher_group"><?php 
    echo JText::_('GURU_TEACHER_DEFAULT_GROUP');
    ?>
:		
                                  </label>
                                  <div class="controls">
                                    <?php 
    $db = JFactory::getDBO();
    $user = JFactory::getUser();
    $user_id = $user->id;
    $sql_u = "select group_id from #__user_usergroup_map where user_id=" . intval($user_id);
    $db->setQuery($sql_u);
    $res_user_current = $db->loadResult();
    $listgroup = UsersHelper::getGroups();
    ?>
                                        <select id="teacher_group" name="teacher_group"  class="inputbox" size="10">
                                        <?php 
    if ($res_user_current == 8) {
        echo JHtml::_('select.options', $listgroup, 'value', 'text', $config_author->teacher_group);
    } else {
        echo str_replace("- Super Users", "", JHtml::_('select.options', $listgroup, 'value', 'text', $config_author->teacher_group));
    }
    ?>
                                        </select>
                                        <span class="editlinktip hasTip" title="<?php 
    echo JText::_("GURU_TEACHER_DEFAULT_GROUP2");
    ?>
" >
                                            <img border="0" src="components/com_guru/images/icons/tooltip.png">
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $model =& $this->getModel('sync');
     $layout = JRequest::getVar('layout', 'default');
     if ($layout == 'default') {
         $db =& JFactory::getDBO();
         $filter_order = $mainframe->getUserStateFromRequest("{$option}.filter_order", 'filter_order', 'a.name', 'cmd');
         $filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.filter_order_Dir", 'filter_order_Dir', '', 'word');
         $filter_type = $mainframe->getUserStateFromRequest("{$option}.filter_type", 'filter_type', 0, 'string');
         $filter_status = $mainframe->getUserStateFromRequest("{$option}.filter_status", 'filter_status', 0, 'string');
         $filter_logged = $mainframe->getUserStateFromRequest("{$option}.filter_logged", 'filter_logged', 0, 'int');
         $filter_date = $mainframe->getUserStateFromRequest("{$option}.filter_date", 'filter_date', '', 'string');
         $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
         $search = JString::strtolower($search);
         $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
         $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
         $where = array();
         if (isset($search) && $search != '') {
             $searchEscaped = $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
             $where[] = 'a.username LIKE ' . $searchEscaped . ' OR a.email LIKE ' . $searchEscaped . ' OR a.name LIKE ' . $searchEscaped;
         }
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             if ($filter_type) {
                 if ($filter_type == 1) {
                     $where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' ';
                 } else {
                     if ($filter_type == 'Public Backend') {
                         $where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' ';
                     } else {
                         $where[] = ' um.group_id = ' . $db->Quote($filter_type) . ' ';
                     }
                 }
             }
         } else {
             if ($filter_type) {
                 if ($filter_type == 'Public Frontend') {
                     $where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' ';
                 } else {
                     if ($filter_type == 'Public Backend') {
                         $where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' ';
                     } else {
                         $where[] = 'a.usertype = LOWER( ' . $db->Quote($filter_type) . ' ) ';
                     }
                 }
             }
         }
         $where[] = ' a.block = 0 ';
         $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
         $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = 'SELECT COUNT(a.id)' . ' FROM #__users AS a' . ' INNER JOIN #__user_usergroup_map AS um ON um.user_id = a.id' . ' INNER JOIN #__usergroups AS ug ON ug.id = um.group_id' . $where;
         } else {
             $query = 'SELECT COUNT(a.id)' . ' FROM #__users AS a' . $where;
         }
         $db->setQuery($query);
         $total = $db->loadResult();
         jimport('joomla.html.pagination');
         $pagination = new JPagination($total, $limitstart, $limit);
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = 'SELECT a.*, ug.title AS groupname' . ' FROM #__users AS a' . ' INNER JOIN #__user_usergroup_map AS um ON um.user_id = a.id' . ' INNER JOIN #__usergroups AS ug ON ug.id = um.group_id' . $where . ' GROUP BY a.id' . $orderby;
         } else {
             $query = 'SELECT a.*, g.name AS groupname' . ' FROM #__users AS a' . ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id' . ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' . ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id' . $where . ' GROUP BY a.id' . $orderby;
         }
         $db->setQuery($query, $pagination->limitstart, $pagination->limit);
         $rows = $db->loadObjectList();
         // get list of Groups for dropdown filter
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             // Include the component HTML helpers.
             require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
             $dropdown = '<select name="filter_type" id="filter_type" class="inputbox" onchange="this.form.submit()">';
             $dropdown .= '<option value="">- ' . JText::_('JM_USERGROUP') . ' -</option>';
             $dropdown .= JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $filter_type);
             $dropdown .= '</select>';
             $lists['type'] = $dropdown;
         } else {
             $query = 'SELECT name AS value, name AS text' . ' FROM #__core_acl_aro_groups' . ' WHERE name != "ROOT"' . ' AND name != "USERS"';
             $db->setQuery($query);
             $types[] = JHtml::_('select.option', '0', '- ' . JText::_('JM_USERGROUP') . ' -');
             foreach ($db->loadObjectList() as $obj) {
                 $types[] = JHtml::_('select.option', $obj->value, JText::_($obj->text));
             }
             $lists['type'] = JHtml::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "{$filter_type}");
         }
         // table ordering
         $lists['order_Dir'] = $filter_order_Dir;
         $lists['order'] = $filter_order;
         // search filter
         $lists['search'] = $search;
         //date filter
         if ($filter_date == '') {
             $filter_date = JText::_('JM_LAST_VISIT_AFTER');
         }
         JHtml::_('behavior.calendar');
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $attr = array('size' => '16', 'style' => 'top:0;');
         } else {
             $attr = array('size' => '16', 'style' => 'top:0;', 'readonly' => 'readonly', 'onclick' => "showCalendar('filter_date', '%Y-%m-%d')");
         }
         $lists['filter_date'] = JHtml::_('calendar', $filter_date, 'filter_date', 'filter_date', '%Y-%m-%d', $attr);
         $this->assignRef('lists', $lists);
         $this->assignRef('pagination', $pagination);
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_ADD_USERS'), 'MC_logo_48.png');
     } else {
         if ($layout == 'sugar') {
             JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUGARCRM_CONFIGURATION'), 'MC_logo_48.png');
         } else {
             if ($layout == 'highrise') {
                 JToolBarHelper::title(JText::_('JM_NEWSLETTER_HIGHRISE_CONFIGURATION'), 'MC_logo_48.png');
             }
         }
     }
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if ($MCapi && $MCauth->MCauth()) {
         if ($layout == 'default') {
             if ($params->get($paramsPrefix . 'sugar_name') && $params->get($paramsPrefix . 'sugar_pwd')) {
                 JToolBarHelper::custom('sync_sugar', 'sync_sugar', 'sync_sugar', 'JM_ADD_TO_SUGAR', false, false);
                 JToolBarHelper::spacer();
                 JToolBarHelper::custom('sugar', 'sync_sugar', 'sync_sugar', 'JM_SUGAR_CONFIG', false, false);
                 JToolBarHelper::spacer();
             }
             if ($params->get($paramsPrefix . 'highrise_url') && $params->get($paramsPrefix . 'highrise_api_token')) {
                 JToolBarHelper::custom('sync_highrise', 'sync_highrise', 'sync_highrise', 'JM_ADD_TO_HIGHRISE', false, false);
                 JToolBarHelper::spacer();
                 JToolBarHelper::custom('highrise', 'sync_highrise', 'sync_highrise', 'JM_HIGHRISE_CONFIG', false, false);
                 JToolBarHelper::spacer();
             }
             JToolBarHelper::custom('mailchimp', 'sync', 'sync', 'JM_ADD_TO_MAILCHIMP', false, false);
             JToolBarHelper::spacer();
         } else {
             if ($layout == 'sugar') {
                 JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                 JToolBarHelper::spacer();
                 JToolBarHelper::custom('setConfig', 'sync_sugar', 'sync_sugar', 'JM_SAVE_CONFIG', false, false);
                 JToolBarHelper::spacer();
             } else {
                 if ($layout == 'highrise') {
                     JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                     JToolBarHelper::spacer();
                     JToolBarHelper::custom('setConfig', 'sync_highrise', 'sync_highrise', 'JM_SAVE_CONFIG', false, false);
                     JToolBarHelper::spacer();
                 }
             }
         }
     }
     if ($layout == 'default') {
         // Get data from the model
         $items =& $this->get('Data');
         $this->assignRef('items', $items);
         $subscriberLists =& $this->get('SubscriberLists');
         $this->assignRef('subscriberLists', $subscriberLists);
         $suppressed =& $this->get('Suppressed');
         $this->assignRef('suppressed', $suppressed);
         $groups =& $this->get('Groups');
         $this->assignRef('groups', $groups);
         $CRMusers =& $this->get('CRMusers');
         $this->assignRef('CRMusers', $CRMusers);
     } else {
         if ($layout == 'sugar') {
             $sugarFields =& $this->get('SugarFields');
             $this->assignRef('sugarFields', $sugarFields);
             $JSFields =& $this->get('JSFields');
             $this->assignRef('JSFields', $JSFields);
             $CBFields =& $this->get('CBFields');
             $this->assignRef('CBFields', $CBFields);
             $config =& $model->getConfig('sugar');
             $this->assignRef('config', $config);
         } else {
             if ($layout == 'highrise') {
                 $JSFields =& $this->get('JSFields');
                 $this->assignRef('JSFields', $JSFields);
                 $CBFields =& $this->get('CBFields');
                 $this->assignRef('CBFields', $CBFields);
                 $config =& $model->getConfig('highrise');
                 $this->assignRef('config', $config);
             }
         }
     }
     $total =& $this->get('TotalUsers');
     $this->assignRef('total', $total);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Exemple #7
0
 public function getGroups()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
     return UsersHelper::getGroups();
 }
Exemple #8
0
 function getAuthorDetails()
 {
     $db = JFactory::getDBO();
     $author_id = "";
     $id_val = JRequest::getVar("cid", "", "post", "array");
     if (is_array($id_val) && count($id_val) > 0 && $id_val["0"] != "") {
         $cids = JRequest::getVar("cid", "", "post", "array");
         $author_id = $cids[0];
     } else {
         $author_id = JRequest::getVar("id", "0", "", "int");
     }
     $type = JRequest::getVar("author_type", "1");
     $result = new StdClass();
     if ($author_id > 0) {
         if ($this->existAuthor($author_id)) {
             $sql = "select u.*,a.id as lmsid,a.* from #__users u, #__guru_authors a where u.id=a.userid and a.userid=" . $author_id;
         } else {
             $sql = "select * from #__users u where id=" . $author_id;
         }
         $db->setQuery($sql);
         $db->query();
         $result = $db->loadObject();
         $result->userid = $author_id;
         if (!isset($result->lmsid)) {
             $result->id = 0;
         } else {
             $result->id = $result->lmsid;
         }
     } else {
         $get = JRequest::get();
         foreach ($get as $key => $val) {
             $result->{$key} = $val;
         }
     }
     $result->type = $type;
     if (!isset($result->id)) {
         $result->id = 0;
     }
     $result->userid = $author_id;
     if (!isset($result->username)) {
         $result->usernam = "";
     }
     if (!isset($result->name)) {
         $result->name = "";
     }
     if (!isset($result->email)) {
         $result->email = "";
     }
     if (!isset($result->author_title)) {
         $result->author_title = "";
     }
     if (!isset($result->website) || $result->website == "") {
         $result->website = "http://";
     }
     if (!isset($result->blog) || $result->blog == "") {
         $result->blog = "http://";
     }
     if (!isset($result->facebook) || $result->facebook == "") {
         $result->facebook = "http://";
     }
     if (!isset($result->twitter) || $result->twitter == "") {
         $result->twitter = "";
     }
     //show/hide drop-down options
     $show_options = array();
     $show_options[] = JHTML::_('select.option', '1', JText::_('GURU_SHOW'));
     $show_options[] = JHTML::_('select.option', '0', JText::_('GURU_HIDE'));
     if (!isset($result->show_email)) {
         $result->show_email = 1;
     }
     $result->lists['show_email'] = JHTML::_('select.genericlist', $show_options, 'show_email', null, 'value', 'text', $result->show_email);
     if (!isset($result->show_website)) {
         $result->show_website = 1;
     }
     $result->lists['show_website'] = JHTML::_('select.genericlist', $show_options, 'show_website', null, 'value', 'text', $result->show_website);
     if (!isset($result->show_blog)) {
         $result->show_blog = 1;
     }
     $result->lists['show_blog'] = JHTML::_('select.genericlist', $show_options, 'show_blog', null, 'value', 'text', $result->show_blog);
     if (!isset($result->show_facebook)) {
         $result->show_facebook = 1;
     }
     $result->lists['show_facebook'] = JHTML::_('select.genericlist', $show_options, 'show_facebook', null, 'value', 'text', $result->show_facebook);
     if (!isset($result->show_twitter)) {
         $result->show_twitter = 1;
     }
     $result->lists['show_twitter'] = JHTML::_('select.genericlist', $show_options, 'show_twitter', null, 'value', 'text', $result->show_twitter);
     $id_a = JRequest::getVar("id", "0", "", "int");
     if (!isset($result->gid) && (isset($id_a) && $id_a != "")) {
         $query = "select group_id from #__user_usergroup_map where user_id='" . $id_a . "'";
         $db->setQuery($query);
         $res = $db->loadResult();
         if (isset($res) && $res != "") {
             $result->gid = $res;
         } else {
             $result->gid = "";
         }
     } elseif (!isset($result->gid)) {
         $result->gid = "";
     }
     $user = JFactory::getUser();
     $user_id = $user->id;
     $sql_u = "select group_id from #__user_usergroup_map where user_id=" . intval($user_id);
     $db->setQuery($sql_u);
     $res_user_current = $db->loadResult();
     $result->lists['gid'] = '<select name="gid" id="gid" class="inputbox" size="10" >';
     if ($res_user_current == 8) {
         $result->lists['gid'] .= JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $result->gid);
     } else {
         $result->lists['gid'] .= str_replace("- Super Users", "", JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $result->gid));
     }
     $result->lists['gid'] .= '</select>';
     if (!isset($result->images) || $result->images == "") {
         $result->images = "";
     }
     if (!isset($result->usertype)) {
         $result->usertype = 0;
     }
     if (!isset($result->full_bio)) {
         $result->full_bio = "";
     }
     return $result;
 }
Exemple #9
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = UsersHelper::getActions();
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('user.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('user.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::divider();
         JToolbarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
         JToolbarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
         JToolbarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'users.delete');
         JToolbarHelper::divider();
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_users') && $user->authorise('core.edit', 'com_users') && $user->authorise('core.edit.state', 'com_users')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         // Instantiate a new JLayoutFile instance and render the batch button
         $layout = new JLayoutFile('joomla.toolbar.batch');
         $dhtml = $layout->render(array('title' => $title));
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_users');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_USERS_USER_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_users&view=users');
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_STATE'), 'filter_state', JHtml::_('select.options', UsersHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_ACTIVE'), 'filter_active', JHtml::_('select.options', UsersHelper::getActiveOptions(), 'value', 'text', $this->state->get('filter.active')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_USERGROUP'), 'filter_group_id', JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id')));
     JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_FILTER_DATE'), 'filter_range', JHtml::_('select.options', Usershelper::getRangeOptions(), 'value', 'text', $this->state->get('filter.range')));
 }
    function getGroups()
    {
        if (version_compare(JVERSION, '1.6.0', 'ge')) {
            require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
            $groups = UsersHelper::getGroups();
        } else {
            $db =& JFactory::getDBO();
            $query = 'SELECT id, name FROM #__core_acl_aro_groups
		      WHERE name != "ROOT"
		      AND name != "USERS"
		      AND name != "Public Frontend"
		      AND name != "Public Backend"
		      ORDER BY lft';
            $db->setQuery($query);
            $groups = $db->loadObjectList();
        }
        return $groups;
    }
Exemple #11
0
    public function display($tpl = null)
    {
        $mainframe = JFactory::getApplication();
        $option = JRequest::getCmd('option');
        $document = JFactory::getDocument();
        $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.sync.js');
        $script = '!function($){
    $(document).ready(function(){
        joomlamailerJS.strings.addSelectedUsers = "' . JText::_('JM_ADD_SELECTED_USERS', true) . '";
        joomlamailerJS.strings.addAllUsers = "' . JText::_('JM_ADD_ALL_USERS', true) . '";
        joomlamailerJS.strings.addAllUsersConfirm = "' . JText::_('JM_ARE_YOU_SURE_TO_ADD_ALL_USERS', true) . '";
        joomlamailerJS.strings.selectAList = "' . JText::_('JM_SELECT_A_LIST_TO_ASSIGN_THE_USERS_TO', true) . '";
        joomlamailerJS.strings.noUsersSelected = "' . JText::_('JM_NO_USERS_SELECTED', true) . '";
        joomlamailerJS.strings.usersAlreadyAdded = "' . JText::_('JM_ALL_USERS_ALREADY_ADDED', true) . '";

        joomlamailerJS.strings.addingUsers = "' . JText::_('JM_ADDING_USERS', true) . '";
        joomlamailerJS.strings.done = "' . JText::_('JM_DONE', true) . '";


    });
}(jQuery);';
        $document->addScriptDeclaration($script);
        $layout = JRequest::getVar('layout', 'default');
        if ($layout == 'default') {
            $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'a.name', 'cmd');
            $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
            $filter_type = $mainframe->getUserStateFromRequest($option . 'filter_type', 'filter_type', 0, 'string');
            $filter_date = $mainframe->getUserStateFromRequest($option . 'filter_date', 'filter_date', '', 'string');
            $search = JString::strtolower($mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string'));
            // get list of Groups for dropdown filter
            require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
            $dropdown = '<select name="filter_type" id="filter_type" class="inputbox" onchange="this.form.submit()">';
            $dropdown .= '<option value="">- ' . JText::_('JM_USERGROUP') . ' -</option>';
            $dropdown .= JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $filter_type);
            $dropdown .= '</select>';
            $lists['type'] = $dropdown;
            // table ordering
            $lists['order_Dir'] = $filter_order_Dir;
            $lists['order'] = $filter_order;
            // search filter
            $lists['search'] = $search;
            //date filter
            JHtml::_('behavior.calendar');
            $attr = array('size' => '16', 'style' => 'top:0;', 'placeholder' => JText::_('JM_LAST_VISIT_AFTER'));
            $lists['filter_date'] = JHtml::_('calendar', $filter_date, 'filter_date', 'filter_date', '%Y-%m-%d', $attr);
            $this->assignRef('lists', $lists);
            $this->assignRef('pagination', $pagination);
            JToolBarHelper::title(JText::_('JM_NEWSLETTER_ADD_USERS'), $this->getPageTitleClass());
        } else {
            if ($layout == 'sugar') {
                JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUGARCRM_CONFIGURATION'), $this->getPageTitleClass());
            } else {
                if ($layout == 'highrise') {
                    JToolBarHelper::title(JText::_('JM_NEWSLETTER_HIGHRISE_CONFIGURATION'), $this->getPageTitleClass());
                }
            }
        }
        $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
        $MCapi = $params->get('params.MCapi');
        $JoomlamailerMC = new JoomlamailerMC();
        if ($MCapi && $JoomlamailerMC->pingMC()) {
            if ($layout == 'default') {
                if ($params->get('params.sugar_name') && $params->get('params.sugar_pwd')) {
                    JToolBarHelper::custom('sync_sugar', 'sync_sugar', 'sync_sugar', 'JM_ADD_TO_SUGAR', false, false);
                    JToolBarHelper::spacer();
                    JToolBarHelper::custom('sugar', 'sync_sugar', 'sync_sugar', 'JM_SUGAR_CONFIG', false, false);
                    JToolBarHelper::spacer();
                }
                if ($params->get('params.highrise_url') && $params->get('params.highrise_api_token')) {
                    JToolBarHelper::custom('sync_highrise', 'sync_highrise', 'sync_highrise', 'JM_ADD_TO_HIGHRISE', false, false);
                    JToolBarHelper::spacer();
                    JToolBarHelper::custom('highrise', 'sync_highrise', 'sync_highrise', 'JM_HIGHRISE_CONFIG', false, false);
                    JToolBarHelper::spacer();
                }
                JToolBarHelper::custom('mailchimp', 'sync', 'sync', 'JM_ADD_TO_MAILCHIMP', false, false);
                JToolBarHelper::spacer();
            } else {
                if ($layout == 'sugar') {
                    JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                    JToolBarHelper::spacer();
                    JToolBarHelper::custom('setConfig', 'sync_sugar', 'sync_sugar', 'JM_SAVE_CONFIG', false, false);
                    JToolBarHelper::spacer();
                } else {
                    if ($layout == 'highrise') {
                        JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                        JToolBarHelper::spacer();
                        JToolBarHelper::custom('setConfig', 'sync_highrise', 'sync_highrise', 'JM_SAVE_CONFIG', false, false);
                        JToolBarHelper::spacer();
                    }
                }
            }
        }
        if ($layout == 'default') {
            // Get data from the model
            $items = $this->get('Data');
            $this->assignRef('items', $items);
            $this->setModel($this->getModelInstance('lists'));
            $subscriberLists = $this->getModel('lists')->getLists();
            $this->assignRef('subscriberLists', $subscriberLists);
            $groups = $this->get('Groups');
            $this->assignRef('groups', $groups);
            $CRMusers = $this->get('CRMusers');
            $this->assignRef('CRMusers', $CRMusers);
        } else {
            if ($layout == 'sugar') {
                $sugarFields = $this->get('SugarFields');
                $this->assignRef('sugarFields', $sugarFields);
                $JSFields = $this->get('JSFields');
                $this->assignRef('JSFields', $JSFields);
                $CBFields = $this->get('CBFields');
                $this->assignRef('CBFields', $CBFields);
                $config = $this->getModel('sync')->getConfig('sugar');
                $this->assignRef('config', $config);
            } else {
                if ($layout == 'highrise') {
                    $JSFields = $this->get('JSFields');
                    $this->assignRef('JSFields', $JSFields);
                    $CBFields = $this->get('CBFields');
                    $this->assignRef('CBFields', $CBFields);
                    $config = $this->getModel('sync')->getConfig('highrise');
                    $this->assignRef('config', $config);
                }
            }
        }
        $total = $this->get('TotalUsers');
        $this->assignRef('total', $total);
        parent::display($tpl);
        require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
    }