Esempio n. 1
0
 /**
  * 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)
 {
     if ($this->getLayout() == 'edit') {
         $this->displayForm($tpl);
         return;
     }
     RHelperAsset::load('tracks.css');
     $mainframe = JFactory::getApplication();
     $id = JRequest::getVar('id', 0, '', 'int');
     $model = $this->getModel();
     $data = $model->getItem($id);
     $individuals = $this->get('Individuals');
     // Parse description with content plugins
     $data->description = JHTML::_('content.prepare', $data->description);
     $breadcrumbs = $mainframe->getPathWay();
     $breadcrumbs->addItem($data->name, TrackslibHelperRoute::getTeamRoute($id));
     $document = JFactory::getDocument();
     $document->setTitle($data->name);
     $user = JFactory::getUser();
     $this->canEdit = $user->get('id') && ($user->authorise('core.manage', 'com_tracks') || $user->get('id') == $data->admin_id);
     if ($data->picture) {
         $attribs['class'] = "pic";
         $data->picture = JHTML::image(JURI::root() . $data->picture, $data->name, $attribs);
     }
     $this->data = $data;
     $this->individuals = $individuals;
     parent::display($tpl);
 }
Esempio n. 2
0
 public function save()
 {
     $result = parent::save();
     $model = $this->getThisModel();
     if ($result) {
         $id = $model->getId();
         $url = TrackslibHelperRoute::getTeamRoute($id);
         $this->setRedirect($url, JText::_('COM_TRACKS_TEAM_SAVED'));
         return true;
     }
     return $result;
 }
Esempio n. 3
0
echo JText::_('COM_TRACKS_Points');
?>
</th>
      <th><?php 
echo JText::_('COM_TRACKS_Wins');
?>
</th>
      <th><?php 
echo JText::_('COM_TRACKS_Best_rank');
?>
</th>
    </tr>
    <?php 
$k = 0;
foreach ($this->rankings as $ranking) {
    $link_team = JRoute::_(TrackslibHelperRoute::getTeamRoute($ranking->slug, $this->project->slug));
    ?>
      <tr class="<?php 
    echo $k++ % 2 ? 'd1' : 'd0';
    ?>
">
        <td><?php 
    echo $ranking->rank;
    ?>
</td>
        <?php 
    if ($this->projectparams->get('showflag') && $this->params->get('showflag')) {
        ?>
        <td>
          <?php 
        if ($ranking->country_code) {
Esempio n. 4
0
    foreach ($column as $k => $c) {
        ?>
    <td>
      <?php 
        if ($k == 0) {
            ?>
      <div class="letter"><?php 
            echo $letter;
            ?>
</div>
      <?php 
        }
        ?>
      <?php 
        foreach ($c as $r) {
            $link_round = JRoute::_(TrackslibHelperRoute::getTeamRoute($r->slug));
            if ($letter != strtoupper(substr($r->name, 0, 1))) {
                $letter = strtoupper(substr($r->name, 0, 1));
                ?>
          <div class="letter"><?php 
                echo $letter;
                ?>
</div>
          <?php 
            }
            ?>
        <a href="<?php 
            echo $link_round;
            ?>
" title ="<?php 
            echo JText::_('COM_TRACKS_Display_details');
Esempio n. 5
0
 /**
  * Tracks Search method
  *
  * The sql must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav
  *
  * @param   string  $text      Target search string
  * @param   string  $phrase    matching option, exact|any|all
  * @param   string  $ordering  ordering option, newest|oldest|popular|alpha|category
  * @param   mixed   $areas     An array if the search it to be restricted to areas, null if search all
  *
  * @return array
  */
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $limit = $this->params->def('search_limit', 50);
     $text = trim($text);
     if (!$text) {
         return array();
     }
     $section = JText::_('PLG_SEARCH_TRACKS_TRACKS');
     $rows = array();
     if (!$areas || in_array('tracksindividuals', $areas)) {
         $query = $db->getQuery(true);
         switch ($phrase) {
             // Search exact
             case 'exact':
                 $string = $db->Quote('%' . $db->escape($text, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'LOWER(i.first_name) LIKE ' . $string;
                 $wheres2[] = 'LOWER(i.last_name) LIKE ' . $string;
                 $wheres2[] = 'LOWER(i.nickname) LIKE ' . $string;
                 $query->where('(' . implode(' OR ', $wheres2) . ')');
                 break;
                 // Search all or any
             // Search all or any
             case 'all':
             case 'any':
             default:
                 $words = explode(' ', $text);
                 $wheres = array();
                 foreach ($words as $word) {
                     $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                     $wheres2 = array();
                     $wheres2[] = 'LOWER(i.first_name) LIKE ' . $word;
                     $wheres2[] = 'LOWER(i.last_name) LIKE ' . $word;
                     $wheres2[] = 'LOWER(i.nickname) LIKE ' . $word;
                     $wheres[] = implode(' OR ', $wheres2);
                 }
                 $query->where('(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')');
                 break;
         }
         $query->order('i.last_name ASC, i.first_name ASC');
         $query->select('CONCAT_WS(", ", i.last_name, i.first_name) AS title')->select('CONCAT_WS( " / ", ' . $db->Quote($section) . ', ' . $db->Quote(JText::_('PLG_SEARCH_TRACKS_INDIVIDUALS')) . ' ) AS section')->select('CASE WHEN CHAR_LENGTH( i.alias ) THEN CONCAT_WS( \':\', i.id, i.alias ) ELSE i.id END AS slug')->select('NULL AS created')->select('2 AS browsernav')->from('#__tracks_individuals AS i');
         $db->setQuery($query, 0, $limit);
         $results = $db->loadObjectList();
         // The 'output' of the displayed link
         foreach ($results as $key => $row) {
             $results[$key]->href = TrackslibHelperRoute::getIndividualRoute($row->slug);
         }
         $rows = array_merge($rows, $results);
     }
     if (!$areas || in_array('tracksteams', $areas)) {
         $query = $db->getQuery(true);
         switch ($phrase) {
             case 'exact':
                 $string = $db->Quote('%' . $db->escape($text, true) . '%', false);
                 $query->where('LOWER(t.name) LIKE ' . $string);
                 break;
             case 'all':
             case 'any':
             default:
                 $words = explode(' ', $text);
                 $wheres = array();
                 foreach ($words as $word) {
                     $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                     $wheres[] = 'LOWER(t.name) LIKE ' . $word;
                 }
                 $query->where('(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')');
                 break;
         }
         switch ($ordering) {
             case 'alpha':
                 $query->order('t.name ASC');
                 break;
             case 'oldest':
             case 'popular':
             case 'newest':
             default:
                 $query->order('t.name ASC');
         }
         $query->select('t.name AS title')->select('CONCAT_WS( " / ", ' . $db->Quote($section) . ', ' . $db->Quote(JText::_('PLG_SEARCH_TRACKS_TEAMS')) . ' ) AS section')->select('CASE WHEN CHAR_LENGTH( t.alias ) THEN CONCAT_WS( \':\', t.id, t.alias ) ELSE t.id END AS slug')->select('NULL AS created')->select('"2" AS browsernav')->from('#__tracks_teams AS t');
         $db->setQuery($query, 0, $limit);
         $results = $db->loadObjectList();
         foreach ($results as $key => $row) {
             $results[$key]->href = TrackslibHelperRoute::getTeamRoute($row->slug);
         }
         $rows = array_merge($rows, $results);
     }
     if (!$areas || in_array('tracksprojects', $areas)) {
         $query = $db->getQuery(true);
         switch ($phrase) {
             case 'exact':
                 $string = $db->Quote('%' . $db->escape($text, true) . '%', false);
                 $query->where('LOWER(p.name) LIKE ' . $string);
                 break;
             case 'all':
             case 'any':
             default:
                 $words = explode(' ', $text);
                 $wheres = array();
                 foreach ($words as $word) {
                     $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                     $wheres[] = 'LOWER(p.name) LIKE ' . $word;
                 }
                 $query->where('(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')');
                 break;
         }
         switch ($ordering) {
             case 'alpha':
                 $query->order('p.name ASC');
                 break;
             case 'oldest':
             case 'popular':
             case 'newest':
             default:
                 $query->order('p.name ASC');
         }
         $query->select('p.name AS title')->select('CONCAT_WS( " / ", ' . $db->Quote($section) . ', ' . $db->Quote(JText::_('PLG_SEARCH_TRACKS_PROJECTS')) . ' ) AS section')->select('CASE WHEN CHAR_LENGTH( p.alias ) THEN CONCAT_WS( \':\', p.id, p.alias ) ELSE p.id END AS slug')->select('NULL AS created')->select(' "2" AS browsernav')->from('#__tracks_projects AS p');
         $db->setQuery($query, 0, $limit);
         $results = $db->loadObjectList();
         foreach ($results as $key => $row) {
             $results[$key]->href = TrackslibHelperRoute::getProjectRoute($row->slug);
         }
         $rows = array_merge($rows, $results);
     }
     if (!$areas || in_array('tracksrounds', $areas)) {
         $query = $db->getQuery(true);
         switch ($phrase) {
             case 'exact':
                 $string = $db->Quote('%' . $db->escape($text, true) . '%', false);
                 $query->where('LOWER(r.name) LIKE ' . $string);
                 break;
             case 'all':
             case 'any':
             default:
                 $words = explode(' ', $text);
                 $wheres = array();
                 foreach ($words as $word) {
                     $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                     $wheres[] = 'LOWER(r.name) LIKE ' . $word;
                 }
                 $query->where('(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')');
                 break;
         }
         switch ($ordering) {
             case 'alpha':
                 $query->order('r.name ASC');
                 break;
             case 'oldest':
             case 'popular':
             case 'newest':
             default:
                 $query->order('r.name ASC');
         }
         $query->select('r.name AS title')->select('CONCAT_WS( " / ", ' . $db->Quote($section) . ', ' . $db->Quote(JText::_('PLG_SEARCH_TRACKS_ROUNDS')) . ' ) AS section')->select('CASE WHEN CHAR_LENGTH( r.alias ) THEN CONCAT_WS( \':\', r.id, r.alias ) ELSE r.id END AS slug')->select('NULL AS created')->select('"2" AS browsernav')->from('#__tracks_rounds AS r');
         $db->setQuery($query, 0, $limit);
         $results = $db->loadObjectList();
         foreach ($results as $key => $row) {
             $results[$key]->href = TrackslibHelperRoute::getRoundRoute($row->slug);
         }
         $rows = array_merge($rows, $results);
     }
     return $rows;
 }
Esempio n. 6
0
            ?>
					<th><?php 
            echo JText::_('COM_TRACKS_Points');
            ?>
</th>
				<?php 
        }
        ?>
			</tr>
			<?php 
        $k = 0;
        foreach ($subround->results as $result) {
            $ind_slug = $result->individual_id . ':' . JFilterOutput::stringURLSafe($result->first_name . ' ' . $result->last_name);
            $link_ind = JRoute::_(TrackslibHelperRoute::getIndividualRoute($ind_slug, $this->project->slug));
            $team_slug = $result->team_id . ':' . JFilterOutput::stringURLSafe($result->team_name);
            $link_team = JRoute::_(TrackslibHelperRoute::getTeamRoute($team_slug));
            ?>
				<tr class="<?php 
            echo $k++ % 2 ? 'd1' : 'd0';
            ?>
">
					<td>
						<?php 
            if ($result->rank) {
                echo $result->rank;
            } else {
                echo "-";
            }
            ?>
					</td>
					<?php 
Esempio n. 7
0
        ?>
<th><?php 
        echo JText::_('MOD_TRACKS_RESULTS_Points');
        ?>
</th><?php 
    }
    ?>
    </tr>
	</thead>
  <tbody>
    <?php 
    $rank = 1;
    $count = 0;
    foreach ($list->results as $rows) {
        $link_ind = JRoute::_(TrackslibHelperRoute::getIndividualRoute($rows->slug, $project->slug));
        $link_team = JRoute::_(TrackslibHelperRoute::getTeamRoute($rows->teamslug, $project->slug));
        ?>
      <tr>
        <td><?php 
        echo $rows->rank;
        ?>
</td>
        <td>
          <a href="<?php 
        echo $link_ind;
        ?>
"
             title="<?php 
        echo trim($rows->first_name . ' ' . $rows->last_name) . '::' . $rows->performance;
        ?>
" class="mod-result-tip"><?php 
Esempio n. 8
0
 */
defined('_JEXEC') or die('Restricted access');
?>

<div id="tracks">

	<h2><?php 
echo $this->project->name . ' ' . JText::_('COM_TRACKS_Participants');
?>
</h2>

	<ul class="individualsGallery">
		<?php 
foreach ($this->individuals as $obj) {
    $link_ind = JRoute::_(TrackslibHelperRoute::getIndividualRoute($obj->slug, $this->project->slug));
    $link_team = JRoute::_(TrackslibHelperRoute::getTeamRoute($obj->teamslug, $this->project->slug));
    ?>
			<li>
				<div>
					<a href="<?php 
    echo $link_ind;
    ?>
"
					   title="<?php 
    echo $obj->first_name . ' ' . $obj->last_name;
    ?>
">
						<?php 
    echo $obj->picture;
    ?>
					</a>
Esempio n. 9
0
			<?php 
}
?>
			<?php 
if (isset($this->data->projectdata->team_name) && !empty($this->data->projectdata->team_name)) {
    ?>
				<tr>
					<td width="100" align="right" class="key">
						<?php 
    echo JText::_('COM_TRACKS_INDIVIDUAL_TEAM');
    ?>
:
					</td>
					<td>
						<?php 
    echo JHTML::link(TrackslibHelperRoute::getTeamRoute($this->data->projectdata->teamslug, $this->data->projectdata->projectslug), $this->data->projectdata->team_name);
    ?>
					</td>
				</tr>
			<?php 
}
?>
			<?php 
if ($this->data->nickname) {
    ?>
				<tr>
					<td width="100" align="right" class="key">
						<label for="nickname">
							<?php 
    echo JText::_('COM_TRACKS_Nickname');
    ?>