diff options
author | Preston Cody <codeman@gentoo.org> | 2006-12-11 00:51:46 +0000 |
---|---|---|
committer | Preston Cody <codeman@gentoo.org> | 2006-12-11 00:51:46 +0000 |
commit | f118127def4f467a97a460ebd776a944f1ec86be (patch) | |
tree | 6e0bfcfc03bad83ce3a2257feaced534fdb2c761 /scire | |
parent | updating DB.php with a $db->query() function (diff) | |
download | scire-f118127def4f467a97a460ebd776a944f1ec86be.tar.gz scire-f118127def4f467a97a460ebd776a944f1ec86be.tar.bz2 scire-f118127def4f467a97a460ebd776a944f1ec86be.zip |
adding job page settings. very similar to the other two/three
svn path=/; revision=173
Diffstat (limited to 'scire')
-rwxr-xr-x | scire/settings.php | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/scire/settings.php b/scire/settings.php index 0923c16..7851a0a 100755 --- a/scire/settings.php +++ b/scire/settings.php @@ -34,6 +34,47 @@ if ($_POST['save_settings']) { } } } +######################################## POST +if ($_POST['save_Jobs_settings']) { + pre_var_dump($_POST); + foreach ($_POST as $name => $value) { + if ($name == "sorton") { + if ($value != $_SESSION['settings']['jobs_page_sorton']) { #The value doesn't match, we need to update. + scire_set_setting($_SESSION['userid'], 'jobs_page_sorton', $value); + } else { + scire_add_setting($_SESSION['userid'], 'jobs_page_sorton', $value); + } + $_SESSION['settings']['jobs_page_sorton'] = $value; + } + elseif ($name == "sortdir") { + if ($value != $_SESSION['settings']['jobs_page_sortdir']) { #The value doesn't match, we need to update. + scire_set_setting($_SESSION['userid'], 'jobs_page_sortdir', $value); + } else { + scire_add_setting($_SESSION['userid'], 'jobs_page_sortdir', $value); + } + $_SESSION['settings']['jobs_page_sortdir'] = $value; + } + elseif (substr($name,0, 4) == "Jobs" and $value) { + $temp = substr($name,5); + $jobs_page_fields[$temp] = $value; + print "Adding field $name ... $value"; + } + } + #Done with looping + pre_var_dump($jobs_page_fields); + asort($jobs_page_fields); + $keys = array_keys($jobs_page_fields); + $fields_string = join(',', $keys); + + #print $fields_string; + if ($fields_string != $_SESSION['settings']['jobs_page_fields']) { + scire_set_setting($_SESSION['userid'], 'jobs_page_fields', $fields_string); + } else { + scire_add_setting($_SESSION['userid'], 'jobs_page_fields', $fields_string); + } + $_SESSION['settings']['jobs_page_fields'] = $fields_string; +} + ######################################## if ($_POST['save_Clients_settings']) { foreach ($_POST as $name => $value) { @@ -148,7 +189,6 @@ switch($_GET['View']) { $fields = get_users_fields(); $smarty->assign('fields', $fields); - foreach (explode(',',$_SESSION['settings']['users_page_fields']) as $key=> $curr_fieldname) { $curr_list[$curr_fieldname] = ($key+1); } @@ -167,11 +207,16 @@ switch($_GET['View']) { $smarty->assign($jobs_set, $settings[$jobs_set]); } } - $fields = array(); - array_push($fields, array('fieldname' => 'hostname', 'name' => 'Client Hostname')); - array_push($fields, array('fieldname' => 'group', 'name' => 'Client Group')); - array_push($fields, array('fieldname' => 'priority', 'name' => 'Priority Level')); + $fields = get_jobs_fields(); $smarty->assign('fields', $fields); + + foreach (explode(',',$_SESSION['settings']['jobs_page_fields']) as $key=> $curr_fieldname) { + $curr_list[$curr_fieldname] = ($key+1); + } + var_dump($curr_list); + $smarty->assign('curr_list', $curr_list); + $smarty->assign('sorton', $_SESSION['settings']['jobs_page_sorton']); + $smarty->assign('sortdir', $_SESSION['settings']['jobs_page_sortdir']); break; default: #Show users. |