mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Can update the name of the group
This commit is contained in:
		@@ -128,6 +128,26 @@ class GroupsComponent {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set (update) group settings
 | 
			
		||||
     * 
 | 
			
		||||
     * @param GroupSettings $settings The settings to update
 | 
			
		||||
     * @return bool TRUE for a success / FALSE
 | 
			
		||||
     */
 | 
			
		||||
    public function set_settings(GroupSettings $settings) : bool {
 | 
			
		||||
        
 | 
			
		||||
        //Generate database entry
 | 
			
		||||
        $modif = $this->GroupSettingsToDB($settings);
 | 
			
		||||
 | 
			
		||||
        //Apply update
 | 
			
		||||
        return db()->updateDB(
 | 
			
		||||
            self::GROUPS_LIST_TABLE, 
 | 
			
		||||
            "id = ?",
 | 
			
		||||
            $modif,
 | 
			
		||||
            array($settings->get_id()));
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Insert a new group member
 | 
			
		||||
     * 
 | 
			
		||||
@@ -268,6 +288,20 @@ class GroupsComponent {
 | 
			
		||||
        return $info;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Turn a GroupSettings object into a database entry
 | 
			
		||||
     * 
 | 
			
		||||
     * @param GroupSettings $settings The object to convert
 | 
			
		||||
     * @return array Generated database entry
 | 
			
		||||
     */
 | 
			
		||||
    private function GroupSettingsToDB(GroupSettings $settings) : array {
 | 
			
		||||
        $data = array();
 | 
			
		||||
 | 
			
		||||
        $data["name"] = $settings->get_name();
 | 
			
		||||
 | 
			
		||||
        return $data;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//Register component
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user