Show more information about user when selected

This commit is contained in:
Marien Fressinaud
2014-10-16 17:08:48 +02:00
parent 2796cc9ae5
commit d4ad951b9b
5 changed files with 32 additions and 13 deletions

View File

@@ -87,11 +87,24 @@ class FreshRSS_user_Controller extends Minz_ActionController {
* This action displays the user management page.
*/
public function manageAction() {
if (!FreshRSS_Auth::hasAccess('admin')) {
Minz_Error::error(403,
array('error' => array(_t('access_denied'))));
}
Minz_View::prependTitle(_t('users.manage') . ' · ');
$this->view->current_user = Minz_Request::param(
'u', Minz_Session::param('currentUser', '_')
);
$userDAO = new FreshRSS_UserDAO();
$username = Minz_Request::param('u', Minz_Session::param('currentUser'));
if (!$userDAO->exist($username)) {
$username = Minz_Session::param('currentUser');
}
$this->view->current_user = $username;
$entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user);
$this->view->nb_articles = $entryDAO->count();
$this->view->size_user = $entryDAO->size();
}
public function createAction() {

View File

@@ -2,30 +2,30 @@
class FreshRSS_Factory {
public static function createFeedDao() {
public static function createFeedDao($username = null) {
$db = Minz_Configuration::dataBase();
if ($db['type'] === 'sqlite') {
return new FreshRSS_FeedDAOSQLite();
return new FreshRSS_FeedDAOSQLite($username);
} else {
return new FreshRSS_FeedDAO();
return new FreshRSS_FeedDAO($username);
}
}
public static function createEntryDao() {
public static function createEntryDao($username = null) {
$db = Minz_Configuration::dataBase();
if ($db['type'] === 'sqlite') {
return new FreshRSS_EntryDAOSQLite();
return new FreshRSS_EntryDAOSQLite($username);
} else {
return new FreshRSS_EntryDAO();
return new FreshRSS_EntryDAO($username);
}
}
public static function createStatsDAO() {
public static function createStatsDAO($username = null) {
$db = Minz_Configuration::dataBase();
if ($db['type'] === 'sqlite') {
return new FreshRSS_StatsDAOSQLite();
return new FreshRSS_StatsDAOSQLite($username);
} else {
return new FreshRSS_StatsDAO();
return new FreshRSS_StatsDAO($username);
}
}

View File

@@ -53,4 +53,8 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
}
}
}
public function exist($username) {
return file_exists(DATA_PATH . '/' . $username . '_user.php');
}
}

View File

@@ -60,7 +60,7 @@
<div class="form-group">
<p class="group-name"><?php echo _t('current_user'); ?></p>
<div class="group-controls">
<p><?php echo formatNumber($this->nb_total), ' ', _t('articles'), ', ', formatBytes($this->size_user); ?></p>
<p><?php echo _t('articles', formatNumber($this->nb_total)), ' ', formatBytes($this->size_user); ?></p>
<input type="hidden" name="optimiseDatabase" value="1" />
<button type="submit" class="btn btn-important"><?php echo _t('optimize_bdd'); ?></button>
<?php echo _i('help'); ?> <?php echo _t('optimize_todo_sometimes'); ?>

View File

@@ -63,6 +63,8 @@
<option data-url="<?php echo _url('user', 'manage', 'u', $username); ?>" <?php echo $this->current_user === $username ? 'selected="selected"' : ''; ?> value="<?php echo $username; ?>"><?php echo $username; ?></option>
<?php } ?>
</select>
<p><?php echo _t('articles', formatNumber($this->nb_articles)), ', ', formatBytes($this->size_user); ?></p>
</div>
</div>