Merge branch 'master' of disposed.de:scattport

This commit is contained in:
Karsten Heiken
2011-09-16 16:38:59 +02:00
2 changed files with 11 additions and 2 deletions

View File

@@ -98,7 +98,11 @@ class Project extends CI_Model {
* @param string $userId * @param string $userId
* @return array All accessible projects * @return array All accessible projects
*/ */
public function getAccessible($userId) { public function getAccessible($userId = '') {
if (empty($userId)) {
$userId = $this->session->userdata('user_id');
}
$shares = array(); $shares = array();
$query = $this->db->get_where('shares', array('user_id' => $userId)); $query = $this->db->get_where('shares', array('user_id' => $userId));
foreach ($query->result_array() as $share) { foreach ($query->result_array() as $share) {

View File

@@ -51,7 +51,12 @@
<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 ($this->project->getAll() as $project): if ($this->access->isAdmin()) {
$theProjects = $this->project->getAll();
} else {
$theProjects = $this->project->getAccessible();
}
foreach ($theProjects as $project):
?> ?>
<option title="<?=$project['name']?>" value="<?=site_url('projects/detail/' . $project['id']) . '?active_project=' . $project['id'];?>"<?=($active_project['id'] == $project['id']) ? ' selected' : '';?>><?=$project['mediumname'];?></option> <option title="<?=$project['name']?>" value="<?=site_url('projects/detail/' . $project['id']) . '?active_project=' . $project['id'];?>"<?=($active_project['id'] == $project['id']) ? ' selected' : '';?>><?=$project['mediumname'];?></option>
<?php <?php