Exemple #1
0
 /**
  * Add the page title and toolbar.
  *
  * @return void
  *
  * @since        1.6
  */
 protected function initToolbar()
 {
     $bar = JToolBar::getInstance('toolbar');
     $edition = defined('JSN_UNIFORM_EDITION') ? JSN_UNIFORM_EDITION : "free";
     if (strtolower($edition) == "free") {
         $dataListForm = JSNUniformHelper::getForms();
         $countForm = 3 - count($dataListForm) > 0 ? 3 - count($dataListForm) : 0;
         $msg = JText::sprintf('JSN_UNIFORM_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_FORM_IN_FREE_EDITION', (int) $countForm) . ' <a class="jsn-link-action" href="index.php?option=com_uniform&view=upgrade">' . JText::_("JSN_UNIFORM_UPGRADE_EDITION") . '</a>';
         if (count($dataListForm) < 3) {
             JToolBarHelper::addNew('form.add', 'JTOOLBAR_NEW');
             JToolBarHelper::editList('form.edit', 'JTOOLBAR_EDIT');
             JToolBarHelper::custom('forms.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
             JFactory::getApplication()->enqueueMessage($msg);
         } else {
             $bar->appendButton('Custom', '<button class="btn btn-small btn-success disabled jsn-popup-upgrade" onclick="return false;"><i class="icon-new icon-white"></i>' . JText::_('JTOOLBAR_NEW') . '</button>');
             JToolBarHelper::editList('form.edit', 'JTOOLBAR_EDIT');
             $bar->appendButton('Custom', '<button class="btn btn-small disabled jsn-popup-upgrade" onclick="return false;"><i class="icon-copy "></i>' . JText::_('JTOOLBAR_DUPLICATE') . '</button>');
             $session = JFactory::getSession();
             $seesionQueue = $session->get('application.queue');
             if ($seesionQueue[0]['type'] != "error") {
                 JError::raiseNotice(100, $msg);
             }
         }
     } else {
         JSNUniformHelper::buttonAddNewForm();
         JToolBarHelper::editList('form.edit', 'JTOOLBAR_EDIT');
         JToolBarHelper::custom('forms.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
     }
     JToolBarHelper::publish('forms.publish', 'JSN_UNIFORM_PUBLISH', true);
     JToolBarHelper::unpublish('forms.unpublish', 'JSN_UNIFORM_UNPUBLISH', true);
     JToolBarHelper::deleteList('JSN_UNIFROM_CONFIRM_DELETE', 'forms.delete', 'JTOOLBAR_DELETE');
     JSNUniformHelper::initToolbar('JSN_UNIFORM_FORMS_MANAGER', 'uniform-forms');
 }