/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !true; // Since we don't track these assets at the item level, use the category id. JToolbarHelper::title(JText::_('COM_HTRAININGLOGS_MANAGER_H_TR_SESSION'), 'link h_tr_sessions'); // If not checked out, can save the item. if (!$checkedOut || count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) { JToolbarHelper::apply('h_tr_session.apply'); JToolbarHelper::save('h_tr_session.save'); } if (!$checkedOut && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) { JToolbarHelper::save2new('h_tr_session.save2new'); } // If an existing item, can save to a copy. if (!$isNew && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create')) > 0) { JToolbarHelper::save2copy('h_tr_session.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('h_tr_session.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_htraininglogs.h_tr_session', $this->item->id); } JToolbarHelper::cancel('h_tr_session.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_H_tr_sessionS_LINKS_EDIT'); }
/** * Add the page title and toolbar. * * @return void * * @throws Exception */ protected function addToolbar() { JFactory::getApplication()->input->set('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 = VocabHelper::getActions(); JToolBarHelper::title(JText::_('COM_VOCAB_TITLE_SUBJECT'), 'subject.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('subject.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('subject.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('subject.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('subject.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } // Button for version control if ($this->state->params->get('save_history', 1) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_vocab.subject', $this->item->id); } if (empty($this->item->id)) { JToolBarHelper::cancel('subject.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('subject.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); $canDo = $this->canDo; JToolbarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_CLIENT_NEW') : JText::_('COM_BANNERS_MANAGER_CLIENT_EDIT'), 'bookmark banners-clients'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolbarHelper::apply('client.apply'); JToolbarHelper::save('client.save'); } if (!$checkedOut && $canDo->get('core.create')) { JToolbarHelper::save2new('client.save2new'); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolbarHelper::save2copy('client.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('client.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_banners.client', $this->item->id); } JToolbarHelper::cancel('client.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS_EDIT'); }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Since we don't track these assets at the item level, use the category id. $canDo = JHelperContent::getActions('com_banners', 'category', $this->item->catid); JToolbarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_BANNER_NEW') : JText::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'bookmark banners'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) { JToolbarHelper::apply('banner.apply'); JToolbarHelper::save('banner.save'); if ($canDo->get('core.create')) { JToolbarHelper::save2new('banner.save2new'); } } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolbarHelper::save2copy('banner.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('banner.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_banners.banner', $this->item->id); } JToolbarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Since we don't track these assets at the item level, use the category id. $canDo = JHelperContent::getActions($this->item->catid, 0, 'com_contact'); JToolbarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACT'), 'address contact'); // Build the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($isNew && count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { JToolbarHelper::apply('contact.apply'); JToolbarHelper::save('contact.save'); JToolbarHelper::save2new('contact.save2new'); } JToolbarHelper::cancel('contact.cancel'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) { JToolbarHelper::apply('contact.apply'); JToolbarHelper::save('contact.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolbarHelper::save2new('contact.save2new'); } } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolbarHelper::save2copy('contact.save2copy'); } if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_contact.contact', $this->item->id); } JToolbarHelper::cancel('contact.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS_EDIT'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); // Since we don't track these assets at the item level, use the category id. $canDo = JHelperContent::getActions('com_digicom', 'category', $this->item->catid); JToolbarHelper::title(JText::_('COM_DIGICOM_MANAGER_PRODUCT'), 'link products'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_digicom', 'core.create')))) { JToolbarHelper::apply('product.apply'); JToolbarHelper::save('product.save'); } if (!$checkedOut && count($user->getAuthorisedCategories('com_digicom', 'core.create'))) { JToolbarHelper::save2new('product.save2new'); } // If an existing item, can save to a copy. if (!$isNew && count($user->getAuthorisedCategories('com_digicom', 'core.create')) > 0) { JToolbarHelper::save2copy('product.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('product.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_digicom.product', $this->item->id); } JToolbarHelper::cancel('product.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_DIGICOM_PRODUCTS_LINKS_EDIT'); $bar = JToolBar::getInstance('toolbar'); $layout = new JLayoutFile('toolbar.title'); $title = array('title' => JText::_('COM_DIGICOM_PRODUCT_ADD_EDIT_TOOLBAR_TITLE'), 'class' => 'product'); $bar->appendButton('Custom', $layout->render($title), 'title'); }
/** * Display the toolbar. * * @return void * * @since 2.5 */ protected function addToolbar() { $input = JFactory::getApplication()->input; $input->set('hidemainmenu', 1); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id); JToolbarHelper::title(JText::_('COM_USERS_NOTES'), 'users user'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) { JToolbarHelper::apply('note.apply'); JToolbarHelper::save('note.save'); } if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) { JToolbarHelper::save2new('note.save2new'); } // If an existing item, can save to a copy. if (!$isNew && count($user->getAuthorisedCategories('com_users', 'core.create')) > 0) { JToolbarHelper::save2copy('note.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('note.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_users.note', $this->item->id); } JToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_USERS_USER_NOTES_EDIT'); }
/** * Add the page title and toolbar. * */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $user_id = $user->get('id'); $is_new = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 or $this->item->checked_out == $user_id); JToolbarHelper::title(JText::_('COM_KNVBAPI_TEAMS_' . ($checkedOut ? 'VIEW_HEADER' : ($is_new ? 'NEW_HEADER' : 'EDIT_HEADER'))), 'teams.png'); // If not checked out, can save the item. if (($this->can_do->get('core.edit') or $this->can_do->get('core.create') or $this->can_do->get('core.edit.own') and $this->item->created_by == $user_id) and !$checkedOut) { JToolbarHelper::apply('team.apply', 'JTOOLBAR_APPLY'); JToolbarHelper::save('team.save', 'JTOOLBAR_SAVE'); if ($this->can_do->get('core.create')) { JToolbarHelper::custom('team.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } // If an existing item, can save to a copy. if (!$is_new and $this->can_do->get('core.create')) { JToolbarHelper::custom('team.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if ($this->state->params->get('save_history', 1) and $this->state->params->get('team_save_history', 1) and !$is_new and ($this->can_do->get('core.edit') or $this->can_do->get('core.edit.own') and $this->item->created_by == $user_id)) { $item_id = $this->item->id; $type_alias = 'com_knvbapi.team'; JToolbarHelper::versions($type_alias, $item_id); } if (empty($this->item->id)) { JToolbarHelper::cancel('team.cancel', 'JTOOLBAR_CANCEL'); } else { JToolbarHelper::cancel('team.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Built the actions for new and existing records. $canDo = $this->canDo; JToolbarHelper::title(JText::_('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))), 'pencil-2 article-add'); // For new records, check the create permission. if ($isNew && count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { JToolbarHelper::apply('article.apply'); JToolbarHelper::save('article.save'); JToolbarHelper::save2new('article.save2new'); JToolbarHelper::cancel('article.cancel'); } else { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. $itemEditable = $canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId; // Can't save the record if it's checked out and editable if (!$checkedOut && $itemEditable) { JToolbarHelper::apply('article.apply'); JToolbarHelper::save('article.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolbarHelper::save2new('article.save2new'); } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolbarHelper::save2copy('article.save2copy'); } if ($this->state->params->get('save_history', 0) && $itemEditable) { JToolbarHelper::versions('com_content.article', $this->item->id); } JToolbarHelper::cancel('article.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER_EDIT'); }
/** * Setting the toolbar */ protected function addToolBar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; JToolbarHelper::title(JText::_($isNew ? 'COM_COMPONENTBUILDER_FIELD_NEW' : 'COM_COMPONENTBUILDER_FIELD_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. if ($this->refid || $this->ref) { if ($this->canDo->get('field.create') && $isNew) { // We can create the record. JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('field.edit')) { // We can save the record. JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); } } else { if ($isNew) { // For new records, check the create permission. if ($this->canDo->get('field.create')) { JToolBarHelper::apply('field.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('field.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('field.edit')) { // We can save the new record JToolBarHelper::apply('field.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('field.create')) { JToolBarHelper::custom('field.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = $this->canDo->get('core.version') && $this->canDo->get('field.version'); if ($this->state->params->get('save_history', 1) && $this->canDo->get('field.edit') && $canVersion) { JToolbarHelper::versions('com_componentbuilder.field', $this->item->id); } if ($this->canDo->get('field.create')) { JToolBarHelper::custom('field.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); } } JToolbarHelper::divider(); // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('field'); if (ComponentbuilderHelper::checkString($help_url)) { JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $extension = JFactory::getApplication()->input->get('extension'); $user = JFactory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Check to see if the type exists $ucmType = new JUcmType(); $this->typeId = $ucmType->getTypeId($extension . '.category'); // Avoid nonsense situation. if ($extension == 'com_categories') { return; } // The extension can be in the form com_foo.section $parts = explode('.', $extension); $component = $parts[0]; $section = count($parts) > 1 ? $parts[1] : null; $componentParams = JComponentHelper::getParams($component); // Need to load the menu language file as mod_menu hasn't been loaded yet. $lang = JFactory::getLanguage(); $lang->load($component, JPATH_BASE, null, false, true) || $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); // Load the category helper. require_once JPATH_COMPONENT . '/helpers/categories.php'; // Get the results for each action. $canDo = $this->canDo; // If a component categories title string is present, let's use it. if ($lang->hasKey($component_title_key = $component . ($section ? "_{$section}" : '') . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE')) { $title = JText::_($component_title_key); } elseif ($lang->hasKey($component_section_key = $component . ($section ? "_{$section}" : ''))) { $title = JText::sprintf('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', $this->escape(JText::_($component_section_key))); } else { $title = JText::_('COM_CATEGORIES_CATEGORY_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'); } // Load specific css component JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true); // Prepare the toolbar. JToolbarHelper::title($title, 'folder category-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-{$section}" : '') . '-category-' . ($isNew ? 'add' : 'edit')); // For new records, check the create permission. if ($isNew && count($user->getAuthorisedCategories($component, 'core.create')) > 0) { JToolbarHelper::apply('category.apply'); JToolbarHelper::save('category.save'); JToolbarHelper::save2new('category.save2new'); } elseif (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_user_id == $userId)) { JToolbarHelper::apply('category.apply'); JToolbarHelper::save('category.save'); if ($canDo->get('core.create')) { JToolbarHelper::save2new('category.save2new'); } } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolbarHelper::save2copy('category.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('category.cancel'); } else { if ($componentParams->get('save_history', 0) && $user->authorise('core.edit')) { $typeAlias = $extension . '.category'; JToolbarHelper::versions($typeAlias, $this->item->id); } JToolbarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); // Compute the ref_key if it does exist in the component if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_{$section}" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY')) { $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_{$section}" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT'); } /* Get help for the category/section view for the component by * -remotely searching in a language defined dedicated URL: *component*_HELP_URL * -locally searching in a component help file if helpURL param exists in the component and is set to '' * -remotely searching in a component URL if helpURL param exists in the component and is NOT set to '' */ if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) { $debug = $lang->setDebug(false); $url = JText::_($lang_help_url); $lang->setDebug($debug); } else { $url = null; } JToolbarHelper::help($ref_key, $componentParams->exists('helpURL'), $url, $component); }
/** * Setting the toolbar */ protected function addToolBar() { // adding the joomla edit toolbar to the front JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR . '/includes/toolbar.php'); JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; JToolbarHelper::title(JText::_($isNew ? 'COM_COSTBENEFITPROJECTION_COMPANY_NEW' : 'COM_COSTBENEFITPROJECTION_COMPANY_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. if ($this->refid || $this->ref) { if ($this->canDo->get('company.create') && $isNew) { // We can create the record. JToolBarHelper::save('company.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('company.edit')) { // We can save the record. JToolBarHelper::save('company.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. JToolBarHelper::cancel('company.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. JToolBarHelper::cancel('company.cancel', 'JTOOLBAR_CLOSE'); } } else { if ($isNew) { // For new records, check the create permission. if ($this->canDo->get('company.create')) { JToolBarHelper::apply('company.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('company.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('company.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('company.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('company.edit')) { // We can save the new record JToolBarHelper::apply('company.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('company.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('company.create')) { JToolBarHelper::custom('company.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = $this->canDo->get('core.version') && $this->canDo->get('company.version'); if ($this->state->params->get('save_history', 1) && $this->canDo->get('company.edit') && $canVersion) { JToolbarHelper::versions('com_costbenefitprojection.company', $this->item->id); } if ($this->canDo->get('company.create')) { JToolBarHelper::custom('company.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('company.cancel', 'JTOOLBAR_CLOSE'); } } JToolbarHelper::divider(); // set help url for this view if found $help_url = CostbenefitprojectionHelper::getHelpUrl('company'); if (CostbenefitprojectionHelper::checkString($help_url)) { JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); } // now initiate the toolbar $this->toolbar = JToolbar::getInstance(); }
/** * Add the page title and toolbar. * * @since 3.1 * * @return void */ protected function addToolbar() { $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Need to load the menu language file as mod_menu hasn't been loaded yet. $lang = JFactory::getLanguage(); $lang->load('com_tags', JPATH_BASE, null, false, true) || $lang->load('com_tags', JPATH_ADMINISTRATOR . '/components/com_tags', null, false, true); // Get the results for each action. $canDo = $this->canDo; $title = JText::_('COM_TAGS_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'); /** * Prepare the toolbar. * If it is new we get: `tag tag-add add` * else we get `tag tag-edit edit` */ JToolbarHelper::title($title, 'tag tag-' . ($isNew ? 'add add' : 'edit edit')); // For new records, check the create permission. if ($isNew) { JToolbarHelper::apply('tag.apply'); JToolbarHelper::save('tag.save'); JToolbarHelper::save2new('tag.save2new'); } elseif (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_user_id == $userId)) { JToolbarHelper::apply('tag.apply'); JToolbarHelper::save('tag.save'); if ($canDo->get('core.create')) { JToolbarHelper::save2new('tag.save2new'); } } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolbarHelper::save2copy('tag.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('tag.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_tags.tag', $this->item->id); } JToolbarHelper::cancel('tag.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_TAGS_MANAGER_EDIT'); JToolbarHelper::divider(); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Built the actions for new and existing records. $canDo = $this->canDo; JToolbarHelper::title(JText::_('COM_PLACES_PAGE_' . ($checkedOut ? 'VIEW_TOWN' : ($isNew ? 'ADD_TOWN' : 'EDIT_TOWN'))), 'flag-3'); // For new records, check the create permission. if ($isNew && count($user->getAuthorisedCategories('com_places', 'core.create')) > 0) { JToolbarHelper::apply('town.apply'); JToolbarHelper::save('town.save'); JToolbarHelper::save2new('town.save2new'); JToolbarHelper::cancel('town.cancel'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) { JToolbarHelper::apply('town.apply'); JToolbarHelper::save('town.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolbarHelper::save2new('town.save2new'); } } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolbarHelper::save2copy('town.save2copy'); } if ($this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_places.town', $this->item->id); } JToolbarHelper::cancel('town.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); }
if ($translate_id > 0) { $config['asset_id'] = 0; $config['author'] = 0; $config['custom'] = ''; $config['pk'] = 0; $config['storages'] = array(); $id = 0; unset($config['base']); } if ($config['pk'] && empty($config['id'])) { if (!(isset($config['base']) && is_object($config['base']))) { $config['base'] = new stdClass(); $config['base']->location = ''; $config['base']->table = ''; } if (!(isset($config['base']->location) && $config['base']->location)) { $config['base']->location = $type->storage_location; if ($config['base']->location) { $properties = array('table'); $properties = JCck::callFunc('plgCCK_Storage_Location' . $config['base']->location, 'getStaticProperties', $properties); $config['base']->table = $properties['table']; } } $config['id'] = JCck::callFunc('plgCCK_Storage_Location' . $config['base']->location, 'getId', $config); } else { $config['id'] = @$config['id'] ? $config['id'] : 0; } // Versions if ($app->isAdmin() && JCck::on('3.2') && @$config['base']->location == 'joomla_article') { JToolbarHelper::versions('com_content.article', $config['pk']); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); // Since we don't track these assets at the item level, use the category id. $canDo = $this->canDo; JToolbarHelper::title(JText::_('Pages Manager: Build Page'), ''); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $user->authorise('core.create', 'com_azurapagebuilder'))) { JToolbarHelper::apply('page.apply'); JToolbarHelper::save('page.save'); } if (!$checkedOut && $user->authorise('core.create', 'com_azurapagebuilder')) { JToolbarHelper::save2new('page.save2new'); } // If an existing item, can save to a copy. if (!$isNew && $user->authorise('core.create', 'com_azurapagebuilder')) { JToolbarHelper::save2copy('page.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('page.cancel'); } else { if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) { JToolbarHelper::versions('com_azurapagebuilder.page', $this->item->id); } JToolbarHelper::cancel('page.cancel', 'JTOOLBAR_CLOSE'); } }