コード例 #1
0
ファイル: SI_User.php プロジェクト: nanoprime/sureinvoice
	function startTimer($name){
		$timer = new SI_Timer();
		$timer->name = $name;
		$timer->user_id = $this->id;
		if($timer->add() == FALSE){
			$this->error = 'SI_User::startTimer(): '.$timer->getLastError();
			return FALSE;
		}
		
		if($timer->start() === FALSE){
			$this->error = 'SI_User::startTimer(): '.$timer->getLastError();
			return FALSE;
		}
		
		return $timer;
	}
コード例 #2
0
ファイル: SureInvoice.php プロジェクト: nanoprime/sureinvoice
 function startTimer($id)
 {
     global $loggedin_user;
     if (!isLoggedIn()) {
         $this->error = "User not logged in.";
         return false;
     }
     $timer = new SI_Timer();
     $timer_data = array();
     if ($timer->get($id) !== FALSE) {
         $timer->start();
         $timer_data['id'] = $timer->id;
         $timer_data['name'] = $timer->name;
         $timer_data['status'] = $timer->status;
         $timer_data['total'] = formatLengthOfTime($timer->getTotal());
     } else {
         $this->error = "Error starting timer: " . $timer->getLastError();
         return false;
     }
     return $timer_data;
 }