Пример #1
0
 public static function list_links($url, $name, $current)
 {
     return tzn_tools::form_links($url, $name, array('all' => _x('All', 'projects', 'taskfreak')), $current) . tzn_tools::form_links($url, $name, self::get_status_list(current_user_can('manage_options')), $current);
 }
Пример #2
0
<?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');
Пример #3
0
<?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');
Пример #4
0
 /**
  * returns links to pages
  * @link base link
  * @param parameter to change in link
  */
 function pagination_links($link, $param, $class = 'page-numbers', $classon = 'current')
 {
     if (!$this->_page_size) {
         return false;
     }
     $max = 0;
     // loop determining number of pages total
     while ($max * $this->_page_size < $this->total) {
         $max++;
     }
     $str = '';
     if ($max > 0) {
         // no page = no pagination
         $link = preg_replace('/([?|&amp;]' . $param . '\\=[0-9a-zA-Z% ]*)/i', '', $link);
         if (preg_match('/\\?/', $link)) {
             $link .= '&amp;';
         } else {
             $link .= '?';
         }
         $link .= $param . '=';
         $first = true;
         $start = 1;
         $stop = $max;
         if ($max > 10) {
             $start = $this->_page - 7;
             if ($start < 1) {
                 $start = 1;
             }
             $stop = $start + 14;
             if ($stop > $max) {
                 $diff = $stop - $max;
                 $stop = $max;
                 $start -= $diff;
             }
             if ($start < 1) {
                 $start = 1;
             }
         }
         // back to first link
         if ($start > 1) {
             $str = '<a href="' . tzn_tools::concat_url($link, $param . '=1') . '">&lt;&lt;</a> ';
         }
         // previous link
         $str .= $this->pagination_previous($link, $param);
         for ($i = $start; $i <= $stop; $i++) {
             $str .= ' ';
             if ($this->_page == $i) {
                 $str .= '<span class="' . $class . ' ' . $classon . '">' . $i . '</span>';
             } else {
                 $str .= '<a href="' . $link . $i . '" class="' . $class . '">' . $i . '</a>';
             }
         }
         $str .= ' ' . $this->pagination_next($link, $param);
         if ($stop < $max) {
             $str .= ' <a href="' . tzn_tools::concat_url($link, $param . '=' . $max) . '">&gt;&gt;</a>';
         }
     }
     return $str;
 }
Пример #5
0
<?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
Пример #6
0
<?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>
Пример #7
0
Файл: nav.php Проект: tomzt/tfwp
<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>
Пример #8
0
 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();
 }
Пример #9
0
<?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>';
Пример #10
0
					<?php 
}
?>
				</select>
				<?php 
echo $this->data->errors['priority'];
?>
			</li>
			<li>
				<label for="tfk_deadline_date"><?php 
_e('Deadline', 'taskfreak');
?>
</label>
				<input type="text" name="deadline_date" id="tfk_deadline_date" 
					value="<?php 
echo $this->pid && $this->data->value('deadline_date') ? tzn_tools::format_date($this->data->value('deadline_date'), $this->options['format_date']) : '';
?>
">
				<img id="tfk_cal_btn" 
					src="<?php 
echo plugins_url('taskfreak');
?>
/img/calendar.png" 
					alt="<?php 
_e('Calendar', 'taskfreak');
?>
" 
					title="<?php 
_e('Click to show calendar', 'taskfreak');
?>
"
Пример #11
0
<?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');
Пример #12
0
Файл: log.php Проект: tomzt/tfwp
 /**
  * filter links
  */
 public static function list_links($url, $name, $current)
 {
     return tzn_tools::form_links($url, $name, array('all' => _x('All', 'updates', 'taskfreak')), $current) . tzn_tools::form_links($url, $name, self::get_option_list(), $current);
 }
Пример #13
0
 /**
  * get a HTML li (list) of links to task statuses + "All tasks" for filtering status
  * @param unknown $url base URL
  * @param unknown $name name of the filter argument inside the query
  * @param unknown $current current filter
  * @return string
  */
 public static function list_links($url, $name, $current)
 {
     return tzn_tools::form_links($url, $name, array('all' => _x('All tasks', 'tasks', 'taskfreak')), $current) . tzn_tools::form_links($url, $name, self::get_status_list(is_user_logged_in()), $current);
 }