Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 517167a5bc
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 146 lines (116 sloc) 3.547 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
<?php
/**
* DataObject For system's userprofile
*
* This file is part of OpenEvsys.
*
* Copyright (C) 2009 Human Rights Information and Documentation Systems,
* HURIDOCS), http://www.huridocs.org/, info@huridocs.org
*
* OpenEvsys is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenEvsys is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Nilushan Silva <nilushan@respere.com>
*
* @package OpenEvsys
* @subpackage DataModel
*
*/

class UserProfile extends ADODB_Active_Record{


protected $username;
protected $first_name ;
protected $last_name ;
protected $organization;
protected $designation ;
protected $email ;
protected $address ;

private $pkey = array('username');

public function __construct($table = false, $pkeyarr=false, $db=false, $options=array()){
$table = 'user_profile';
parent::__construct($table, $pkey ,$db , $options);

}

//Getter Methods

    public function getUserName(){
        return $this->username;
    }

public function getFirstName(){
return $this->first_name;
}

public function getLastName(){
return $this->last_name;
}

public function getOrganization(){
return $this->organization;
}

public function getDesignation(){
return $this->designation;
}

public function getEmail(){
return $this->email;
}

public function getAddress(){
return $this->address;
}

//Setters

    public function setUserName($username){
        $this->username = $username;
    }

public function setFirstName($first_name){
$this->first_name = $first_name;
}

public function setLastName( $last_name ){
$this->last_name = $last_name;
}

public function setOrganization($organization){
$this->organization = $organization;
}

public function setDesignation($designation){
$this->designation = $designation;
}

public function setEmail($email){
$this->email = $email;

}

public function setAddress($address){
$this->address = $address;
}


public function Save(){
$ok = parent::Save();
if (!$ok){
$err = $this->ErrorMsg();
throw new DbException($err);
}
}

function Delete( $field , $value ) //also common in other Database classes. Should be put to commond place
{
$db = $this->DB(); if (!$db) return false;
$table = $this->TableInfo();

$where = "$field='" . $value . "'";
$sql = 'DELETE FROM '.$this->_table.' WHERE '.$where;
$ok = $db->Execute($sql);

if (!$ok){
$err = $this->ErrorMsg();
throw new DbException($err);
}else
return true;
}

public function toString(){
echo 'Username - ' . $this->getUserName() . '<br />';
echo 'First Name - ' . $this->getFirstName() . '<br />';
echo 'Last Name - ' . $this->getLastName() . '<br />';
echo 'Organization - ' . $this->getOrganization() . '<br />';
echo 'Designation - ' . $this->getDesignation() . '<br />';
echo 'Email - ' . $this->getEmail() . '<br />';
echo 'Address - ' . $this->getAddress() . '<br />';
}
}
?>
Something went wrong with that request. Please try again.