/** * 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 = AkrecipesHelper::getActions(); JToolBarHelper::title(JText::_('COM_AKRECIPES_TITLE_INGREDIENT997479'), 'ingredient997479.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('ingredient997479.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('ingredient997479.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('ingredient997479.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('ingredient997479.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('ingredient997479.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('ingredient997479.cancel', 'JTOOLBAR_CLOSE'); } }
/** * 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 = AkrecipesHelper::getActions(); JToolBarHelper::title(JText::_('COM_AKUNITS_TITLE_UNIT'), 'unit.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('unit.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('unit.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('unit.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('unit.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_akrecipes.unit', $this->item->id); } if (empty($this->item->id)) { JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/akrecipes.php'; $state = $this->get('State'); $canDo = AkrecipesHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_AKRECIPES_TITLE_CUISINES'), 'cuisines.png'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/cuisine'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('cuisine.add', 'JTOOLBAR_NEW'); JToolbarHelper::custom('cuisines.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('cuisine.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('cuisines.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('cuisines.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } elseif (isset($this->items[0])) { // If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'cuisines.delete', 'JTOOLBAR_DELETE'); } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('cuisines.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('cuisines.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('', 'cuisines.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('cuisines.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_akrecipes'); } // Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_akrecipes&view=cuisines'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/akrecipes.php'; $state = $this->get('State'); $canDo = AkrecipesHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_AKRECIPES_TITLE_RECIPES'), 'recipes.png'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/recipe'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('recipe.add', 'JTOOLBAR_NEW'); JToolbarHelper::custom('recipes.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('recipe.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('recipes.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('recipes.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); JToolbarHelper::custom('recipes.featured', 'featured.png', 'featured_f2.png', 'JFEATURE', true); JToolbarHelper::custom('recipes.unfeatured', 'unfeatured.png', 'featured_f2.png', 'JUNFEATURE', true); } elseif (isset($this->items[0])) { // If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'recipes.delete', 'JTOOLBAR_DELETE'); } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('recipes.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('recipes.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('', 'recipes.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('recipes.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } // Add file browser button require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jce' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'browser.php'; $bar =& JToolBar::getInstance('toolbar'); JToolBarHelper::divider(); $bar->appendButton('Popup', 'folder', 'File browser', WFBrowserHelper::getBrowserLink(), 800, 500); if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_akrecipes'); } // Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_akrecipes&view=recipes'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_("JOPTION_SELECT_CATEGORY"), 'filter_catid', JHtml::_('select.options', JHtml::_('category.options', 'com_akrecipes'), "value", "text", $this->state->get('filter.catid'))); //Filter for the field cuisines_id; jimport('joomla.form.form'); $options = array(); JForm::addFormPath(JPATH_COMPONENT . '/models/forms'); $form = JForm::getInstance('com_akrecipes.recipe', 'recipe'); $field = $form->getField('cuisines_id'); $query = $form->getFieldAttribute('filter_cuisines_id', 'query'); $translate = $form->getFieldAttribute('filter_cuisines_id', 'translate'); $key = $form->getFieldAttribute('filter_cuisines_id', 'key_field'); $value = $form->getFieldAttribute('filter_cuisines_id', 'value_field'); // Get the database object. $db = JFactory::getDBO(); // Set the query and get the result list. $db->setQuery($query); $items = $db->loadObjectlist(); // Build the field options. if (!empty($items)) { foreach ($items as $item) { if ($translate == true) { $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value})); } else { $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value}); } } } JHtmlSidebar::addFilter('$Cuisine', 'filter_cuisines_id', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.cuisines_id')), true); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); // JHtmlSidebar::addFilter( // JText::_('Select User'), // 'filter_created_by', // JHtml::_('select.options', "value", "text", $this->state->get('filter.created_by'),true) // ); $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('u.id AS value, u.name AS text')->from('#__users AS u')->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = u.id')->where('u.block = 0')->order('name')->group('u.id'); $db->setQuery($query); $users[] = JHtml::_('select.option', '0', JText::_('JOPTION_NO_USER')); $users = array_merge($users, $db->loadObjectList()); // error_log('users arraay -> ' . print_r($users,true)); JHtmlSidebar::addFilter(JText::_('Select User'), 'filter_created_by', JHtml::_('select.options', $users, "value", "text", $this->state->get('filter.created_by'))); // filter by tag $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('u.id AS value, u.title AS text')->from('#__tags AS u')->order('u.title'); $db->setQuery($query); $tags[] = JHtml::_('select.option', '0', JText::_('JOPTION_SELECT_TAG')); $tags = array_merge($tags, $db->loadObjectList()); //error_log('users arraay -> ' . print_r($tags,true)); JHtmlSidebar::addFilter(JText::_('Select Tag'), 'filter_tag', JHtml::_('select.options', $tags, "value", "text", $this->state->get('filter.tag'))); //Filter for the field contest_id; jimport('joomla.form.form'); $options = array(); JForm::addFormPath(JPATH_COMPONENT . '/models/forms'); $form = JForm::getInstance('com_akrecipes.recipe', 'recipe'); $field = $form->getField('contest_id'); $query = $form->getFieldAttribute('filter_contest_id', 'query'); $translate = $form->getFieldAttribute('filter_contest_id', 'translate'); $key = $form->getFieldAttribute('filter_contest_id', 'key_field'); $value = $form->getFieldAttribute('filter_contest_id', 'value_field'); // Get the database object. $db = JFactory::getDBO(); // Set the query and get the result list. $db->setQuery($query); //error_log("Query == " . $query); $items = $db->loadObjectlist(); // Build the field options. if (!empty($items)) { foreach ($items as $item) { if ($translate == true) { $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value})); } else { $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value}); } } } JHtmlSidebar::addFilter('$Cuisine', 'filter_contest_id', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.contest_id')), true); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))); //error_log('users select options -> ' . JHtml::_('select.options', $users, "value", "text", $this->state->get('filter.created_by'))); //Filter for the field created_by // $this->extra_sidebar .= '<div class="other-filters">'; // $this->extra_sidebar .= '<small><label for="filter_created_by">Created by</label></small>'; // $this->extra_sidebar .= JHtmlList::users('filter_created_by', $this->state->get('filter.created_by'), 1, 'onchange="this.form.submit();"'); // $this->extra_sidebar .= '</div>'; // $this->extra_sidebar .= '<hr class="hr-condensed">'; }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/akrecipes.php'; $state = $this->get('State'); $canDo = AkrecipesHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_AKRECIPES_TITLE_RECIPES'), 'recipes.png'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/recipe'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('recipe.add', 'JTOOLBAR_NEW'); JToolbarHelper::custom('recipes.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('recipe.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('recipes.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('recipes.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } elseif (isset($this->items[0])) { // If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'recipes.delete', 'JTOOLBAR_DELETE'); } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('recipes.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('recipes.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('', 'recipes.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('recipes.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_akrecipes'); } // Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_akrecipes&view=recipes'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_("JOPTION_SELECT_CATEGORY"), 'filter_catid', JHtml::_('select.options', JHtml::_('category.options', 'com_akrecipes'), "value", "text", $this->state->get('filter.catid'))); //Filter for the field cuisines_id; jimport('joomla.form.form'); $options = array(); JForm::addFormPath(JPATH_COMPONENT . '/models/forms'); $form = JForm::getInstance('com_akrecipes.recipe', 'recipe'); $field = $form->getField('cuisines_id'); $query = $form->getFieldAttribute('filter_cuisines_id', 'query'); $translate = $form->getFieldAttribute('filter_cuisines_id', 'translate'); $key = $form->getFieldAttribute('filter_cuisines_id', 'key_field'); $value = $form->getFieldAttribute('filter_cuisines_id', 'value_field'); // Get the database object. $db = JFactory::getDBO(); // Set the query and get the result list. $db->setQuery($query); $items = $db->loadObjectlist(); // Build the field options. if (!empty($items)) { foreach ($items as $item) { if ($translate == true) { $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value})); } else { $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value}); } } } JHtmlSidebar::addFilter('$Cuisine', 'filter_cuisines_id', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.cuisines_id')), true); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $state = $this->get('State'); $canDo = AkrecipesHelper::getActions(); JToolBarHelper::title(JText::_('COM_AKPRODUCTS_TITLE_PRODUCTS'), 'products.png'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/product'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('product.add', 'JTOOLBAR_NEW'); JToolbarHelper::custom('products.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('product.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('products.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('products.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } elseif (isset($this->items[0])) { // If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'products.delete', 'JTOOLBAR_DELETE'); } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('products.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('products.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('', 'products.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('products.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_akrecipes'); } // Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_akrecipes&view=products'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); //Filter for the field product_affiliate $select_label = JText::sprintf('COM_AKPRODUCTS_FILTER_SELECT_LABEL', 'Product_affiliate'); $options = array(); $options[0] = new stdClass(); $options[0]->value = "amazon"; $options[0]->text = "Amazon"; $options[1] = new stdClass(); $options[1]->value = "flipkart"; $options[1]->text = "Flipkart"; $options[2] = new stdClass(); $options[2]->value = "snapdeal"; $options[2]->text = "Snapdeal"; $options[3] = new stdClass(); $options[3]->value = "other"; $options[3]->text = "Other"; JHtmlSidebar::addFilter($select_label, 'filter_product_affiliate', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.product_affiliate'), true)); }