/**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     if (isset($this->item->checked_out)) {
         $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     } else {
         $checkedOut = false;
     }
     $canDo = JomSocialGroupSyncHelper::getActions();
     JToolBarHelper::title(JText::_('COM_JOMSOCIALGROUPSYNC_TITLE_SYNCHRONIZATIONRULE'), 'generic.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('synchronizationrule.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('synchronizationrule.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('synchronizationrule.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('synchronizationrule.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('synchronizationrule.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('synchronizationrule.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'jomsocialgroupsync.php';
     $state = $this->get('State');
     $canDo = JomSocialGroupSyncHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_JOMSOCIALGROUPSYNC_TITLE_SYNCHRONIZATIONRULES'), 'generic.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'synchronizationrule';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('synchronizationrule.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit')) {
             JToolBarHelper::editList('synchronizationrule.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('synchronizationrules.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('synchronizationrules.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         } else {
             //If this component does not use state then show a direct delete button as we can not trash
             JToolBarHelper::deleteList('', 'synchronizationrules.delete', 'JTOOLBAR_DELETE');
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('synchronizationrules.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('synchronizationrules.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
         }
     }
     //Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'synchronizationrules.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('synchronizationrules.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jomsocialgroupsync');
     }
 }
                            <?php 
        echo $jGroupName . '</a> (id: ' . $item->jgroup_id . ')';
        ?>
                    <?php 
    } else {
        ?>
                        <?php 
        echo $jGroupName . ' (id: ' . $item->jgroup_id . ')';
        ?>
                    <?php 
    }
    ?>
				</td>
				<td>
				    <?php 
    $jsGroupName = JomSocialGroupSyncHelper::getJSGroupName($item->jsgroup_id);
    ?>
                    <?php 
    if ($canEdit || $canEditOwn) {
        ?>
                        <a href="<?php 
        echo JRoute::_('index.php?option=com_jomsocialgroupsync&task=synchronizationrule.edit&id=' . $item->id);
        ?>
">
                            <?php 
        echo $jsGroupName . '</a> (id: ' . $item->jsgroup_id . ')';
        ?>
                    <?php 
    } else {
        ?>
                        <?php