<?php /* @package TaskFreak @since 0.1 @version 1.0 List recently updated tasks */ $this->baselink = add_query_arg('mode', 'recent', tzn_tools::baselink()); $this->log = new tfk_item_status_info(); switch ($this->filters['filter_recent']) { case 'tasks': $filter = 'log.item_id <> 0 AND log.comment_id = 0'; break; case 'projects': $filter = 'log.project_id <> 0'; break; case 'comments': $filter = 'log.comment_id <> 0'; break; default: $filter = ''; } if ($this->options['number_updates']) { $date_delta = $this->options['number_updates']; } else { $date_delta = 7; } $this->log->load_list(array('where' => 'DATEDIFF(NOW(), log_date) < ' . $date_delta . ($filter ? ' AND ' . $filter : ''))); $this->view('front/recent.php');
<?php $this->view_inc('front/nav.php'); ?> <ul id="tfk_breadcrumb"> <li><a href="<?php echo esc_url(add_query_arg('mode', 'projects', tzn_tools::baselink())); ?> "><?php _e('All Projects', 'taskfreak'); ?> </a></li> <li><?php echo $this->project->html('name'); ?> </li> </ul> <?php if ($this->project->has('description')) { echo '<div id="tfk_proj_desc">' . $this->project->html('description') . '</div>'; // already all in HTML, with <p> } // list tasks (with filter links) $this->view_inc('front/list.php');
<?php /* @package TaskFreak @since 0.1 @version 1.0 List tasks */ $this->baselink = add_query_arg('mode', 'tasks', tzn_tools::baselink()); $this->data = new tfk_item_info(); $sort_params = array('priority', 'deadline_date', 'proximity', 'title', 'name', 'display_name', 'log_date', 'item_status_action_code', 'comment_count', 'file_count'); $sort = isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sort_params) ? $_REQUEST['sort'] : 'proximity'; $order = isset($_REQUEST['ord']) && in_array($_REQUEST['ord'], array('asc', 'desc')) ? $_REQUEST['ord'] : 'ASC'; $this->page = isset($_REQUEST['pg']) && preg_match('/^\\d+$/', $_REQUEST['pg']) ? $_REQUEST['pg'] : 1; if (isset($_REQUEST['npg']) && preg_match('/^\\d+$/', $_REQUEST['npg'])) { // useful if JS is disabled if (!headers_sent()) { setcookie('tfk_page_size', $_REQUEST['npg']); } $this->page_size = $_REQUEST['npg']; } elseif (isset($_COOKIE['tfk_page_size']) && preg_match('/^\\d+$/', $_COOKIE['tfk_page_size'])) { $this->page_size = $_COOKIE['tfk_page_size']; } elseif ($this->options['tasks_per_page']) { $this->page_size = $this->options['tasks_per_page']; } else { $this->page_size = 5; } // show "new task" or not $project = new tfk_project(); $this->user_can_post = $project->load_count(array('where' => tfk_user::get_roles_sql('who_post') . ' AND trashed = 0')); // show only drafts to their author and to users who have the right to manage the project
<?php $iid = $this->data->get_uid(); ?> <a id="tfk_back_list" href="<?php echo esc_url(add_query_arg('view', $iid, remove_query_arg(array('hist', 'noheader')))); ?> "><?php _e('Back to task', 'taskfreak'); ?> </a> <h2 id="tfk_task_title"> <a id="tfk_task_link" href="<?php echo esc_url(add_query_arg('view', $iid, tzn_tools::baselink())); ?> "> <?php echo $this->data->get('title'); ?> </a> </h2> <h3 id="tfk_task_project_name"><?php echo __('In', 'taskfreak') . ' ' . $this->data->get('project')->html('name'); ?> </h3> <h4><?php _e('Task history', 'taskfreak'); ?> </h4>
public function tfk_all() { $this->_mode = 'return'; // Load options $this->options = get_option('tfk_options'); // update page url in options for widgets $baselink = tzn_tools::baselink(); if ($this->options['page_url'] != $baselink || $this->options['page_id'] != get_the_ID()) { $this->options['page_url'] = $baselink; $this->options['page_id'] = get_the_ID(); update_option('tfk_options', $this->options); } $this->mode = ''; // List filters // TODO keep in session $this->filters = array('filter_project' => '20', 'filter_task' => '20', 'filter_recent' => 'all'); foreach (array('filter_project', 'filter_task') as $key) { if (isset($_GET[$key]) && ($_GET[$key] == 'all' || preg_match('/^\\d+$/', $_GET[$key]))) { $this->filters[$key] = $_GET[$key]; } } if (isset($_GET['filter_recent']) && in_array($_GET['filter_recent'], array('all', 'tasks', 'projects', 'comments'))) { $this->filters['filter_recent'] = $_GET['filter_recent']; } // ACTION if (isset($_GET['hist'])) { // task history (called by Ajax if JS is enabled) $this->call('front/task_history.php'); } else { if (isset($_GET['view'])) { // view task $this->call('front/task_view.php'); } else { if (isset($_GET['edit']) && isset($_GET['js'])) { // update task status $this->call('front/task_status.php'); } else { if (isset($_REQUEST['edit'])) { // edit or create task $this->call('front/task_edit.php'); } else { if (isset($_GET['proj']) && isset($_GET['js'])) { // get users list for the project (ajax call) $this->call('front/project_users.php'); } else { if (isset($_REQUEST['proj'])) { $this->mode = 'projects'; // tell nav view it's a project so we can add tasks filter // view project $this->call('front/project_view.php'); } else { $this->mode = $this->options['tfk_all']; if (isset($_REQUEST['mode'])) { $this->mode = $_REQUEST['mode']; } switch ($this->mode) { case 'recent': // list recent updates $this->call('front/task_recent.php'); break; case 'tasks': // list tasks $this->call('front/task_list.php'); break; case 'projects': default: // list projects $this->mode = 'projects'; $this->call('front/project_list.php'); break; } } } } } } } // Return view return $this->view_front(); }
<ul id="tfk_filters"> <?php // these are the links used for main navigation $arr = array('projects' => __('Projects', 'taskfreak'), 'tasks' => __('Tasks', 'taskfreak'), 'recent' => __('Updates', 'taskfreak')); foreach ($arr as $lnk => $label) { if ($this->mode == $lnk) { echo '<li class="tfk_selected_filter">' . $label . '</li>'; } else { echo '<li><a href="' . esc_url(add_query_arg('mode', $lnk, tzn_tools::baselink())) . '">' . $label . '</a></li>'; } } ?> </ul>
<?php /* @package TaskFreak @since 0.1 @version 1.0 View Project and list tasks */ $this->pid = intval($_REQUEST['proj']); $this->baselink = add_query_arg(array('mode' => 'projects', 'proj' => $this->pid), tzn_tools::baselink()); $sort_params = array('priority', 'deadline_date', 'title', 'name', 'display_name', 'log_date', 'item_status_action_code', 'comment_count', 'file_count'); $sort = isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sort_params) ? $_REQUEST['sort'] : 'proximity'; $order = isset($_REQUEST['ord']) && in_array($_REQUEST['ord'], array('asc', 'desc')) ? $_REQUEST['ord'] : 'ASC'; $this->page = isset($_REQUEST['pg']) && preg_match('/^\\d+$/', $_REQUEST['pg']) ? $_REQUEST['pg'] : 1; if (isset($_REQUEST['npg']) && preg_match('/^\\d+$/', $_REQUEST['npg'])) { if (!headers_sent()) { setcookie('tfk_page_size', $_REQUEST['npg']); } $this->page_size = $_REQUEST['npg']; } elseif (isset($_COOKIE['tfk_page_size']) && preg_match('/^\\d+$/', $_COOKIE['tfk_page_size'])) { $this->page_size = $_COOKIE['tfk_page_size']; } elseif ($this->options['tasks_per_page']) { $this->page_size = $this->options['tasks_per_page']; } else { $this->page_size = 5; } // load project $this->project = new tfk_project(); $this->project->set_uid($this->pid); if (!$this->pid || !$this->project->load()) { echo '<p class="tfk_err">' . __("No such project.", 'taskfreak') . '</p>';
?> "> <?php echo $this->data->errors['title']; ?> </li> <li> <label for="tfk_project"><?php _e('Project', 'taskfreak'); ?> </label> <?php if ($this->projects->count()) { ?> <select name="project_id" id="tfk_project" data-ajax="<?php echo esc_url(add_query_arg('js', 1, tzn_tools::baselink())); ?> "> <?php while ($obj = $this->projects->next(true)) { ?> <option value="<?php echo $obj->get_uid(); ?> "<?php if ($this->pid && $this->data->get('project')->value('project_id') == $obj->get_uid() || !$this->pid && $this->current_project == $obj->get_uid()) { echo " selected"; } ?> ><?php echo strlen($obj->get('name')) > 60 ? substr($obj->get('name'), 0, 60) . '…' : $obj->get('name');
<?php /* @package TaskFreak @since 0.1 @version 1.0 List user's project */ $this->baselink = add_query_arg('mode', 'projects', tzn_tools::baselink()); $this->data = new tfk_project_info(); if ($this->filters['filter_project'] == 'all') { $sql = array('where' => tfk_user::get_roles_sql('who_read') . ' AND trashed=0'); if (!current_user_can('manage_options')) { $sql['having'] = 'project_status_action_code <> 0'; } $this->data->load_list($sql); } else { $this->data->load_list(array('where' => tfk_user::get_roles_sql('who_read') . ' AND trashed=0', 'having' => 'project_status_action_code=' . intval($this->filters['filter_project']))); } $this->view('front/project_list.php');