- Bugfix on the form classes, now the select option is correctly set back. - Update for the database adapter - Improvement of the form elements, added onchange on the select boxes, the form tag now can have no element if needed. - Implementation of the Postgres and MySQL Adapter with propper Namespacing. - Minor bugfixing
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
namespace Nibiru\Model;
|
|
use Nibiru\Adapter\MySQL\Db;
|
|
use Nibiru\Pdo;
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: kasdorf
|
|
* Date: 21.11.17
|
|
* Time: 11:22
|
|
*/
|
|
|
|
class User extends Db
|
|
{
|
|
const TALBE = array(
|
|
'table' => 'user',
|
|
'field' => array(
|
|
'user_id' => 'user_id',
|
|
'user_name' => 'user_name',
|
|
'user_pass' => 'user_pass',
|
|
'user_email' => 'user_email',
|
|
'user_firstname' => 'user_firstname',
|
|
'user_login' => 'user_login',
|
|
'user_account_active' => 'user_account_active'
|
|
)
|
|
);
|
|
|
|
public function __construct()
|
|
{
|
|
self::initTable( self::TABLE );
|
|
}
|
|
|
|
public function selectRowsetById($id = false)
|
|
{
|
|
$id = array(
|
|
self::TABLE['field']['user_id'] => $id
|
|
);
|
|
return Pdo::fetchRowInArrayById(
|
|
self::TABLE['table'], $id
|
|
);
|
|
}
|
|
/**
|
|
* @desc saves user data to the user table in the database
|
|
* @param $userdata
|
|
*/
|
|
public function saveUserDataToTable( $userdata )
|
|
{
|
|
$insert = array();
|
|
foreach ($userdata as $key=>$entry)
|
|
{
|
|
if(array_key_exists($key, self::TALBE['field']))
|
|
{
|
|
$insert[$key] = $entry;
|
|
}
|
|
}
|
|
$this->insertArrayIntoTable($insert, 'user_pass');
|
|
}
|
|
} |