/** * Setting the toolbar */ protected function addToolbar() { if (Bt_portfolioLegacyHelper::isLegacy()) { JRequest::setVar('hidemainmenu', true); } else { JRequest::setVar('hidemainmenu', false); } $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); JToolBarHelper::title($isNew ? JText::_('COM_BT_PORTFOLIO_NEW_EXTRAFIELD') : JText::_('COM_BT_PORTFOLIO_EDIT_EXTRAFIELD'), 'article-add.png'); if ($isNew) { JToolBarHelper::apply('extrafield.apply'); JToolBarHelper::save('extrafield.save'); JToolBarHelper::save2new('extrafield.save2new'); JToolBarHelper::cancel('extrafield.cancel'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { JToolBarHelper::apply('extrafield.apply'); JToolBarHelper::save('extrafield.save'); JToolBarHelper::save2new('extrafield.save2new'); } JToolBarHelper::cancel('extrafield.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Categories view display method * @return void */ function display($tpl = null) { Bt_portfolioLegacyHelper::getCSS(); $this->legacy = Bt_portfolioLegacyHelper::isLegacy(); // Set the toolbar $this->addToolBar(); $buttons = $this->getButtons(); $this->assign('buttons', $buttons); // Display the template parent::display($tpl); // Set the document $this->setDocument(); }
/** * Extrafield view display method * @return void */ function display($tpl = null) { // Get data from the model $items = $this->get('Items'); $pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->legacy = Bt_portfolioLegacyHelper::isLegacy(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Assign data to the view $this->items = $items; $this->pagination = $pagination; // Set the toolbar $this->addToolBar(); // Display the template parent::display($tpl); // Set the document $this->setDocument(); }
*/ // No direct access defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); $params = $this->form->getFieldsets('params'); $component_params = JComponentHelper::getParams("com_bt_portfolio"); ?> <form name="adminForm" action="<?php echo JRoute::_('index.php?option=com_bt_portfolio&layout=edit&id=' . (int) $this->item->id); ?> " method="post" name="adminForm" id="portfolio-form" enctype="multipart/form-data" class="form-validate <?php echo !Bt_portfolioLegacyHelper::isLegacy() ? 'isJ30' : 'isJ25'; ?> "> <div class="width-60 fltlft "> <fieldset class="adminform" > <ul class="adminformlist"> <?php foreach ($this->form->getFieldset('details') as $field) { ?> <li><?php echo $field->label; if ($field->type == "Editor") { echo '<div class="clr"></div>'; } echo $field->input; ?>
public static function addAdminScript() { $checkJqueryLoaded = false; $document = JFactory::getDocument(); $header = $document->getHeadData(); JHTML::_('behavior.framework'); if (!version_compare(JVERSION, '3.0', 'ge')) { foreach ($header['scripts'] as $scriptName => $scriptData) { if (substr_count($scriptName, '/jquery')) { $checkJqueryLoaded = true; } } //Add js if (!$checkJqueryLoaded) { $document->addScript(JURI::root() . 'components/com_bt_portfolio/assets/js/jquery.min.js'); } } //$document->addScript(JURI::root() . 'components/com_bt_portfolio/assets/js/jquery.ui.core.min.js'); //$document->addScript(JURI::root() . 'components/com_bt_portfolio/assets/js/jquery.ui.widget.min.js'); //$document->addScript(JURI::root() . 'components/com_bt_portfolio/assets/js/jquery.ui.accordion.min.js'); $document->addScriptDeclaration('jQuery.noConflict();'); $document->addStyleSheet(JURI::root() . 'components/com_bt_portfolio/assets/icon/admin.css'); $document->addStyleSheet(JURI::root() . 'components/com_bt_portfolio/assets/css/legacy.css'); if (!Bt_portfolioLegacyHelper::isLegacy()) { JHtml::_('formbehavior.chosen', 'select'); } }
/** * Method to build an SQL query to load the list data. * * @return string An SQL query */ protected function getListQuery() { // Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); $user = JFactory::getUser(); // Select fields $query->select('a.*'); // From the bt portfolio_comments table $query->from('#__bt_portfolio_comments as a'); $query->select('pl.title AS portfolio'); $query->join('LEFT', '#__bt_portfolios AS pl ON pl.id=a.item_id'); // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } // Filter by author state $author = $this->getState('filter.author'); if ($author) { $query->where('a.name = ' . $db->quote(Bt_portfolioLegacyHelper::isLegacy() ? $db->getEscaped($author, true) : $db->escape($author, true))); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } else { $search = $db->Quote('%' . (Bt_portfolioLegacyHelper::isLegacy() ? $db->getEscaped($search, true) : $db->escape($search, true)) . '%'); $query->where('a.title LIKE ' . $search, 'or'); $query->where('a.content LIKE ' . $search, 'or'); $query->where('a.name LIKE ' . $search, 'or'); $query->where('a.website LIKE ' . $search, 'or'); $query->where('a.email LIKE ' . $search, 'or'); $query->where('pl.title LIKE ' . $search, 'or'); } } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering'); $orderDirn = $this->state->get('list.direction'); $query->order(Bt_portfolioLegacyHelper::isLegacy() ? $db->getEscaped($orderCol . ' ' . $orderDirn) : $db->escape($orderCol . ' ' . $orderDirn)); return $query; }
/** * Method to build an SQL query to load the list data. * * @return string An SQL query */ protected function getListQuery() { // Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); $user = JFactory::getUser(); // Select fields $query->select('a.*'); // From the bt portfolio_extrafields table $query->from('#__bt_portfolio_extrafields as a'); // Join over the users for the checked out user. $query->select('uc.name AS editor'); $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } // Filter by featured state $type = $this->getState('filter.type'); if ($type) { $query->where('a.type = ' . (Bt_portfolioLegacyHelper::isLegacy() ? $db->quote($db->getEscaped($type)) : $db->quote($db->escape($type)))); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } else { $search = $db->quote('%' . (Bt_portfolioLegacyHelper::isLegacy() ? $db->getEscaped($search, true) : $db->escape($search, true)) . '%'); $query->where('a.name LIKE ' . $search); } } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering'); $orderDirn = $this->state->get('list.direction'); $query->order(Bt_portfolioLegacyHelper::isLegacy() ? $db->getEscaped($orderCol . ' ' . $orderDirn) : $db->escape($orderCol . ' ' . $orderDirn)); return $query; }