Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ released : 2010-06-11
status : beta
------------------------

Open DOCS/ folder for licence and setup info
Open DOCS/ folder for licence and setup info

这是一个用于追踪工作时间的小应用,分为单用户模式和多用户模式.其中,单用户模式只能一个人登录后添加任务,追踪时间,多用户模式可以设置多个用户,其中有三种角色:管理员,任务管理员和普通用户.管理员可以设置任何人的任务,同时可以管理用户;任务管理员可以查看/编辑/创建别人的任务,普通用户只能查看/设置/编辑自己的任务.

任何人都可以在任务中设置:开始,暂停,结束.系统会自动统计出每一项任务花费的时间以及花费的总时间.

这个程序由TaskFreak创始人编写,原名叫Time Tracking,因为不兼容PHP5.4,我做了一点小修改,使其能够在PHP5.4下面正常运行.

在此对 http://www.taskfreak.com 表示感谢.
6 changes: 3 additions & 3 deletions app/config/db.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

define('APP_DB_HOST','localhost');
define('APP_DB_USER','test'); // edit here
define('APP_DB_USER','root'); // edit here
define('APP_DB_PASS',''); // edit here
define('APP_DB_BASE','taskfreak_timer'); // edit here
define('APP_DB_BASE','test'); // edit here
define('APP_DB_PREFIX','');
define('APP_DB_PERMANENT', true);
define('APP_DB_CONNECTOR','mysql');
Expand All @@ -18,4 +18,4 @@
// 4 : verbose : use FC::log_message (everything) - for debugging only
// 5 : verbose : sends to browser (everything) - for heavy debugging only

define('APP_DB_DEBUG', 2);
define('APP_DB_DEBUG', 2);
8 changes: 5 additions & 3 deletions app/view/include/list-compact.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
<thead>
<tr>
<th>&nbsp;</th>
<th>ID</th>
<th<?php
if ($this->order == 'deadline') echo ' class="active"';
?>><a href="<?php echo $this->fc->getUrl('task','main',array('order'=>'deadline')); ?>"><?php TR::phtml('form','deadline'); ?></a></th>
<th<?php
if ($this->order == 'priority') echo ' class="active"';
?>>
<small><?php
<small><?php
$ct = $this->data->total();
echo $ct.' '.TR::html('data',($ct>1)?'items_found':'item_found');
?></small>
Expand Down Expand Up @@ -51,6 +52,7 @@
}
$total += $this->data->get('spent');
?></td>
<td><?php echo $this->data->getUid();?></td>
<td><?php echo $this->data->htmlDeadline(); ?></td>
<td>
<?php
Expand Down Expand Up @@ -82,7 +84,7 @@
echo '<a href="'.$this->fc->getUrl('task','timer',array('id'=>$id)).'" '
.'class="onhold clock ajax" title="'.TR::html('ui','start_task').'" rel="drun">'.TR::html('button','start').'</a>';
}

