Fix project links in header

This commit is contained in:
Eike Foken
2011-09-08 15:42:13 +02:00
parent bf40c38f13
commit e02b3442cd
2 changed files with 9 additions and 13 deletions

View File

@@ -43,7 +43,8 @@ class MY_Config extends CI_Config {
*/ */
public function site_url($uri = '', $relative = true) { public function site_url($uri = '', $relative = true) {
$url = parent::site_url($uri); $url = parent::site_url($uri);
return $relative ? parse_url($url, PHP_URL_PATH) : $url; $parts = parse_url($url);
return $relative ? $parts['path'] . (isset($parts['query']) ? '?' . $parts['query'] : '') : $url;
} }
} }

View File

@@ -33,21 +33,18 @@
<?=_('Current project:');?>&nbsp; <?=_('Current project:');?>&nbsp;
<select name="activeProject"> <select name="activeProject">
<?php <?php
// get the active project, if there is one // get the active project, if there is one
if ($this->input->get('active_project')) if ($this->input->get('active_project'))
$active_project = $this->project->getById($this->input->get('active_project')); $active_project = $this->project->getById($this->input->get('active_project'));
else else
$active_project = false; $active_project = false;
$projects = $this->project->getAll();
if(!$active_project): if(!$active_project):
?> ?>
<option disabled="disabled" selected="selected"><strong><?=_('Select a project');?></strong></option> <option disabled="disabled" selected="selected"><strong><?=_('Select a project');?></strong></option>
<?php <?php
endif; endif;
foreach ($projects as $project): foreach ($this->project->getAll() as $project):
?> ?>
<option title="<?=$project['name']?>" value="<?=site_url('projects/detail/' . $project['id']) . '?active_project=' . $project['id'];?>"<?=($active_project == $project['id']) ? ' selected' : '';?>><?=$project['mediumname'];?></option> <option title="<?=$project['name']?>" value="<?=site_url('projects/detail/' . $project['id']) . '?active_project=' . $project['id'];?>"<?=($active_project == $project['id']) ? ' selected' : '';?>><?=$project['mediumname'];?></option>
<?php <?php
@@ -55,7 +52,7 @@
?> ?>
</select> </select>
</div> </div>
<div class="menu"><?= _('Hello,') ?> <a href="<?=base_url();?>"><?=$this->user->profile()->firstname;?> <?=$this->user->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help');?></a> | <?=anchor('auth/settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div> <div class="menu"><?=_('Hello,');?> <a href="<?=site_url('users/' . $this->user->profile()->id);?>"><?=$this->user->profile()->firstname;?> <?=$this->user->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help');?></a> | <?=anchor('auth/settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div>
</div> </div>
<div id="wrapper"> <div id="wrapper">
@@ -101,7 +98,7 @@
</div> </div>
<div class="title"> <div class="title">
<h2><a href="<?=site_url('projects');?>" title="<?=_('Show all projects');?>"><?=_('Projects');?></a></h2> <h2><?=_('Projects');?></h2>
</div> </div>
<div class="navigation"> <div class="navigation">
<ul> <ul>
@@ -109,10 +106,9 @@
<a href="javascript:void(0);"><?=_('My projects');?></a> <a href="javascript:void(0);"><?=_('My projects');?></a>
<ul> <ul>
<?php <?php
$projects = $this->project->getOwn(); foreach ($this->project->getOwn() as $project):
foreach ($projects as $project):
?> ?>
<li><a href="<?=site_url('projects/detail/' . $project['id']);?>"><?=$project['mediumname'];?></a></li> <li><?=anchor('projects/detail/' . $project['id'] . '?active_project=' . $project['id'], $project['mediumname']);?></li>
<?php <?php
endforeach; endforeach;
?> ?>
@@ -128,10 +124,9 @@
<a href="javascript:void(0);"><?=_('Public projects');?></a> <a href="javascript:void(0);"><?=_('Public projects');?></a>
<ul> <ul>
<?php <?php
$projects = $this->project->getPublic(); foreach ($this->project->getPublic() as $project):
foreach ($projects as $project):
?> ?>
<li><a href="<?=site_url('projects/detail/' . $project['id']);?>"><?=$project['mediumname'];?></a></li> <li><?=anchor('projects/detail/' . $project['id'] . '?active_project=' . $project['id'], $project['mediumname']);?></li>
<?php <?php
endforeach; endforeach;
?> ?>