Example #1
0
 function deleteTimer($id)
 {
     global $loggedin_user;
     if (!isLoggedIn()) {
         $this->error = "User not logged in.";
         return false;
     }
     $timer = new SI_Timer();
     if ($timer->get($id) !== FALSE) {
         $timer->delete();
     } else {
         $this->error = "Error deleting timer: " . $timer->getLastError();
         return false;
     }
     return TRUE;
 }
Example #2
0
	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;
	}
Example #3
0
	function get($id = NULL){
		global $db_conn;

		if(!isset($id)){
			$id = $this->id;
		}

		if(!isset($id)){
			$this->error = "SI_Timer::get() : SI_Timer id not set\n";
			return FALSE;
		}

		$SI_Timer = SI_Timer::retrieveSet("WHERE id = $id", TRUE);
		if($SI_Timer === FALSE){
			return FALSE;
		}

		if(isset($SI_Timer[0])){
			$this->updateFromAssocArray($SI_Timer[0]);
			$this->stripSlashes();
		}else{
			$this->error = "SI_Timer::get() : No data retrieved from query\n";
			return FALSE;
		}
		return TRUE;
	}