コード例 #1
0
	function gridEvent($action,$REQUEST,$menu_id) {
		$grid = new grid(true); 
		$grid->setTable("menu_event"); 
		$grid->setManualFilter(" and menu_id ='$menu_id'"); 
		$grid->addField(
				array(
					"field"=>"id",
					"name"=>"id",
					"primary"=>true
				));
		$grid->addField(
				array(
					"field"=>"menu_id",
					"name"=>"menu_id"
				));
		$grid->addField(
				array(
					"field"=>"event_name",
					"name"=>"event_name"
				));
				
		switch ($action){
			case 'doRead': 
				return $grid->doRead($REQUEST); 	
			break; 
			case 'doCreate': 
				$result =  $grid->doCreate($REQUEST['data']);
				$this->createEventMenu($result);
				return $result;  	
			break; 	
			case 'doUpdate': 
				return $grid->doUpdate($REQUEST['data']); 	
			break; 		
			case 'doDestroy': 
				$this->dropEventMenu($REQUEST['data']);
				return $grid->doDestroy($REQUEST['data']); 	
			break; 				
		}
		
	}
コード例 #2
0
	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; 				
		}
		
	}