getCurrentUser()->getPreference($pref_name);
if ($old_pref_value) {
list($old_hide,$old_count) = explode('|', $old_pref_value);
}
// Make sure they are both 0 if never set before
if ($old_count == false) { $old_count = 0; }
if ($old_hide == false) { $old_hide = 0; }
if ($item_id == $db_item_id) {
if (isset($hide)) {
$pref_value = "$hide|$count";
} else {
$pref_value = "$old_hide|$count";
$hide = $old_hide;
}
} else {
if ($old_hide) {
// if items are hidden keep the old count and keep pref as is
$pref_value = $old_pref_value;
} else {
// only update the item count if the items are visible
// if they are hidden keep reporting the old count
$pref_value = "$old_hide|$count";
}
$hide = $old_hide;
}
// Update pref value if needed
if ($old_pref_value != $pref_value) {
UserManager::instance()->getCurrentUser()->setPreference($pref_name, $pref_value);
}
if ($hide) {
$hide_url= ' ';
$hide_now = true;
} else {
$hide_url= ' ';
$hide_now = false;
}
return array($hide_now, $count-$old_count, $hide_url);
}
function my_hide($svc, $db_item_id, $item_id, $hide) {
$pref_name = 'my_hide_'.$svc.$db_item_id;
$old_pref_value = UserManager::instance()->getCurrentUser()->getPreference($pref_name);
if ($old_pref_value)
list($old_hide, $old_count) = explode('|', $old_pref_value);
if (!isset($old_hide))
$old_hide = false;
// Make sure they are both 0 if never set before
if ($old_hide == false) { $old_hide = 0; }
if ($item_id == $db_item_id) {
if (!isset($hide)) {
$hide = $old_hide;
}
} else {
$hide = $old_hide;
}
return $hide;
}
function my_format_as_flag($assigned_to, $submitted_by, $multi_assigned_to=null) {
$AS_flag = '';
if ($assigned_to == user_getid()) {
$AS_flag = 'A';
} else if ($multi_assigned_to) {
// For multiple assigned to
for ($i=0; $i'.$AS_flag.']'; }
return $AS_flag;
}
/* second case */
function my_format_as_flag2($assignee, $submitter) {
$AS_flag = '';
if ($assignee) $AS_flag = 'A';
if ($submitter) $AS_flag .= 'S';
if ($AS_flag != '') $AS_flag = '['.$AS_flag.']';
return $AS_flag;
}
function my_item_count($total, $new) {
return '['.$total.($new ? ", ".vsprintf(_('%s new items'), array($new))."]" : ']');
}
?>