/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { RHelperAsset::load('tracks.css'); $mainframe = JFactory::getApplication(); $params = $mainframe->getParams(); $round_id = $mainframe->input->getInt('id', 0); $model = $this->getModel(); $round = $model->getRound($round_id); $breadcrumbs = $mainframe->getPathWay(); $breadcrumbs->addItem($round->name, 'index.php?view=round&r=' . $round_id); $document = JFactory::getDocument(); $document->setTitle($round->name); // parse description with content plugins $round->description = JHTML::_('content.prepare', $round->description); $picture = TrackslibHelperImage::modalimage($round->picture, $round->name, 150); $this->assignRef('round', $round); $this->assignRef('params', $params); $this->assignRef('picture', $picture); parent::display($tpl); }
defined('_JEXEC') or die('Restricted access'); if ($this->data->vehicle_picture || $this->data->vehicle_description) { ?> <div id="teamvehicle"> <h2><?php echo JTExt::_('COM_TRACKS_VIEW_TEAM_VEHICLE'); ?> </h2> <?php if ($this->data->vehicle_picture) { ?> <div id="vehicle-pic"> <?php echo TrackslibHelperImage::modalimage(JPATH_SITE . '/' . $this->data->vehicle_picture, Jtext::_('COM_TRACKS_TEAM_VEHICLE_PICTURE'), 400); ?> </div> <?php } ?> <?php if ($this->data->vehicle_description) { ?> <div id="vehicle-desc"> <?php echo $this->data->vehicle_description; ?> </div> <?php
/** * Manage upload of picture * * @param array $validData valid data * @param array $data post data * @param string $field field name * * @return array valid data */ protected function getPicture($validData, $data, $field) { $params = JComponentHelper::getParams('com_tracks'); $files = JFactory::getApplication()->input->files->get('jform', '', array()); $targetpath = 'images/' . $params->get('default_individual_images_folder', 'tracks/individuals'); if (!isset($files[$field]) || !($picture = $files[$field])) { return false; } if (!empty($picture['name'])) { $base_Dir = JPATH_SITE . '/' . $targetpath . '/'; if (!JFolder::exists($base_Dir)) { JFolder::create($base_Dir); } // Check the image $check = TrackslibHelperImage::check($picture); if ($check === false) { $this->setError('IMAGE CHECK FAILED'); return false; } // Sanitize the image filename $filename = TrackslibHelperImage::sanitize($base_Dir, $picture['name']); $filepath = $base_Dir . $filename; if (!JFile::upload($picture['tmp_name'], $filepath)) { $this->setError(JText::_('COM_TRACKS_UPLOAD_FAILED')); return false; } else { $validData[$field] = $targetpath . '/' . $filename; } } return $validData; }
$count = 0; foreach ($list as $ranking) { $link_ind = JRoute::_(TrackslibHelperRoute::getIndividualRoute($ranking->slug, $project->slug)); $link_team = JRoute::_(TrackslibHelperRoute::getTeamRoute($ranking->teamslug, $project->slug)); ?> <tr> <td><?php echo $rank++; ?> </td> <td> <?php if ($params->get('showpicture', 1) && $ranking->picture_small) { ?> <?php echo TrackslibHelperImage::modalimage($img_dir . $ranking->picture_small, $ranking->first_name, 20); ?> <?php } ?> <a href="<?php echo $link_ind; ?> " title="<?php echo $ranking->last_name . ($ranking->first_name ? ', ' . $ranking->first_name : ''); ?> ::" class="mod-ranking-tip"> <?php echo $ranking->last_name; ?>
?> </h1> <?php } ?> <h2><?php echo $this->round->name; ?> </h2> <!-- Content --> <div class="round-description"> <?php if ($img = TrackslibHelperImage::modalimage($this->round->picture, $this->round->name, 400, array('class' => 'round-image'))) { ?> <?php echo $img; } echo $this->round->description; ?> </div> <div class="tracks-clear"></div> <p class="copyright"> <?php echo TrackslibHelperTools::footer(); ?> </p> </div>