echo '<span>';
if (!$this->expand && $cid == $id) {
echo TR::html('task','running');
Expand All @@ -99,7 +101,7 @@
</tbody>
<tfoot>
<tr>
<td colspan="3">
<td colspan="4">
<a href="javascript:checkAll('f_tasks')"><?php TR::phtml('ui','select_all'); ?></a> |
<?php
foreach ($this->actions as $key => $label) {
Expand Down
39 changes: 20 additions & 19 deletions app/view/include/list-expand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@

// start list
echo HtmlFormHelper::iForm('tasks');

?>
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>ID</th>
<th<?php
if ($this->order == 'deadline') echo ' class="active"';
?>><a href="<?php echo $this->fc->getUrl('task','main',array('order'=>'deadline')); ?>"><?php TR::phtml('form','deadline'); ?></a></th>
<th<?php
if ($this->order == 'priority') echo ' class="active"';
?>>
<small><?php
<small><?php
$ct = count($arrData);
echo $ct.' '.TR::html('data',($ct>1)?'items_found':'item_found');
?></small>
Expand All @@ -49,39 +50,39 @@
<?php
$arr = array();
$i = $total = 0;

$cid = ($this->current)?$this->current->getUid():0;

for($j=0;$j<=$c;$j++) {
$arrObj = $arrData[$j];
$d = count($arrObj);
$k=0;
$str = '';
$subtotal = 0;
$obj = $arrObj[0];

$id = $obj->getUid();

// first loop to get total time spent on task
foreach ($arrObj as $obj) {
$subtotal += $obj->get('spent');
}
$total += $subtotal;

$obj->chkDeadline();

// first row displays task information
echo '<tr id="tr_'.$id.'"'
.((!$this->filter)?$obj->curCss(($d>1)?'noline':''):($d>1?' class="noline"':''))
.'>';

// checkbox
echo '<td><input type="checkbox" id="chk_'.$i.'" name="chk[]" '
.'value="'.$id.'" /></td>';
echo '<td>'.$obj->getUid().'</td>';
// deadline
echo '<td>'.$obj->htmlDeadline().'</td>';

echo '<td>';
// edit link
echo '<a href="'.$this->fc->getUrl('task','edit',array('id'=>$id)).'" class="onhold ajax box" title="'
Expand All @@ -102,7 +103,7 @@
echo $obj->html('title');
echo '</a>';
echo '</td>';

// start and end
if ($d>1) {
// many timer, skip info here
Expand All @@ -112,7 +113,7 @@
echo '<td>'.$obj->htmlBegin().'</td>';
echo '<td>'.$obj->htmlEnd().'</td>';
}

// subtotal
echo '<td id="sts_'.$id,'">';
if ($obj->isOpened($this->user_id)) {
Expand All @@ -121,22 +122,22 @@
}
echo TaskSummary::htmlTime($subtotal);
echo '</td>';

echo '</tr>';

if ($d == 1) {
// no timers defined, skip to next task
continue;
}

// second loop to display timers
foreach ($arrObj as $obj) {
$id = $obj->getUid();
$k++;
echo '<tr id="tr_'.$id.'_'.$k.'" class="timer'
.(($k<$d)?' noline':'')
.'">';

// checkbox
echo '<td>&nbsp;</td>';
// deadline
Expand All @@ -149,15 +150,15 @@
echo '<td>'.$obj->htmlEnd().'</td>';
// time spent
echo '<td>'.$obj->getTimeSpent().'</td>';

echo '</tr>';
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<td colspan="4">
<a href="javascript:checkAll('f_tasks')"><?php TR::phtml('ui','select_all'); ?></a> |
<?php
foreach ($this->actions as $key => $label) {
Expand Down
42 changes: 21 additions & 21 deletions lib/class/helpable.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Tzn Framework
*
*
* @package tzn_core_classes
* @author Stan Ozier <[email protected]>
* @version 0.2
Expand All @@ -10,7 +10,7 @@

/**
* Helpable
*
*
* add possibility to have helpers, and call helper method if it doesn't exist
* @since 0.1
*/
Expand All @@ -21,7 +21,7 @@ abstract class Helpable {
public function __construct() {
$this->_helpers = array();
}

/**
* add helper to the class
* @param string $helper name of helper (flat format)
Expand Down Expand Up @@ -53,10 +53,10 @@ public function addHelper() {
break;
default:
$this->_helpers[$helper] = new $class($obj);
break;
break;
}
}

/**
* call helper method
* @param string $key the helper key
Expand All @@ -68,7 +68,7 @@ public function callHelper() {
$method = array_shift($args);
return call_user_func_array(array($this->_helpers[$helper], $method), $args);
}

/**
* call helper's method (arguments are passed as an array
*/
Expand All @@ -82,7 +82,7 @@ public function callHelperArray() {
return $this->_helpers[$helper]->$method();
}
}

/**
* call all available helpers method
* @param string $method the method to be called
Expand All @@ -103,14 +103,14 @@ protected function callHelpers($method) {
}
return $arr;
}

/**
* check if helper is available
*/
public function hasHelper($helper) {
return array_key_exists($helper, $this->_helpers);
}

/**
* get helper
*/
Expand All @@ -121,15 +121,15 @@ public function &getHelper($helper) {
throw new AppException('Unknown helper '.$helper.' in '.get_class($this));
}
}

/**
* call helper method if not defined here
*/
public function __call($name, $args) {
if (!count($this->_helpers)) {
throw new AppException('Unknown method '.$name.' in '.get_class($this).' (and no helper available)');
}

// check if helper's name has been added to method's name eg. methodHelper
/* TOO UGLY, TOO COSTY
$subname = StringHelper::camelToFlat($name);
Expand All @@ -140,25 +140,25 @@ public function __call($name, $args) {
$obj = $this->_helpers[$subhelp];
if (method_exists($obj, $name)) {
return call_user_func_array(array($obj, $name), $args);
}
}
}
}
*/

// check if method exists in one of the helper
foreach ($this->_helpers as $key => $obj) {
if (method_exists($obj, $name)) {
return call_user_func_array(array($obj, $name), $args);
}
}

// try again within helper if __call is available
foreach ($this->_helpers as $key => $obj) {
if (method_exists($obj, '__call')) {
return call_user_func_array(array($obj, $name), $args);
}
}

// nope, forget it
throw new AppException('Unknown method '.$name.' in '.get_class($this).' or any helper ('.implode(', ',array_keys($this->_helpers)).')');
}
Expand All @@ -170,30 +170,30 @@ public function __call($name, $args) {
* sucks duplicating code, but needed for singletons as constructor must be private
* @since 0.1
*/

abstract class HelpableSingleton {

private $_helpers;

private function __construct() {
$this->_helpers = array();
}

/**
* add helper to the class
*/
protected function addHelper($helper, $obj=null) {
$class = StringHelper::flatToCamel($helper, true).'Helper';
$this->_helpers[$helper] = new $class($obj);
}

/**
* check if helper is available
*/
public function hasHelper($helper) {
return array_key_exists($helper, $this->_helpers);
}

/**
* get helper
*/
Expand All @@ -204,7 +204,7 @@ public function &getHelper($helper) {
throw new AppException('Unknown helper '.$helper.' in '.get_class($this));
}
}

/**
* call helper method if not defined here
*/
Expand All @@ -231,7 +231,7 @@ public function __call($name, $args) {
*
* class implementing this will be able to send calls to other nested classes
*/
interface Callable {
interface CallableInterface {
public function __call($name, $args);
/*
public function __call($name, $args) {
Expand Down
Loading