/** * Generates a list of RSS feed items. * * @return void */ function display() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $doc->link = htmlspecialchars(JFactory::getURI()->toString()); $feed_email = $app->getCfg('feed_email') == '' ? 'site' : $app->getCfg('feed_email'); $site_email = $app->getCfg('mailfrom'); // Set the query limit to the feed setting JRequest::setVar('limit', (int) $app->getCfg('feed_limit', 20)); // Get model data $rows = $this->get('Items'); foreach ($rows as $row) { // URL link to item $link = JRoute::_(PFdesignsHelperRoute::getDesignsRoute($row->project_slug, $row->slug)); // Strip html from feed item title $title = $this->escape($row->title); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); $author = $row->author_name; $desc = $row->description; $date = $row->created ? date('r', strtotime($row->created)) : ''; // Load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $desc; $item->date = $date; $item->author = $author; $item->authorEmail = $feed_email == 'site' ? $site_email : $row->author_email; // Loads item info into the RSS array $doc->addItem($item); } }
/** * Returns a list of buttons for the frontend * * @return array */ public static function getSiteButtons() { $buttons = array(); if (JFactory::getUser()->authorise('core.create', 'com_pfdesigns')) { $buttons[] = array('title' => 'COM_PFDESIGNS_ADD_DESIGN', 'link' => PFdesignsHelperRoute::getDesignsRoute() . '&task=designform.add', 'icon' => JHtml::image('com_pfdesigns/header/icon-48-designs.add.png', JText::_('COM_PFDESIGNS_ADD_DESIGN'), null, true)); } return $buttons; }
protected function getTitleLink() { if ($this->client_id) { $link = 'index.php?option=' . $this->item->extension . '&task=' . $this->item->name . '.edit' . '&id=' . (int) $this->item->item_id; } else { $meta =& $this->item->metadata; $item_slug = $this->item->item_id . ':' . $meta->get('alias'); $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias'); if ($this->item->name == 'album') { $link = PFdesignsHelperRoute::getDesignsRoute($p_slug, $item_slug); } if ($this->item->name == 'design') { $a_slug = $meta->get('a_id') ? $meta->get('a_id') . ':' . $meta->get('a_alias') : 0; $link = PFdesignsHelperRoute::getDesignRoute($item_slug, $p_slug, $a_slug); } if ($this->item->name == 'revision') { $d_slug = intval($meta->get('d_id')) . ':' . $meta->get('d_alias'); $a_slug = $meta->get('a_id') ? intval($meta->get('a_id')) . ':' . $meta->get('a_alias') : 0; $link = PFdesignsHelperRoute::getDesignRoute($d_slug, $p_slug, $a_slug, $item_slug); } } return JRoute::_($link); }
$span = 12 / $cols; // Override image path? if ($prev == 1 && !is_null($item->revision)) { $item->preview_source = $item->revision->preview_source; $link = PFdesignsHelperRoute::getDesignRoute($item->slug, $item->project_slug, $item->album_slug, $item->revision->slug); } // Prepare the watch button $watch = ''; if ($uid) { $options = array('div-class' => 'pull-right', 'a-class' => 'btn-mini'); $watch = JHtml::_('pfhtml.button.watch', 'designs', $i, $item->watching, $options); } // Prepare title $title = '<a href="' . JRoute::_($link) . '">' . $this->escape($item->title) . '</a>'; $project_title = '<a href="' . PFdesignsHelperRoute::getDesignsRoute($item->project_slug) . '">' . $this->escape($item->project_title) . '</a>'; $album_title = '<a href="' . PFdesignsHelperRoute::getDesignsRoute($item->project_slug, $item->album_slug) . '">' . $this->escape($item->album_title) . '</a>'; /*if (!$this->state->get('filter.project') && !$this->state->get('filter.album')) { if (!$item->album_id) { $lang = 'COM_PROJECTFORK_DESIGNS_DESIGN_TITLE_IN_PROJECT'; $title .= ' <small>' . JText::sprintf($lang, $project_title) . '</small>'; } else { $lang = 'COM_PROJECTFORK_DESIGNS_DESIGN_TITLE_IN_PROJECT_ALBUM'; $title .= ' <small>' . JText::sprintf($lang, $project_title, $album_title) . '</small>'; } } elseif (!$this->state->get('filter.project')) { $lang = 'COM_PROJECTFORK_DESIGNS_DESIGN_TITLE_IN_PROJECT'; $title .= ' <small>' . JText::sprintf($lang, $project_title) . '</small>'; } elseif (!$this->state->get('filter.album') && $item->album_id) {
<!-- Start hidden upload field --> <div style="display: none !important;"> <input type="hidden" name="id" value="0" /> <input type="hidden" name="jform[album_id]" id="jform_album_id" value="" /> <input type="file" name="jform[file]" id="quick-upload" accept="image/jpeg,image/png,image/gif" onchange="jQuery('#jform_task').val('designform.upload');this.form.submit();"/> </div> <!-- End hidden upload field --> <ul class="list-albums unstyled"> <?php $k = 0; foreach ($this->items as $i => $item) { $access = PFdesignsHelper::getAlbumActions($item->id); $link = PFdesignsHelperRoute::getDesignsRoute($item->project_slug, $item->slug); $desc = $this->escape($item->description ? $item->description : JText::_('COM_PROJECTFORK_DESIGNS_NO_DESCRIPTION')); $can_create = $access->get('core.create'); $can_edit = $access->get('core.edit'); $can_checkin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $uid || $item->checked_out == 0; $can_edit_own = $access->get('core.edit.own') && $item->created_by == $uid; $can_change = $access->get('core.edit.state') && $can_checkin; // Get display params $rows = (int) $item->params->get('album_row_limit', 1); $limit = (int) $item->params->get('album_row_items', 8); $sdesc = (int) $item->params->get('show_album_desc', 1); $span = 12 / $limit; // Get the first design to show as cover $item->designs = array_reverse($item->designs); $first = array_pop($item->designs); $item->designs = array_reverse($item->designs);
/** * Get the return URL. * If a "return" variable has been passed in the request * * @return string The return URL. */ protected function getReturnPage() { $return = JRequest::getVar('return', null, 'default', 'base64'); if (empty($return) || !JUri::isInternal(base64_decode($return))) { return JRoute::_(PFdesignsHelperRoute::getDesignsRoute(), false); } else { return base64_decode($return); } }
/** * Function that allows child controller access to model data after the data has been saved. * * @param jmodel $model The data model object. * @param array $data The validated data. * * @return void */ protected function postSaveHook(&$model, $data) { $task = $this->getTask(); switch ($task) { case 'save2copy': case 'save2new': // No redirect because its already set break; case 'save2rev': $link = JRoute::_(PFdesignsHelperRoute::getDesignsRoute() . '&task=revisionform.add', false); $this->setRedirect($link); break; default: $this->setRedirect($this->getReturnPage() . ($task == 'upload' ? '#_' . $data['album_id'] : '')); break; } }