Esempio n. 1
0
 public function save()
 {
     $result = parent::save();
     $model = $this->getThisModel();
     if ($result) {
         $id = $model->getId();
         $url = TrackslibHelperRoute::getIndividualRoute($id);
         $this->setRedirect($url, JText::_('COM_TRACKS_INDIVIDUAL_SAVED'));
         return true;
     }
     return $result;
 }
Esempio n. 2
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)
 {
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     if (!$user->id) {
         print JText::_('COM_TRACKS_You_must_register_to_access_this_page');
         return;
     }
     $model = $this->getModel();
     $data = $model->getData($user->id);
     if (!$data->id) {
         // No tracks individual associated to profile
         $params = $mainframe->getParams('com_tracks');
         if ($params->get('user_registration')) {
             $mainframe->redirect(TrackslibHelperRoute::getEditIndividualRoute());
         } else {
             $msg = JText::_('COM_TRACKS_No_tracks_individual_associated_to_your_account');
             $mainframe->redirect('index.php?option=com_tracks', $msg);
         }
     }
     $mainframe->redirect(TrackslibHelperRoute::getIndividualRoute($data->id));
 }
Esempio n. 3
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::getIndividualRoute($r->slug));
            $l = $this->firstLetter($r->{$first});
            if ($l != $letter) {
                $letter = $l;
                ?>
								<div class="letter"><?php 
                echo $letter;
                ?>
</div>
							<?php 
            }
            ?>
							<a href="<?php 
            echo $link_round;
            ?>
"
Esempio n. 4
0
</th>
			<?php 
}
?>

			<th class="points"><?php 
echo JText::_('COM_TRACKS_Points');
?>
</th>
		</tr>
		</thead>
		<tbody>
		<?php 
$i = 0;
foreach ($this->rows as $ranking) {
    $link_ind = JRoute::_(TrackslibHelperRoute::getIndividualRoute($ranking->slug, $this->project->slug));
    $link_team = JRoute::_(TrackslibHelperRoute::getTeamRoute($ranking->teamslug, $this->project->slug));
    ?>
			<tr class="<?php 
    echo $i ? 'd1' : 'd0';
    ?>
">
				<td class="rank"><?php 
    echo $ranking->rank;
    ?>
</td>

				<?php 
    if ($this->params->get('shownumber')) {
        ?>
					<td class="number"><?php 
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
    if ($showpoints) {
        ?>
<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;
        ?>
Esempio n. 7
0
</h3>
	<?php 
    foreach ($this->individuals as $proj) {
        ?>
	<div class="project-inds"><span class="project-title"><?php 
        echo current($proj)->project_name;
        ?>
</span>
	<?php 
        foreach ($proj as $i) {
            ?>
	<?php 
            $text = ($i->number ? $i->number . ' ' : '') . $i->first_name . ' ' . $i->last_name;
            ?>
	<div class="team-ind"><?php 
            echo JHTML::link(TrackslibHelperRoute::getIndividualRoute($i->slug, $i->projectslug), $text);
            ?>
</div>
	<?php 
        }
        ?>
	</div>
	<?php 
    }
}
?>
<div class="clear"></div>
<p class="copyright">
  <?php 
echo TrackslibHelperTools::footer();
?>