function sortMenu($REQUEST,$parent_id,$update=0){ $grid = new grid(true); $grid->setTable("menu"); $grid->setJoin("LEFT JOIN iconcls ON menu.iconcls = iconcls.clsname"); $grid->setManualFilter(" AND parent_id = '$parent_id'"); $grid->addField(Array('field'=>'menu.id','name'=>'id','primary'=>true)); $grid->addField(Array('field'=>'menu.title','name'=>'title')); $grid->addField(Array('field'=>'iconcls.icon','name'=>'iconcls')); $grid->addField(Array('field'=>'menu.sort_id','name'=>'sort_id')); if ($update) return $grid->doUpdate($REQUEST['data']); else return $grid->doRead($REQUEST); }
function getUser($action,$REQUEST){ $grid = new grid(true); $grid->setTable("users"); $grid->setManualFilter(" and user_id <> 1"); $grid->addField( array( "field"=>"user_id", "name"=>"user_id", "primary"=>true )); $grid->addField( array( "field"=>"user_name", "name"=>"user_name" )); $grid->addField( array( "field"=>"real_name", "name"=>"real_name" )); $grid->addField( array( "field"=>"user_password", "name"=>"user_password" ) ); $grid->addField( array( "field"=>"group_id", "name"=>"group_id" ) ); $grid->addField( array( "field"=>"date_created", "name"=>"date_created" ) ); $grid->addField( array( "field"=>"last_login", "name"=>"last_login" ) ); $grid->addField( array( "field"=>"is_active", "name"=>"is_active" ) ); switch ($action){ case 'doRead': return $this->decodePassword($grid->doRead($REQUEST)); break; case 'doCreate': return $this->decodePassword($grid->doCreate($this->encodePassword($REQUEST['data']))); break; case 'doUpdate': return $this->decodePassword($grid->doUpdate($this->encodePassword($REQUEST['data']))); break; case 'doDestroy': return $grid->doDestroy($REQUEST['data']); break; } }