protected function actionListUserRole()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $deleted = $updated = 0;

        foreach ($selected as $role_id) {

            if ($action === 'status' && $this->access('user_role_edit')) {
                $updated += (int) $this->role->update($role_id, array('status' => $value));
            }

            if ($action === 'delete' && $this->access('user_role_delete')) {
                $deleted += (int) $this->role->delete($role_id);
            }
        }

        if ($updated > 0) {
            $text = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($text, 'success');
        }

        if ($deleted > 0) {
            $text = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($text, 'success');
        }
    }
protected function actionListUserRole()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $deleted = $updated = 0;

        foreach ($selected as $role_id) {

            if ($action === 'status' && $this->access('user_role_edit')) {
                $updated += (int) $this->role->update($role_id, array('status' => $value));
            }

            if ($action === 'delete' && $this->access('user_role_delete')) {
                $deleted += (int) $this->role->delete($role_id);
            }
        }

        if ($updated > 0) {
            $text = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($text, 'success');
        }

        if ($deleted > 0) {
            $text = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($text, 'success');
        }
    }
protected function actionListUserRole ( ) { list ( $ selected , $ action , $ value ) = $ this -> getPostedAction ( ) ; $ deleted = $ updated = 0 ; foreach ( $ selected as $ role_id ) { if ( $ action === 'status' && $ this -> access ( 'user_role_edit' ) ) { $ updated += ( int ) $ this -> role -> update ( $ role_id , array ( 'status' => $ value ) ) ; } if ( $ action === 'delete' && $ this -> access ( 'user_role_delete' ) ) { $ deleted += ( int ) $ this -> role -> delete ( $ role_id ) ; } } if ( $ updated > 0 ) { $ text = $ this -> text ( 'Updated %num item(s)' , array ( '%num' => $ updated ) ) ; $ this -> setMessage ( $ text , 'success' ) ; } if ( $ deleted > 0 ) { $ text = $ this -> text ( 'Deleted %num item(s)' , array ( '%num' => $ deleted ) ) ; $ this -> setMessage ( $ text , 'success' ) ; } }
Applies an action to the selected user roles
Applies an action to the selected user roles