/** * Add the page title and toolbar. * * @return void */ protected function addToolbar() { $name = $this->getName(); $tag = strtoupper($name); $singular = BabioonAdHelper::toSingular($name); $doc = JFactory::getDocument(); if (file_exists(JPATH_BASE . '/media/babioon/images/icon-48-babioon-' . $name . '.png')) { $doc->addStyleDeclaration('.icon-48-babioon-' . $name . ' {background-image: url(../media/babioon/images/icon-48-babioon-' . $name . '.png);}'); $image = 'babioon-' . $name . '.png'; } else { $doc->addStyleDeclaration('.icon-48-babioon {background-image: url(../media/babioon/images/icon-48-babioon.png);}'); $image = 'babioon.png'; } $user = JFactory::getUser(); $canDo = BabioonAdHelper::getActions($singular); JToolBarHelper::title(JText::_('COM_BABIOONAD_' . $tag), $image); // Use sigular JToolBarHelper::editList($singular . '.edit'); if ($canDo->get('core.edit.state')) { JToolBarHelper::divider(); JToolBarHelper::publish($name . '.publish', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::unpublish($name . '.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($canDo->get('core.edit.state')) { JToolBarHelper::checkin($name . '.checkin'); } if ($canDo->get('core.delete')) { JToolBarHelper::divider(); JToolBarHelper::deleteList('', $name . '.delete'); } if ($canDo->get('core.admin')) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_babioonad'); } }
/** * Proxy for getModel. * * @param string $name Model name * @param string $prefix Prefix * @param array $config configuration array * * @return the model */ public function getModel($name = null, $prefix = 'BabioonAdModel', $config = array('ignore_request' => true)) { if (is_null($name)) { $name = BabioonAdHelper::toSingular($this->view_list); } // Note: Name in singular $model = parent::getModel($name, $prefix, $config); return $model; }