function show($area = null) { global $page, $fs, $db, $proj, $user, $conf; $perpage = '20'; if (isset($user->infos['tasks_perpage'])) { $perpage = $user->infos['tasks_perpage']; } $pagenum = max(1, Get::num('pagenum', 1)); $offset = $perpage * ($pagenum - 1); // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); if (!is_array($visible) || !count($visible) || !$visible[0]) { $visible = array('id'); } list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage); $page->assign('tasks', $tasks); $page->assign('offset', $offset); $page->assign('perpage', $perpage); $page->assign('pagenum', $pagenum); $page->assign('visible', $visible); // List of task IDs for next/previous links $_SESSION['tasklist'] = $id_list; $page->assign('total', count($id_list)); // Javascript replacement if (Get::val('toggleadvanced')) { $advanced_search = intval(!Req::val('advancedsearch')); Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30); $_COOKIE['advancedsearch'] = $advanced_search; } // Update check {{{ if (Get::has('hideupdatemsg')) { unset($_SESSION['latest_version']); } else { if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) { if (!isset($_SESSION['latest_version'])) { $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS); //if for some silly reason we get and empty response, we use the actual version $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest; $db->x->execParam('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check')); } } } if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) { $page->assign('updatemsg', true); } // }}} $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist')); $page->pushTpl('index.tpl'); }
/** * show * * @access public * @return void */ function show() { global $proj, $page, $fs; // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, 0); $page = new FSTpl(); $page->assign('tasks', $tasks); $page->assign('visible', $visible); if (Get::val('type') == 'iCal') { $datecols = array('dateopened' => 'date_opened', 'lastedit' => 'max_date', 'dateclosed' => 'date_closed'); header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: filename="export.ics"'); $page->assign('datecols', $datecols); $page->finish('icalexport.tpl'); } else { header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: filename="export.csv"'); $page->finish('csvexport.tpl'); } }
} $perpage = '250'; if (isset($user->infos['tasks_perpage']) && $user->infos['tasks_perpage'] > 0) { $perpage = $user->infos['tasks_perpage']; } $pagenum = Get::num('pagenum', 1); if ($pagenum < 1) { $pagenum = 1; } $offset = $perpage * ($pagenum - 1); // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); if (!is_array($visible) || !count($visible) || !$visible[0]) { $visible = array('id'); } list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage); //-- Added 2/1/2014 LAE. See if user wants to export the task list if (Get::has('export_list')) { export_task_list(); } $page->uses('tasks', 'offset', 'perpage', 'pagenum', 'visible'); // List of task IDs for next/previous links $_SESSION['tasklist'] = $id_list; $page->assign('total', count($id_list)); // Send user variables to the template $result = $db->Query('SELECT DISTINCT u.user_id, u.user_name, u.real_name, g.group_name, g.project_id FROM {users} u LEFT JOIN {users_in_groups} uig ON u.user_id = uig.user_id LEFT JOIN {groups} g ON g.group_id = uig.group_id WHERE (g.show_as_assignees = 1 OR g.is_admin = 1) AND (g.project_id = 0 OR g.project_id = ?) AND u.account_enabled = 1
$pagenum = 1; } $offset = $perpage * ($pagenum - 1); // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); if (!is_array($visible) || !count($visible) || !$visible[0]) { $visible = array('id'); } // Remove columns the user is not allowed to see if (in_array('estimated_effort', $visible) && !$user->perms('view_estimated_effort')) { unset($visible[array_search('estimated_effort', $visible)]); } if (in_array('effort', $visible) && !$user->perms('view_current_effort_done')) { unset($visible[array_search('effort', $visible)]); } list($tasks, $id_list, $totalcount, $forbiddencount) = Backend::get_task_list($_GET, $visible, $offset, $perpage); //-- Added 2/1/2014 LAE. See if user wants to export the task list if (Get::has('export_list')) { export_task_list(); } $page->uses('tasks', 'offset', 'perpage', 'pagenum', 'visible'); // List of task IDs for next/previous links # Mmh the result is persistent in $_SESSION a bit for the length of each user session and can lead to a DOS quite fast on bigger installs? # Do we really need prev-next on task details view or can we find an alternative solution? # And using the $_SESSION for that is currently not working correct if someone uses 2 browser tabs for 2 different projects. $_SESSION['tasklist'] = $id_list; $page->assign('total', $totalcount); $page->assign('forbiddencount', $forbiddencount); // Send user variables to the template $result = $db->Query('SELECT DISTINCT u.user_id, u.user_name, u.real_name, g.group_name, g.project_id FROM {users} u