You've already forked postfixadmin
mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2025-07-29 22:41:11 +03:00
added some things to model class
added user_model.php for user handling added user_controller.php for controlling user missgin view for output. git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@933 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
60
scripts/snippets/user_controller.php
Normal file
60
scripts/snippets/user_controller.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
|
||||
|
||||
public function view($id = NULL) {
|
||||
if ($id != NULL) {
|
||||
$this->User->load( array( 'where' => array( $this->User->coloumn_id, $id ) ) );
|
||||
} else {
|
||||
$this->Userload();
|
||||
}
|
||||
|
||||
//function for sending the layout the arg $this->User->Assoc();
|
||||
//return $this->User->Assoc();
|
||||
}
|
||||
public function edit($id) {
|
||||
if($id == NULL) {
|
||||
$this->errormsg[] = 'The User is nonexistent.';
|
||||
return false;
|
||||
}
|
||||
$this->User->load(array( 'where' => array( $this->User->coloumn_id, $id )));
|
||||
//function for sending the layout the arg $this->User->Assoc();
|
||||
|
||||
//postswtich
|
||||
//bla bla smarty stuff for getting the values
|
||||
//$this->User->values = array('frit@example.com', 'hased HMAC_MD5 PW', 'Fritz', '/home/fritz/maildir', 51200000, 'fritz', 'example.com', '{[CREATED]}', '{[MODIFIED]}'); {} = Model should replace something, [] = constant not tablenames
|
||||
|
||||
if( ! $this->User->save() ) {
|
||||
$this->errormsg[] = 'The data can't be saved.';
|
||||
return false;
|
||||
}
|
||||
|
||||
//redirect to view($id)
|
||||
}
|
||||
|
||||
public function add() {
|
||||
|
||||
|
||||
//only if $_POST of $_GET
|
||||
|
||||
//bla bla smarty stuff for filling the values
|
||||
//$this->User->values = array('frit@example.com', 'hased HMAC_MD5 PW', 'Fritz', '/home/fritz/maildir', 51200000, 'fritz', 'example.com', '{[CREATED]}', '{[MODIFIED]}'); {} = Model should replace something, [] = constant not tablenames
|
||||
|
||||
if( ! $this->User->save() ) {
|
||||
$this->errormsg[] = 'The data can't be saved.';
|
||||
return false;
|
||||
}
|
||||
//redirect to view($id)
|
||||
}
|
||||
public function delete($id) {
|
||||
|
||||
}
|
||||
public function activate() {
|
||||
|
||||
}
|
||||
public function deactivate() {
|
||||
|
||||
}
|
Reference in New Issue
Block a user