[NEW] Save filter of the project homepage
Save the filter into the user parameters
This commit is contained in:
parent
7c653c0873
commit
6e10abe427
@ -39,8 +39,10 @@ $hookmanager->initHooks(array('projectsindex'));
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('projects', 'companies'));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$search_project_user = GETPOST('search_project_user', 'int');
|
||||
$mine = GETPOST('mode', 'aZ09') == 'mine' ? 1 : 0;
|
||||
if ($mine == 0 && $search_project_user === '') $search_project_user = $user->conf->MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX;
|
||||
if ($search_project_user == $user->id) $mine = 1;
|
||||
|
||||
// Security check
|
||||
@ -54,6 +56,24 @@ $sortorder = GETPOST("sortorder", 'alpha');
|
||||
$max = 3;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook)) {
|
||||
if ($action == 'refresh_search_project_user') {
|
||||
$search_project_user = GETPOST('search_project_user', 'int');
|
||||
$tabparam = array("MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX" => $search_project_user);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
$result = dol_set_user_param($db, $conf, $user, $tabparam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -81,6 +101,7 @@ else $titleall = $langs->trans("AllAllowedProjects").'<br><br>';
|
||||
$morehtml = '';
|
||||
$morehtml .= '<form name="projectform" method="POST">';
|
||||
$morehtml .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtml .= '<input type="hidden" name="action" value="refresh_search_project_user">';
|
||||
$morehtml .= '<SELECT name="search_project_user">';
|
||||
$morehtml .= '<option name="all" value="0"'.($mine ? '' : ' selected').'>'.$titleall.'</option>';
|
||||
$morehtml .= '<option name="mine" value="'.$user->id.'"'.(($search_project_user == $user->id) ? ' selected' : '').'>'.$langs->trans("ProjectsImContactFor").'</option>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user